以文本方式查看主题

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

--  作者:jiangsen
--  发布时间:2012/11/2 23:15:48
--  代码编写
这个平仓条件如何写成代码啊?这样就能在图上看出场的箭头指示了
图片点击可在新窗口打开查看此主题相关图片如下:qq截图20121102230843.png
图片点击可在新窗口打开查看

--  作者:RogarZ
--  发布时间:2012/11/3 10:17:29
--  
这个就是移动止损止盈
2.93——交易系统——E 图表交易系统模板
--  作者:jiangsen
--  发布时间:2012/11/3 11:05:10
--  
maxprofit:=0;
win:=0;
win2:=0;
if holding > 0 and enterbars > 0 then
begin
 win:=(c-enterprice)/enterprice*100; //记录最大盈利
 if win > maxprofit then
  maxprofit:=win; 
  
 win2:=(maxprofit-win)/maxprofit*100; //最大盈利后的回调幅度
end
if holding < 0 and enterbars > 0 then
begin
 win:=(enterprice-c)/enterprice*100; //记录最大盈利
 if win > maxprofit then
  maxprofit:=win;
  
 win2:=(maxprofit-win)/maxprofit*100; //最大盈利后的回调幅度
end
//出现浮动亏损比如2%平仓
止损:SELL(win < -2,0);
 
//出现最高盈利后,回落到盈利的60%平仓出场
止赢:SELL(win2 >= 60 and openprofit > 0, 0);


我把这段话加在我系统的最后可是评测结果一点变化也没有啊

--  作者:RogarZ
--  发布时间:2012/11/4 12:23:00
--  

自己理解后用。

具体策略、具体情况、具体分析。

学习中有问题可以来提问。