等级: 专业版
- 注册:
- 2022-8-5
- 曾用名:
|
//参数定义
EMA13:=EMA(C,10),COLORWHITE;
EMA21:=EMA(C,21),COLORYELLOW;
EMA34:=EMA(C,34),COLORFF00FF;
EMA60:=MA(C,55),COLORFFCC66;
X1:=(C+L+H)/3;
X2:=EMA(X1,5);
X3:=EMA(X2,4);
STICKLINE(X2>X3 AND C>EMA13,LOW,HIGH,0.1,1),COLORRED;
STICKLINE(X2>X3 AND C>EMA13,CLOSE,OPEN,3,1),COLORRED;
STICKLINE(X2<X3 AND C<EMA13,LOW,HIGH,0.1,1),COLORFFFF52;
STICKLINE(X2<X3 AND C<EMA13,CLOSE,OPEN,3,0),COLORFFFF52;
BUY1:=FILTER(X2>X3 AND C>EMA13,4);
SELL1:=FILTER(X2<X3 AND C<EMA13,4);
//使用系列模式时
//{开多} ENTERLONG:BUY1,TFILTER;
//{平多}EXITLONG:SELL1 ,TFILTER;
//
//{开空}ENTERSHORT:SELL1 ,TFILTER;
//{平空}EXITSHORT:BUY1 ,TFILTER;
//使用逐K线模式时
VARIABLE:DUOKONG=0;
TSFS:=0; {停损反手,1-反手 0-不反手}
ORDVOL:=1; {开仓手数}
ZSDS:=10; {止损点数}
//以下变量用于移动止盈,,移动止盈只能保证你尽可能稳健盈利,却不能保证盈利最大化,如果不想使用,可是将总开关设置为0
VARIABLE:YDZY=1; {移动止盈总开关,1为开,0为关}
VARIABLE:HIGHPRICE=0,LOWPRICE=0; {保存开仓后的最高价、最低价}
VARIABLE:DHCDS=3,KHCDS=3; {多、空单回撤点数}
VARIABLE:DYLDS=7,KYLDS=7; {多、空单盈利点数,当盈利点数达到这个标准后,如果回撤达到上面的参数值就平仓}
VARIABLE:Z3B1:=1; {赚3保1开关}
DUOKONG:=1;
//持有空单
IF HOLDING<0 THEN BEGIN
IF BUY1 THEN BEGIN //平空单
空平:SELLSHORT(1,0,MARKET),ORDERQUEUE;
END
//止损
IF C-ENTERPRICE>=ZSDS THEN BEGIN
空损:SELLSHORT(1,0,MARKET),ORDERQUEUE;
END
//移动止盈
IF YDZY=1 THEN BEGIN
//每周期判断是否创新低
IF L<LOWPRICE THEN BEGIN
LOWPRICE:=L;
END
//如果盈利超过10点之后回撤达到3点,就平仓,保住盈利
IF ENTERPRICE-LOWPRICE>=KYLDS THEN BEGIN
IF L-LOWPRICE>=KHCDS THEN BEGIN //回撤超过3点
空赢:SELLSHORT(1,0,MARKET);
END
END
END
//赚3保1
IF Z3B1=1 THEN BEGIN
IF ENTERPRICE-LOWPRICE>=3 THEN BEGIN
IF ENTERPRICE-L<=1.2 THEN BEGIN
空保:SELLSHORT(1,0,MARKET);
END
END
END
END
//开多单
IF HOLDING=0 THEN BEGIN
IF DUOKONG=1 OR DUOKONG=2 THEN BEGIN
IF BUY1 THEN BEGIN
多开:BUY(1=1,ORDVOL,MARKET);
HIGHPRICE:=ENTERPRICE; //将开仓价保存到最高价
END
END
END
//持有多单
IF HOLDING>0 THEN BEGIN
IF SELL1 THEN BEGIN {平多单}
多平:SELL(1,0,MARKET),ORDERQUEUE;
END
//多单管理
//止损
IF ENTERPRICE-C>=ZSDS THEN BEGIN
多损:SELL(1,0,MARKET),ORDERQUEUE;
END
//移动止盈
IF YDZY=1 THEN BEGIN
//每周期判断是否创新高
IF H>HIGHPRICE THEN BEGIN
HIGHPRICE:=H;
END
//如果盈利超过10点之后回撤达到3点,就平仓,保住盈利
IF HIGHPRICE-ENTERPRICE>=DYLDS THEN BEGIN
IF HIGHPRICE-H>=DHCDS THEN BEGIN //回撤超过3点
多赢:SELL(1,0,MARKET);
END
END
END
//赚3保1
IF Z3B1=1 THEN BEGIN
IF HIGHPRICE-ENTERPRICE>=3 THEN BEGIN
IF H-ENTERPRICE<=1.2 THEN BEGIN
多保:SELL(1,0,MARKET);
END
END
END
END
//开空单
IF HOLDING=0 THEN BEGIN
IF DUOKONG=1 OR DUOKONG=3 THEN BEGIN
IF SELL1 THEN BEGIN
空开:BUYSHORT(1=1,ORDVOL,MARKET);
LOWPRICE:=ENTERPRICE;
END
END
END
当前持仓:HOLDING,COLORGRAY,LINETHICK0;
当前资产:ASSET,NOAXIS,COLORGRAY;
实现开仓后N周期使用有效,超过时间周期则不生效。谢谢
|
|