Asctrend策略源码(MT4.0平台)
[code]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);
[/code] 货币对:所有
周期: 1H以上(含1H)
交易规则:
01. 多头进场条件:
a. 5EMA 向上穿越 10EMA.
b. RSI向上穿越50水平线.
c. ASCTREND1 呈蓝色箭头信号 和ASCTREND2呈绿色圆点信号。
d. KD向上。
e. CCI线向上穿越50%水平线。
02. 空头进场条件:
a. 5EMA 向下穿越 10EMA。
b. RSI向下穿越50水平线。
c. ASCTREND1呈红色箭头信号 和ASCTREND2呈红色圆点信号。
d. KD向下 。
e. CCI线向下穿越50%水平线。
03. 固定止损30个点,可设置20点跟踪止损。当出现30个点的利润后可将止损移至盈亏平衡点。
04. 当5EMA均线与10EMA均线相对于你交易的相反方向交叉,或者价格反弹至布林带异轨,或者当随机指标线快慢线收敛。
05. 每笔交易的最大风险为总资金的20%。 这个指标好像不完整 学习了 感谢分享 {:smile:}
页:
[1]