|
|
本帖最后由 熙羽 于 2014-7-13 11:29 编辑
可变追踪止损问题已解决!感谢BULL,要的来拿!
首先还是要代表对此程序感兴趣的朋友一起感谢BULL老师给予的无私帮助!
让我们这些不懂编程又想能做个EA的人,有了希望!
不多说了,下面是按照老师提示完成的代码.
- extern int TrailingStop1 = 25;
- extern int TrailingStop2 = 45;
- extern int TrailingStop3 = 15;/////三个追踪止损值
- int a=0,b=0,c=0;///三个全局变量
- ///////////////////////
- if(UseTrailingStop && TrailingStop1 > 0 && TrailingStop2 > 0 && TrailingStop3 > 0 && OrderType()==OP_BUY)
- {
- RefreshRates();
- if((Ask - OrderOpenPrice() > Point * 150) && c==0)
- {
- if(OrderStopLoss() < (Ask - TrailingStop3*Point))
- {
- OrderModify(OrderTicket(), OrderOpenPrice(),Ask-Point*TrailingStop3, OrderTakeProfit(), 0, Red);
- b=1;
- }
-
- }else if((Ask - OrderOpenPrice() > Point * 50) && b==0)
- {
- if(OrderStopLoss() < (Ask - TrailingStop2*Point))
- {
- OrderModify(OrderTicket(), OrderOpenPrice(),Ask-Point*TrailingStop2, OrderTakeProfit(), 0, Red);
- a=1;
- }
-
- }else if((Ask - OrderOpenPrice() > Point * 30) && a==0)
- {
- if(OrderStopLoss() < (Ask - TrailingStop1*Point))
- OrderModify(OrderTicket(), OrderOpenPrice(),Ask-Point*TrailingStop1, OrderTakeProfit(), 0, Red);
- }
- }
- } else {
复制代码 希望朋友们都能互帮互助,共同进步! |
评分
-
查看全部评分
|