客服热线:18391752892

这个是MT4自带的MACd后半部分的源码,烦请老师标注一下上面意思!

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

您需要 登录 才可以下载或查看,没有帐号?注册 // it is important to enter the market correctly,
   // but it is more important to exit it correctly...   
   for(cnt=0;cnt total;cnt++)
   {
     OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);
     if(OrderType() =OP_SELL    // check for opened position
       OrderSymbol()==Symbol()) // check for symbol
     {
       if(OrderType()==OP_BUY)   // long position is opened
       {
         // should it be closed?
         if(MacdCurrent 0 MacdCurrent SignalCurrent MacdPrevious SignalPrevious
           MacdCurrent (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() Bid-Point*TrailingStop)
             {
               OrderModify(OrderTicket(),OrderOpenPrice(),Bid-Point*TrailingStop,OrderTakeProfit(),0,Green);
               return(0);
             }
           }
         }
       }
       else // go to short position
       {
         // should it be closed?
         if(MacdCurrent 0 MacdCurrent SignalCurrent
           MacdPrevious SignalPrevious MathAbs(MacdCurrent) (MACDCloseLevel*Point))
         {
           OrderClose(OrderTicket(),OrderLots(),Ask,3,Violet); // close position
           return(0); // exit
         }
         // check for trailing stop
         if(TrailingStop 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. 老师
if(MacdCurrent 0 MacdCurrent SignalCurrent MacdPrevious SignalPrevious
       MathAbs(MacdCurrent) (MACDOpenLevel*Point) MaCurrent MaPrevious)
上面的“ MathAbs(MacdCurrent) (MACDOpenLevel*Point) ”看不懂上面意思,请老师指教一下,在前面没有“MathAbs”呀,这里突然冒出来。郁闷!

0线下方:MacdCurrent 0
macd指标金叉:MacdCurrent SignalCurrent MacdPrevious SignalPrevious
Diff线向上运行:MaCurrent MaPrevious
extern double MACDOpenLevel=3;
MathAbs(MacdCurrent) (MACDOpenLevel*Point)
由于Diff在0线下方,所以MacdCurrent为负数。因此需要MathAbs()取其绝对值。MACDOpenLevel初始值为3;Point随币种、mt4行情服务器的不同,值各不相同。一般在0.01到0.00001之间。

外汇交易有很大的风险性,本站所有资源均来自网络,请选择使用,如若出现亏损,本站不承担任何责任!


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


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