源码内容:
Params
Numeric s_Length(10);
Numeric l_Length(20);
Numeric lots(1);
Numeric OffSet(3);
Vars
NumericSeries EFMA;
NumericSeries EF;
Numeric MER;
NumericSeries LY;
NumericSeries LYSX;
Numeric i_Offset;
Begin
i_Offset = OffSet * MinMove * PriceScale;
EF = Max((Highest(Close,s_Length) - Lowest(Close,s_Length)),Abs(Close -Close[s_Length]))/Summation(Abs(Close - Close[1]),s_Length);
EFMA = Average(EF,s_Length);
//在文化里用EMA平滑EF值,但TB的XAverage算出来的值差很多,所以就用MA了。
//
MER = IntPart(s_Length-(efma-0.5)*l_Length);
LY = Summation((Close - Close[1])*Vol,MER);
LYSX = Average(LY,s_Length);
If(LYSX[1]>0) Buy(lots,open+i_offset);
If(LYSX[1]<0) SellShort(lots,open-i_Offset);
//PlotNumeric ("OpenToClose",High,Low,red);
End