以文本方式查看主题

-  金字塔客服中心 - 专业程序化交易软件提供商  (http://weistock.com/bbs/index.asp)
--  公式模型编写问题提交  (http://weistock.com/bbs/list.asp?boardid=4)
----  加仓及移动止损要怎么写  (http://weistock.com/bbs/dispbbs.asp?boardid=4&id=63150)

--  作者:allen23
--  发布时间:2014/3/26 12:39:59
--  加仓及移动止损要怎么写
价格大于1200,买入1手,止损1150;
继续上升到1250,加仓买入1手,两手持仓止损1200。
请问要怎么写语句?
谢谢!

--  作者:jinzhe
--  发布时间:2014/3/26 13:12:38
--  

if h>1200 and h<1250 then buy(holding=0,1,thisclose);

if l<1150 and hhv(h,enterbars+1)>1200 and hhv(h,enterbars+1)<1250 then sell(1,0,thisclose);

 

if h>=1250 then buy(holding=1 or holding=0,1,thisclose);

if l<1200 and hhv(h,enterbars+1)>=1250 then sell(1,0,thisclose);