以文本方式查看主题

-  金字塔客服中心 - 专业程序化交易软件提供商  (http://weistock.com/bbs/index.asp)
--  公式模型编写问题提交  (http://weistock.com/bbs/list.asp?boardid=4)
----  模型止损止盈用不了  (http://weistock.com/bbs/dispbbs.asp?boardid=4&id=152028)

--  作者:17878758708
--  发布时间:2017/4/21 14:18:42
--  模型止损止盈用不了
OO:VALUEWHEN(DATE<>REF(DATE,1),O);//表示今日第一根K线的开盘价
if C=OO+2 and (TIME>=090000 and TIME<145500) and holding=0 then buy(1,1,marketr);//开多
if C=OO-1 and (TIME>=090000 and TIME<145500) and holding=0 then buyshort(1,1,marketr);//开空
if C=enterprice-8 or C=enterprice+4 then sell(holding>0,holding,marketr) ;//多头止盈止损
if C=enterprice+8 or C=enterprice-4 then  sellshort(holding<0,holding,marketr);//空头止盈止损
if (TIME>=145900 and TIME<200000) or (TIME>=225500) then begin //收盘前全平
sell(holding>0,holding,marketr);
sellshort(holding<0,holding,marketr);
end
 测试
图片点击可在新窗口打开查看此主题相关图片如下:1.png
图片点击可在新窗口打开查看
止损止盈用不了,没有止损止盈是那里代码错误了

--  作者:qq代人发帖
--  发布时间:2017/4/21 14:55:56
--  

正在调试,稍等


--  作者:qq代人发帖
--  发布时间:2017/4/21 15:05:32
--  

起作用了,止盈止损和收盘平仓动作一样是平仓,所以直接从字面上看一样是平仓。

除了收盘前的平仓其他都是止盈止损的平仓


--  作者:17878758708
--  发布时间:2017/4/24 15:43:58
--  
是限价指令一个点不差吗?
--  作者:wenarm
--  发布时间:2017/4/25 8:33:28
--  
限价指令,是优于限定价格成交的