Bootstrap

文华财经T9多空波段趋势量化交易策略模型源码

// 定义变量

Vars

Numeric STEP1,MVALUE1,SARVAL,C;

Numeric SARLINE,COND,ZBMA1,ZBMA2;

Begin

C=CLOSE;

STEP1=3/11;

MVALUE1=20/22;

SARVAL=SAR(4, STEP1, MVALUE1);

PlotLine("",IIF(SARVAL>0,SARVAL,InvalidNumeric),RED,Circledot);

PlotLine("",IIF(SARVAL<0,-SARVAL,InvalidNumeric),CYAN,Circledot);

DRAWTEXT(CROSS(SARVAL<0,0.615), -SARVAL, "空", GREEN);

DRAWTEXT(CROSS(SARVAL>0,0.615), SARVAL, "多", RED);

SARLINE=SAR(4,STEP1,MVALUE1);

COND=CROSSDOWN(SARLINE,0);

ZBMA1=EMA(C,3);

ZBMA2=EMA(C,34);

PlotLine("ZBMA2",ZBMA2,RGB(0,128,255),Linethick2);

//做多策略

IF(CROSS(SARVAL>0,0.8)) BPK(1);

//做空策略

IF(CROSS(SARVAL<0,1)) SPK(1);

End

;