以文本方式查看主题 - 金字塔客服中心 - 专业程序化交易软件提供商 (http://weistock.com/bbs/index.asp) -- 公式模型编写问题提交 (http://weistock.com/bbs/list.asp?boardid=4) ---- 怎么以上一个开仓价为基础做反向单。 (http://weistock.com/bbs/dispbbs.asp?boardid=4&id=67878) |
-- 作者:jetzhu -- 发布时间:2014/7/26 15:45:36 -- 怎么以上一个开仓价为基础做反向单。 怎么以上一个开仓价为基础做反向单。平仓后,比如上个开仓是空单,然后平仓后价格大于开仓价,就开仓而且只开一次? |
-- 作者:pyd -- 发布时间:2014/7/26 19:16:43 -- VARIABLE:n:=0; if 开多条件 and n=0 then if 开空条件 and n=0 then if EXITPRICE-ENTERPRICE>0 and n=2 then buy(holding=0,1,market);//n=2判断上次是开空 if enterprice-EXITPRICE>0 and n=1 THEN buyshort(holding=0,1,market);//n=1判断上次是开多 if time=closetime(0) then n:=0; |
-- 作者:jetzhu -- 发布时间:2014/7/26 23:54:34 -- 如果不是每天限一次,而是每次突破失败后只开一次呢? 如果不是每天限一次,而是每次突破失败后只开一次呢?突破失败的定义是比如做多开仓价大于平仓价·· |
-- 作者:jinzhe -- 发布时间:2014/7/28 9:09:50 -- 以下是引用pyd在2014/7/26 19:16:43的发言:
VARIABLE:n:=0; if 开多条件 and n=0 then if 开空条件 and n=0 then if EXITPRICE-ENTERPRICE>0 and n=2 then buy(holding=0,1,market);//n=2判断上次是开空 if enterprice-EXITPRICE>0 and n=1 THEN buyshort(holding=0,1,market);//n=1判断上次是开多 if time=closetime(0) then n:=0; 这里的holidng判断写在和开多开空条件一起判断,不要放在后面 |
-- 作者:jinzhe -- 发布时间:2014/7/28 9:14:32 -- [此贴子已经被作者于2014/7/28 9:15:43编辑过]
|
-- 作者:jinzhe -- 发布时间:2014/7/28 9:23:30 --
VARIABLE:n:=0; if 开多条件 and n=0 and holding=0 then
if 开空条件 and n=0 and holding=0 then nn1:=barslast(开多条件); nn2:=barslast(开空条件); if nn1>nn2 and exitbars>0 and exitprice>enterprice then n:=1; if nn1<nn2 and exitbars>0 and exitprice<enterprice then n:=1; if time=closetime(0) then n:=0; |