以文本方式查看主题 - 金字塔客服中心 - 专业程序化交易软件提供商 (http://weistock.com/bbs/index.asp) -- 公式模型编写问题提交 (http://weistock.com/bbs/list.asp?boardid=4) ---- 老师,设置为轮询1秒模式,平仓想设为走完1根K线但提前1秒下单?开仓想保持信号出现马上下单。麻烦老师帮下忙!谢了 (http://weistock.com/bbs/dispbbs.asp?boardid=4&id=157868) |
-- 作者:panjia1000 -- 发布时间:2017/9/13 11:02:23 -- 老师,设置为轮询1秒模式,平仓想设为走完1根K线但提前1秒下单?开仓想保持信号出现马上下单。麻烦老师帮下忙!谢了 //老师,设置为轮询1秒模式,平仓想设为走完1根K线但提前1秒下单?开仓想保持信号出现马上下单 DMA5: MA(high,5); KMA5: MA(low,5); DMA10:MA(high,10); KMA10:MA(Low,10); B1:=CROSS(DMA5,DMA10); B2:=CROSS(KMA10,KMA5); if date<>ref(date,1) then begin count1:=1; count2:=1; end lots:=1; //亏损平仓(想设为走完1根K线但提前1秒下单) if holding>0 and l<=ENTERPRICE-10 then begin sell(1,holding,NEXTOPEN),IGNORECHECKPRICE; end if holding<0 and h>=ENTERPRICE+10 then begin sellshort(1,holding,NEXTOPEN),IGNORECHECKPRICE; end //开仓(设为固定1秒轮询想保持信号出现马上下单) if holding=0 and count2=1 then begin if B1 then begin buy(1,lots,limitr,open),IGNORECHECKPRICE; HigherAfterEntry:=enterprice; LowerAfterEntry:=enterprice; end end if holding=0 and count2=1 then begin if B2 then begin buySHORT(1,lots,limitr,open),IGNORECHECKPRICE; HigherAfterEntry:=enterprice; LowerAfterEntry:=enterprice; end end //盈利平仓(想设为走完1根K线但提前1秒下单) if holding>0 and enterbars>0 then begin if enterbars>=1 and HigherAfterEntry>=enterprice*1 then begin price:=EnterPrice+(HigherAfterEntry-EnterPrice)*1; if low<=price then begin sell(1,holding,NEXTOPEN),IGNORECHECKPRICE; count2:=1; end end; end; if holding<0 and enterbars>0 then begin if enterbars>=1 and lowerAfterEntry<=enterprice*1 then begin price:=EnterPrice - (EnterPrice-LowerAfterEntry)*1; if high>=price then begin sellshort(1,holding,NEXTOPEN),IGNORECHECKPRICE; count2:=1; end; |
-- 作者:wenarm -- 发布时间:2017/9/13 11:28:03 -- 平仓条件中加入abb:=(time0-timetot0(dynainfo(207))<=tq) or not(islastbar); 这个判断、 提前下单的范例代码,tq是提前的时间没 ma5:=ma(c,5); if abb then begin end |
-- 作者:panjia1000 -- 发布时间:2017/9/13 19:38:49 -- 老师,增加红色的这样改,可以达到“置为轮询1秒模式,平仓想设为走完1根K线但提前1秒下单”的目的吗?我是个菜鸟,请多指教 //要设置为轮询1秒模式,平仓想设为走完1根K线但提前1秒下单,开仓想及时下单 p2:=if(islastbar,dynainfo(207),time);
//亏损平仓 if holding>0 and l<=ENTERPRICE-10 AND HOLDING>0 and p3<=1,0,limitr,jgs-hdk then begin |
-- 作者:wenarm -- 发布时间:2017/9/13 21:10:31 -- 不对。 DMA5: MA(high,5);
KMA5: MA(low,5); DMA10:MA(high,10); KMA10:MA(Low,10); B1:=CROSS(DMA5,DMA10); B2:=CROSS(KMA10,KMA5); if date<>ref(date,1) then begin count1:=1; count2:=1; end abb:=(time0-timetot0(dynainfo(207))<=1) or not(islastbar); lots:=1; //亏损平仓(想设为走完1根K线但提前1秒下单) if holding>0 and l<=ENTERPRICE-10 and abb then begin sell(1,holding,NEXTOPEN),IGNORECHECKPRICE; end if holding<0 and h>=ENTERPRICE+10 and abb then begin sellshort(1,holding,NEXTOPEN),IGNORECHECKPRICE; end //开仓(设为固定1秒轮询想保持信号出现马上下单) if holding=0 and count2=1 then begin if B1 then begin buy(1,lots,limitr,open),IGNORECHECKPRICE; HigherAfterEntry:=enterprice; LowerAfterEntry:=enterprice; end end if holding=0 and count2=1 then begin if B2 then begin buySHORT(1,lots,limitr,open),IGNORECHECKPRICE; HigherAfterEntry:=enterprice; LowerAfterEntry:=enterprice; end end //盈利平仓(想设为走完1根K线但提前1秒下单) if holding>0 and enterbars>0 then begin if enterbars>=1 and HigherAfterEntry>=enterprice*1 then begin price:=EnterPrice+(HigherAfterEntry-EnterPrice)*1; if low<=price and abb then begin sell(1,holding,NEXTOPEN),IGNORECHECKPRICE; count2:=1; end end end if holding<0 and enterbars>0 then begin if enterbars>=1 and lowerAfterEntry<=enterprice*1 then begin price:=EnterPrice - (EnterPrice-LowerAfterEntry)*1; if high>=price and abb then begin sellshort(1,holding,NEXTOPEN),IGNORECHECKPRICE; count2:=1; end end end |
-- 作者:panjia1000 -- 发布时间:2017/9/14 11:13:47 -- 谢谢老师,谢谢老师 |