Rss & SiteMap

金字塔客服中心 - 专业程序化交易软件提供商 http://www.weistock.com/bbs/

专业程序化软件提供商
共2 条记录, 每页显示 10 条, 页签: [1]
[浏览完整版]

标题:[求助]单次连盈和连亏的函数编写

1楼
modaihuoying 发表于:2015/1/8 10:37:40
我用图标程序化交易,需要获得连续2次盈利后记数为2,连续3次盈利记数为3,后面如果有亏损则清零,再遇到盈利重新记数,请问要怎么编写啊?
2楼
jinzhe 发表于:2015/1/8 10:55:55

variable:n=0,m=0;

if 平多条件 and holding>0 then begin

   sell(1,0,market);

   if numprofit(1)>0 and numprofit(2)>0 then n:=n+1;

   if numprofit(1)<0 and numprofit(2)<0 then m:=m+1;

   if numprofit(1)>=0 and numprofit(2)<=0 then n:=1;

   if numprofit(1)<=0 and numprofit(2)>=0 then m:=1;

end

 

if 平空条件 and holding>0 then begin

   sellshort(1,0,market);

   if numprofit(1)>0 and numprofit(2)>0 then n:=n+1;

   if numprofit(1)<0 and numprofit(2)<0 then m:=m+1;

   if numprofit(1)>=0 and numprofit(2)<=0 then n:=1;

   if numprofit(1)<=0 and numprofit(2)>=0 then m:=1;

end

 

n是连赢次数,m是连亏次数

共2 条记录, 每页显示 10 条, 页签: [1]


Powered By Dvbbs Version 8.3.0
Processed in 0.01563 s, 3 queries.