金字塔决策交易系统

 找回密码
 

微信登录

微信扫一扫,快速登录

搜索
查看: 1579|回复: 1

求修改Asctrend代码

[复制链接]

13

主题

38

帖子

48

积分

Rank: 4

等级: 专业版

注册:
2021-5-20
曾用名:
发表于 2021-7-6 16:36 | 显示全部楼层 |阅读模式
网上看到一个MT4源码,看介绍效果很好
老师可否帮忙看看,能不能给解释一下,如果能帮忙给个金字塔的代码就更好了,谢谢!
[Visual Basic] 复制代码
int start()
{   
   
   double value2;
   double value3;
   double value10=10;
   double value11;
   double x1=70;
   double x2=30;
   int TrueCount;
   int counter;
   int MRO1;
   int MRO2;
   int i1;
   double Range;
   double AvgRange;
   double val1;
   double val2;
   double Table_value2[500][2];
   int counted_bars=IndicatorCounted();
   
   value10=3+RISK*2;
   x1=67+RISK;
   x2=33-RISK;
   value11=value10;
  //---------------------------- 
    
   if(counted_bars<0) return (-1);
   if(counted_bars>0) counted_bars--;       //last bar recounted
   int i;
   int shift = Bars-counted_bars-1;
   if (shift > AllBars) shift = AllBars;
         
  for(i=shift; i>0; i--)
   {
   


   
                 
      counter=i;
      Range=0;
      AvgRange=0;
      for (counter=i ;counter<=i+9;counter++)
      {
         AvgRange=AvgRange+MathAbs(High[counter]-Low[counter]);
      }
      Range=AvgRange/10;
      
      
      counter=i;
      TrueCount=0;
      while (counter<i+9 && TrueCount<1)
      {
         if (MathAbs(Open[counter]-Close[counter+1])>=Range*2.0 )
               TrueCount++;
         counter++;
      }

      if (TrueCount>=1) 
            MRO1=counter ; 
      else 
            MRO1=-1;
            
      counter=i;
      TrueCount=0;
      while (counter<i+6 && TrueCount<1)
      {
           if(MathAbs(Close[counter+3]-Close[counter])>=Range*4.6)
            {TrueCount++;}
           counter++;
      }
      
      if(TrueCount>=1) 
            MRO2=counter; 
      else 
            MRO2=-1;
            
      if (MRO1>-1) 
            value11=3; 
      else 
            value11=value10;
            
      if (MRO2>-1) 
            value11=4; 
      else 
           value11=value10;
          
            
      value2=100-MathAbs(iWPR(NULL,0,value11,i));
      Table_value2[0]=i;
      Table_value2[1]=value2;
      val1=0;
      val2=0;
      value3=0;
      //-------------------     val1  
      if (value2<x2 )  //  x2 = 30
      {
         i1=1;
         while (Table_value2[i+i1][1]>=x2 && Table_value2[i+i1][1]<=x1)
         {i1++;}
         if (Table_value2[i+i1][1]>x1)
         {
            value3=High+Range*0.5;
            val1=value3;
         }
      }
      //-------------------     val2  
      if ( value2>x1) // x1 = 70 
      {  
            i1=1;
            while (Table_value2[i+i1][1]>=x2 && Table_value2[i+i1][1]<=x1)
            {i1++;}
            if (Table_value2[i+i1][1]< x2)
            {
               value3=Low-Range*0.5;
               val2=value3;
            } 
      }
      if (val2!=0 && up==0 )
      {     
           val1buffer= val2-1*Point;
           up=1;
           dn=0;
           if(shift<=2)
           {
            Alert (Symbol()," ",Period(),"M  Asctrend BUY ");
            }
      }  
      if (val1 !=0 && dn==0)
      {
            val2buffer= val1+1*Point;
            dn=1;
            up=0;
            if(shift<=2)
            {
            Alert (Symbol()," ",Period(),"M   Asctrend SELL ");
            }
       }
   }
return(0);

回复

使用道具 举报

3

主题

2万

帖子

2万

积分

Rank: 8Rank: 8

等级: 超级版主

注册:
2021-5-24
曾用名:
发表于 2021-7-6 20:11 | 显示全部楼层
这边对mt4也不是很熟,很多地方也没法翻译的
金字塔提供一对一VIP专业技术指导服务,技术团队实时响应您的日常使用问题与策略编写。联系电话:021-20339086
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 微信登录

本版积分规则

手机版|小黑屋|上海金之塔信息技术有限公司 ( 沪ICP备13035422号 )

GMT+8, 2024-12-23 00:19 , Processed in 0.210181 second(s), 21 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表