客服热线:18391752892

请教一下,MACD金叉后怎样回调加仓

   日期:2019-01-12     浏览:42    
马上注册,结交更多好友,下载更多资源

您需要 登录 才可以下载或查看,没有帐号?注册 请教一下,MACD金叉后怎样回调加仓?
 每回调10点加一次仓,最多加10次
 请教一下下面的程序怎样修改才能实现这个功能,谢谢
 
 
 extern double TakeProfit = 50;
 extern double Lots = 0.1;
 extern double TrailingStop = 30;
 extern double MACDOpenLevel=3;
 extern double MACDCloseLevel=2;
 extern double MATrendPeriod=26;
 
 //+------------------------------------------------------------------+
 //|                                             |
 //+------------------------------------------------------------------+
 int start()
    {
   double MacdCurrent, MacdPrevious, SignalCurrent;
   double SignalPrevious, MaCurrent, MaPrevious;
   int cnt, ticket, total;
 // initial data checks
 // it is important to make sure that the expert works with a normal
 // chart and the user did not make any mistakes setting external
 // variables (Lots, StopLoss, TakeProfit,
 // TrailingStop) in our case, we check TakeProfit
 // on a chart of less than 100 bars
   if(Bars(MACDOpenLevel*Point) MaCurrent0)
          {
         if(OrderSelect(ticket,SELECT_BY_TICKET,MODE_TRADES)) Print( SELL order opened : ,OrderOpenPrice());
          }
       else Print( Error opening SELL order : ,GetLastError());
       return(0);
        }
     return(0);
      }
   // it is important to enter the market correctly,
   // but it is more important to exit it correctly...   
   for(cnt=0;cnt(MACDCloseLevel*Point))
             {
              OrderClose(OrderTicket(),OrderLots(),Bid,3,Violet); // close position
              return(0); // exit
             }
         // check for trailing stop
         if(TrailingStop 0) 
            {           
           if(Bid-OrderOpenPrice() Point*TrailingStop)
              {
             if(OrderStopLoss()0) 
            {           
           if((OrderOpenPrice()-Ask) (Point*TrailingStop))
              {
             if((OrderStopLoss() (Ask+Point*TrailingStop)) || (OrderStopLoss()==0))
                {
               OrderModify(OrderTicket(),OrderOpenPrice(),Ask+Point*TrailingStop,OrderTakeProfit(),0,Red);
               return(0);
                }
              }
            }
          }
        }
      }
   return(0);
    }
 // the end.
外汇交易有很大的风险性,本站所有资源均来自网络,请选择使用,如若出现亏损,本站不承担任何责任!


特别提示:本信息由相关企业自行提供,真实性未证实,仅供参考。请谨慎采用,风险自负。


0相关评论
相关行情快递
推荐行情快递
点击排行