以文本方式查看主题

-  金字塔客服中心 - 专业程序化交易软件提供商  (http://weistock.com/bbs/index.asp)
--  公式模型编写问题提交  (http://weistock.com/bbs/list.asp?boardid=4)
----  老师帮忙编写一个公式  (http://weistock.com/bbs/dispbbs.asp?boardid=4&id=137204)

--  作者:ed421
--  发布时间:2016/7/28 10:48:58
--  老师帮忙编写一个公式
如果当前价比上一根K线的收盘价大于10,做多
如果当前价比上一根K线的收盘价小于10,做空
开仓后的第五根K线开盘价平仓


--  作者:jinzhe
--  发布时间:2016/7/28 10:51:48
--  

if holding=0 and c>ref(c,1)+10 then buy(1,1,thisclose);

if holding=0 and c<ref(c,1)-10 then buyshort(1,1,thisclose);

if enterbars=5 then begin

   sell(1,0,limitr,o);

   sellshort(1,0,limitr,o);

end


--  作者:ed421
--  发布时间:2016/7/28 11:42:49
--  
当前最新价怎么写呢
--  作者:jinzhe
--  发布时间:2016/7/28 12:55:25
--  
用close,简写为c