欢迎使用金字塔普通技术服务论坛,您可以在相关区域发表技术支持贴。
我司技术服务人员将优先处理 VIP客服论坛 服务贴,普通区问题处理速度慢,请耐心等待。谢谢您对我们的支持与理解。


金字塔客服中心 - 专业程序化交易软件提供商金字塔软件公式模型编写问题提交 → 老师,设置为轮询1秒模式,平仓想设为走完1根K线但提前1秒下单?开仓想保持信号出现马上下单。麻烦老师帮下忙!谢了

   

欢迎使用金字塔普通技术服务论坛,您可以在相关区域发表技术支持贴。
我司技术服务人员将优先处理 VIP客服论坛 服务贴,普通区问题处理速度慢,请耐心等待。谢谢您对我们的支持与理解。    


  共有3393人关注过本帖树形打印复制链接

主题:老师,设置为轮询1秒模式,平仓想设为走完1根K线但提前1秒下单?开仓想保持信号出现马上下单。麻烦老师帮下忙!谢了

帅哥哟,离线,有人找我吗?
wenarm
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:管理员 帖子:26631 积分:0 威望:0 精华:7 注册:2015/4/9 14:59:07
  发帖心情 Post By:2017/9/13 11:28:03    Post IP:180.169.30.6[显示全部帖子]

平仓条件中加入abb:=(time0-timetot0(dynainfo(207))<=tq) or not(islastbar); 这个判断、

提前下单的范例代码,tq是提前的时间没

ma5:=ma(c,5);
ma10:=ma(c,10);
input:tq(5,3,60,1);//提前的秒数,最多提前60秒

abb:=(time0-timetot0(dynainfo(207))<=tq) or not(islastbar);

if abb then begin
  if holding>0 and ma5<ma10 then sell(1,1,thisclose);
  if holding<0 and ma5>ma10 then sellshort(1,1,thisclose);
  if holding=0 and ma5>ma10 then buy(1,1,thisclose);
  if holding=0 and ma5<ma10 then buyshort(1,1,thisclose);

end



编程无捷径,技巧靠积累。
 回到顶部
帅哥哟,离线,有人找我吗?
wenarm
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:管理员 帖子:26631 积分:0 威望:0 精华:7 注册:2015/4/9 14:59:07
  发帖心情 Post By:2017/9/13 21:10:31    Post IP:114.84.187.167[显示全部帖子]

不对。
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


编程无捷径,技巧靠积累。
 回到顶部