[原创]老师帮看下,这样写图表程序对吗? [金字塔]
- 咨询内容:
//时间控制A1:=TIME>=0905&&TIME<1010;A2:=TIME>=1035&&TIME<1125;B1:=TIME>=1335&&TIME<1455;B2:=TIME>=2105&&TIME<2325;TT:=A1 OR A2 OR B1 OR B2; //中间条件DIFF:EMA(CLOSE,12)-EMA(CLOSE,26);DEA:EMA(DIFF,9);C1:=BARSLAST(CROSS(DIFF,DEA))>=3;//BARSLAST函数过滤,避免短时间段内频繁交易C2:=BARSLAST(CROSS(DEA,DIFF))>=3;//交易条件开多:=TT AND CROSS(DIFF,DEA) AND C1;开空:=TT AND CROSS(DEA,DIFF) AND C2;//交易系统BUY(开多 and HOLDING=0,1,market);//交易系统之开多操作BUYSHORT(开空 and HOLDING=0,1,market); //交易系统之开空操作
//固定止损部分************************//多头止盈IF C-AVGENTERPRICE>8*MINDIFF THEN BEGINSELL(1,HOLDING,MARKET);END//多头止损IF AVGENTERPRICE-C>4*MINDIFF THEN BEGINSELL(1,HOLDING,MARKET);END//空头止盈IF AVGENTERPRICE-C>8*MINDIFF THEN BEGINSELLSHORT(1,HOLDING,MARKET);END//空头止损IF C-AVGENTERPRICE>4*MINDIFF THEN BEGINSELLSHORT(1,HOLDING,MARKET);END//收盘前清仓**********************p2:=if(islastbar,dynainfo(207),time);if p2>=145800 thenbeginsellshort(holding<0,0,limitr,CLOSE);sell(holding>0,0,limitr,CLOSE);end//其他r1:=barslast(date<>ref(date,1));日盈亏:asset-ref(asset,r1+1),noaxis,colorred,linethick1; - 金字塔客服:
A1:=TIME>=090500&&TIME<101000;
A2:=TIME>=103500&&TIME<112500;
B1:=TIME>=133500&&TIME<145500;
B2:=TIME>=210500&&TIME<232500;
TT:=A1 OR A2 OR B1 OR B2;
//中间条件
DIFF:EMA(CLOSE,12)-EMA(CLOSE,26);
DEA:EMA(DIFF,9);
C1:=BARSLAST(CROSS(DIFF,DEA))>=3;//BARSLAST函数过滤,避免短时间段内频繁交易
C2:=BARSLAST(CROSS(DEA,DIFF))>=3;
//交易条件
开多:=TT AND CROSS(DIFF,DEA) AND ref(C1,1);
开空:=TT AND CROSS(DEA,DIFF) AND ref(C2,1);
//交易系统
BUY(开多 and HOLDING=0,1,market);//交易系统之开多操作
BUYSHORT(开空 and HOLDING=0,1,market); //交易系统之开空操作
//固定止损部分************************
//多头止盈
IF C-AVGENTERPRICE>8*MINDIFF THEN BEGIN
SELL(1,HOLDING,MARKET);
END
//多头止损
IF AVGENTERPRICE-C>4*MINDIFF THEN BEGIN
SELL(1,HOLDING,MARKET);
END
//空头止盈
IF AVGENTERPRICE-C>8*MINDIFF THEN BEGIN
SELLSHORT(1,HOLDING,MARKET);
END
//空头止损
IF C-AVGENTERPRICE>4*MINDIFF THEN BEGIN
SELLSHORT(1,HOLDING,MARKET);
END
//收盘前清仓**********************
p2:=if(islastbar,dynainfo(207),time);
if p2>=145800 then
begin
sellshort(holding<0,0,limitr,CLOSE);
sell(holding>0,0,limitr,CLOSE);
end
//其他
r1:=barslast(date<>ref(date,1));
日
有思路,想编写各种指标公式,程序化交易模型,选股公式,预警公式的朋友
可联系技术人员 QQ: 511411198 进行 有偿 编写!(不贵!点击查看价格!)
相关文章
-
没有相关内容