以文本方式查看主题 - 金字塔客服中心 - 专业程序化交易软件提供商 (http://weistock.com/bbs/index.asp) -- 公式模型编写问题提交 (http://weistock.com/bbs/list.asp?boardid=4) ---- 请教下怎么移动止损? (http://weistock.com/bbs/dispbbs.asp?boardid=4&id=78202) |
-- 作者:onmidas -- 发布时间:2015/5/3 22:40:20 -- 请教下怎么移动止损? 当行情浮盈超过p%时,将止损价移到进场成本价,该如何编写公式? 多谢!
|
-- 作者:jinzhe -- 发布时间:2015/5/4 9:02:14 -- if holding>0 and hhv(h,enterbars+1)-enterprice/enterprice>=p*0.01 and l<=enterprice then sell(1,0,market);//多头 if holding<0 and enterprice-llv(l,enterbars+1)/llv(l,entebars+1)>=p*0.01 and h>=enterprice then sellshort(1,0,market);//空头
以上代码适用于固定轮询模式,如果是走完k线模式则可以把 l<=enterprice 改成c<=enterprice ; 把h>=enterprice 改成c>=enterprice |