以文本方式查看主题 - 金字塔客服中心 - 专业程序化交易软件提供商 (http://weistock.com/bbs/index.asp) -- 公式模型编写问题提交 (http://weistock.com/bbs/list.asp?boardid=4) ---- 平仓条件,如果想做止盈止损怎么写? (http://weistock.com/bbs/dispbbs.asp?boardid=4&id=140673) |
-- 作者:zengxing -- 发布时间:2016/10/11 15:30:48 -- 平仓条件,如果想做止盈止损怎么写? 例如,盈利或亏损1.5倍ATR出场。 需要判断先后吗?
|
-- 作者:jinzhe -- 发布时间:2016/10/11 15:32:56 -- atr:=stkindi(\'\',\'atr.atr\',0,datatype);
if openprofit/multipler>1.5*atr then begin sell(1,0,marketr); sellshort(1,0,market); end
if openprofit<0 and abs(openprofit)/multipler>1.5*atr then begin sell(1,0,marketr); sellshort(1,0,market); end |