以文本方式查看主题 - 金字塔客服中心 - 专业程序化交易软件提供商 (http://weistock.com/bbs/index.asp) -- 公式模型编写问题提交 (http://weistock.com/bbs/list.asp?boardid=4) ---- 公式测评系统中的部分功能 (http://weistock.com/bbs/dispbbs.asp?boardid=4&id=139260) |
-- 作者:smilingsome -- 发布时间:2016/9/7 11:11:07 -- 公式测评系统中的部分功能 公式测评系统中两项功能: 1. 最大损失:与开仓价相比,损失率达到 8.1% 平仓 100% 2. 回吐止盈:与开仓价相比利润率 10% 后回吐 30% 后止盈 平仓100% 如何用程序实现? [说明:实测时 采用逐K线模式 经常不能及时止盈止损,需要等到刷出下一根K线才开始止盈止损,慢了半拍。]
|
-- 作者:jinzhe -- 发布时间:2016/9/7 11:18:31 -- 程序的话一般是只能实现近似的结果,不能完全实现的
1 if holding>0 and (enterprice-c)/enterprice>=0.08 then sell(1,0,market); if holding<0 and (c-enterprice)/enterprice>0.08 then sellshort(1,0,market); 2 if openprofit>0 and openprofit<=hhv(openprofit,enterbars+1)*0.7 then begin sell(1,0,market); sellshort(1,0,market); end 3 使用固定时间间隔模式,间隔设置为1秒 |