文华wh3股指日内1分钟限价止损和追踪止盈模型
-
相关简介:具体源码如下: //参数:15,2,2,6,10 JJ:=(2*C+H+L)/4; AA:=EMA(JJ,N1); BB:=REF(AA,1); MA1:=MA(C,20); MA2:=MA(C,55); TR:=MAX(MAX((HIGH-LOW),ABS(REF(CLOSE,1)-HIGH)),ABS(REF(CLOSE,1)-LOW)); ATR:=REF(MA(TR,20),1); DIFF:=EMA(CLOSE,12)-EMA(CLOSE,26); DEA:=EMA(DIFF,9);
-
文章来源:股海网作者:股海网发布时间:2013-09-08浏览次数:
具体源码如下:
//参数:15,2,2,6,10
JJ:=(2*C+H+L)/4;
AA:=EMA(JJ,N1);
BB:=REF(AA,1);
MA1:=MA(C,20);
MA2:=MA(C,55);
TR:=MAX(MAX((HIGH-LOW),ABS(REF(CLOSE,1)-HIGH)),ABS(REF(CLOSE,1)-LOW));
ATR:=REF(MA(TR,20),1);
DIFF:=EMA(CLOSE,12)-EMA(CLOSE,26);
DEA:=EMA(DIFF,9);
MACD:=2*(DIFF-DEA);
//定义限价止损变量
MINPRICE('IF1207')
A:=0.2;//取合约最小变动价位
HH:=HHV(H,BARSBK+1);//买开仓位置到现在最高价
LL:=LLV(L,BARSSK+1);//卖开仓位置到现在最低价
//限价止损模块:
SL:=N2*ATR;
TP:=N3*SL;
DTP:=(N4/10)*SL;
A1:=BKPRICE+TP;
A2:=A1+DTP;
A3:=A1-N5*A;
A4:=HH-DTP;//以上为根据止赢点差计算多单追踪止赢位置
B1:=SKPRICE-TP;
B2:=B1-DTP;
B3:=B1+N5*A;
B4:=LL+DTP;//以上为根据止赢点差计算空单追踪止赢位置
CROSS(AA,BB)&&MA1>MA2&&TIME>0920&&TIME<1455,BK;
TIME>=1510||(((C<=BKPRICE-SL)||(HH>=A1&&HH<=A2&&C<=A3)||(HH>A2&&C<=A4))&&BKPRICE>0),SP ;
CROSS(BB,AA)&&MA1<MA2&&TIME>0920&&TIME<1455,SK;
TIME>=1510||(((C>=SKPRICE+SL)||(LL<=B1&&LL>=B2&&C>=B3)||(LL<B2&&C>=B4))&&SKPRICE>0),BP;
AUTOFILTER;