以文本方式查看主题 - 金字塔客服中心 - 专业程序化交易软件提供商 (http://222.73.7.161/bbs/index.asp) -- 公式模型编写问题提交 (http://222.73.7.161/bbs/list.asp?boardid=4) ---- 怎么编写固定止盈止损 (http://222.73.7.161/bbs/dispbbs.asp?boardid=4&id=137399) |
-- 作者:xyy13qq -- 发布时间:2016/8/2 9:56:46 -- 怎么编写固定止盈止损 举例:期货无论什么品种,我都想盈利 30档位止盈,15档位止损,通用的代码怎么编写 做多止盈止损 做空止盈止损 请老师指教!!!!!!!!!!
|
-- 作者:jinzhe -- 发布时间:2016/8/2 10:09:49 -- 多头止损止盈: if holding>0 and c>enterprice+30*mindiff then sell(1,0,market); if holding>0 and c<enterprice-15*mindiff then sell(1,0,market);
空头止损止盈: if holding<0 and c<enterprice-30*mindiff then sellshort(1,0,market); if holding<0 and c>enterprice+15*mindiff then sellshort(1,0,market);
|