V1N1 LONNY 5.12

Author: Copyright © 2016, Vini Oliveira
Profit factor:
0.00
4 Views
0 Downloads
0 Favorites
V1N1 LONNY 5.12
ÿþ//+-----------------------------------------------------------------------------------------------------------------+

//|                                                                                                  V1N1 LONNY.mq4 |

//|                                                                                 Copyright © 2016, Vini Oliveira |

//|                                                                                             vini-fx@hotmail.com |

//+-----------------------------------------------------------------------------------------------------------------+



//=== Program properties

#property copyright   "Copyright © 2016, Vini Oliveira"

#property description "Automated trading system for breakouts in the London and NY sessions."

#property link        "https://www.mql5.com/en/users/vinicius-fx/seller"

#property version     "5.12"

#property strict



//=== Enumerations

enum ENUM_TIME

  {

   H00M00 =     0,   // 00:00

   H01M00 =  3600,   // 01:00

   H02M00 =  7200,   // 02:00

   H03M00 = 10800,   // 03:00

   H04M00 = 14400,   // 04:00

   H05M00 = 18000,   // 05:00

   H06M00 = 21600,   // 06:00

   H07M00 = 25200,   // 07:00

   H08M00 = 28800,   // 08:00

   H09M00 = 32400,   // 09:00

   H10M00 = 36000,   // 10:00

   H11M00 = 39600,   // 11:00

   H12M00 = 43200,   // 12:00

   H13M00 = 46800,   // 13:00

   H14M00 = 50400,   // 14:00

   H15M00 = 54000,   // 15:00

   H16M00 = 57600,   // 16:00

   H17M00 = 61200,   // 17:00

   H18M00 = 64800,   // 18:00

   H19M00 = 68400,   // 19:00

   H20M00 = 72000,   // 20:00

   H21M00 = 75600,   // 21:00

   H22M00 = 79200,   // 22:00

   H23M00 = 82800    // 23:00

  };

enum ENUM_DST

  {

   DstUSA,           // United States (USA)

   DstEuro,          // Europeans Countries

   DstNo             // Not Switch

  };

enum ENUM_RISK

  {

   RiskPerc,         // Percentage

   RiskFixLot        // Fixed Lot

  };



//=== Global input variables

input ENUM_TIME iStartTrade  = H10M00;     // Start Of Trading

input ENUM_TIME iEndTrade    = H22M00;     // End Of Trading

input ENUM_DST  iSwitchDST   = DstEuro;    // Switch To DST - Time Zone

input ENUM_RISK iPosRiskBy   = RiskPerc;   // Set Positions Risk By

input double    iPosRisk     = 1.0;        // Positions Risk

input int       iTradeRange  = 2;          // Trading Range - Bars

input int       iMinRange    = 0;          // Minimum Range - Points

input int       iMaxRange    = 1450;       // Maximum Range - Points

input int       iMinBrkRange = 15;         // Minimum Break Range - Points

input int       iMaxBrkRange = 460;        // Maximum Break Range - Points

input int       iStopLoss    = 750;        // Stop Loss From Range (Points)

input double    iTPfactor    = 1.2;        // Take Profit Factor - Stop Loss

input int       iTrailStop   = 800;        // Trailing Stop - Points (0 = Off)

input int       iTrendPeriod = 248;        // Trend Period - Exponential Averaging

input int       iOverPeriod  = 56;         // Overbought / Oversold Period

input int       iOverLevels  = 25;         // Overbought / Oversold Levels (Max. 25)

input int       iBarsClose   = 120;        // Bars To Close Positions (0 = Off)

input int       iMaxSpread   = 100;        // Maximum Spread - Points (0 = Off)

input int       iSlippage    = 20;         // Maximum Price Slippage - Points



//=== Global internal variables

double   MinBrkRange, MaxBrkRange;

int      MagicNumber;

datetime PrevTime;

string   ErrMsg;

//+-----------------------------------------------------------------------------------------------------------------+

//| Expert initialization function                                                                                  |

//+-----------------------------------------------------------------------------------------------------------------+

int OnInit()

  {

   //--- Checks Opening Of The London Session and End Of Trading

   if(iStartTrade >= iEndTrade)

     {

      Alert(Symbol(), Period(), " - Opening Of The London Session or End Of Trading invalid.");

      Print(Symbol(), Period(), " - Opening Of The London Session or End Of Trading invalid.");

      return(INIT_PARAMETERS_INCORRECT);

     }

   //--- Checks Positions Risk

   if(iPosRisk <= 0.0)

     {

      Alert(Symbol(), Period(), " - Positions Risk is required.");

      Print(Symbol(), Period(), " - Positions Risk is required.");

      return(INIT_PARAMETERS_INCORRECT);

     }

   //--- Checks Trading Range

   if(iTradeRange <= 1)

     {

      Alert(Symbol(), Period(), " - Trading Range invalid.");

      Print(Symbol(), Period(), " - Trading Range invalid.");

      return(INIT_PARAMETERS_INCORRECT);

     }

   //--- Checks Maximum Range

   if(iMaxRange <= 0 || iMaxRange <= iMinRange)

     {

      Alert(Symbol(), Period(), " - Maximum Range invalid.");

      Print(Symbol(), Period(), " - Maximum Range invalid.");

      return(INIT_PARAMETERS_INCORRECT);

     }

   //--- Checks Minimum Break Range

   if(iMinBrkRange <= 0)

     {

      Alert(Symbol(), Period(), " - Minimum Break Range is required.");

      Print(Symbol(), Period(), " - Minimum Break Range is required.");

      return(INIT_PARAMETERS_INCORRECT);

     }

   //--- Checks Maximum Break Range

   if(iMaxBrkRange <= 0)

     {

      Alert(Symbol(), Period(), " - Maximum Break Range is required.");

      Print(Symbol(), Period(), " - Maximum Break Range is required.");

      return(INIT_PARAMETERS_INCORRECT);

     }

   //--- Checks Take Profit Factor

   if(iTPfactor <= 0.0)

     {

      Alert(Symbol(), Period(), " - Take Profit Factor is required.");

      Print(Symbol(), Period(), " - Take Profit Factor is required.");

      return(INIT_PARAMETERS_INCORRECT);

     }

   //--- Checks Trend Period - EMA

   if(iTrendPeriod <= 0)

     {

      Alert(Symbol(), Period(), " - Trend Period (EMA) is required.");

      Print(Symbol(), Period(), " - Trend Period (EMA) is required.");

      return(INIT_PARAMETERS_INCORRECT);

     }

   //--- Checks Overbought / Oversold Period

   if(iOverPeriod <= 0)

     {

      Alert(Symbol(), Period(), " - Overbought / Oversold Period is required.");

      Print(Symbol(), Period(), " - Overbought / Oversold Period is required.");

      return(INIT_PARAMETERS_INCORRECT);

     }

   //--- Checks Overbought / Oversold Levels

   if(iOverLevels > 25)

     {

      Alert(Symbol(), Period(), " - Overbought / Oversold Levels invalid.");

      Print(Symbol(), Period(), " - Overbought / Oversold Levels invalid.");

      return(INIT_PARAMETERS_INCORRECT);

     }



   //--- Initializes variables

   PrevTime    = 0;

   MagicNumber = 11 + Period();

   MinBrkRange = iMinBrkRange * Point;

   MaxBrkRange = iMaxBrkRange * Point;



   return(INIT_SUCCEEDED);

  }

//+-----------------------------------------------------------------------------------------------------------------+

//| Expert deinitialization function                                                                                |

//+-----------------------------------------------------------------------------------------------------------------+

void OnDeinit(const int reason)

  {

   //--- Delete comment

   Comment("");

  }

//+-----------------------------------------------------------------------------------------------------------------+

//| Expert tick function                                                                                            |

//+-----------------------------------------------------------------------------------------------------------------+

void OnTick()

  {

   //--- Local variables

   double   Trail, RangeHigh, RangeLow, RangeSize, MnPrice, MxPrice, EMA1, EMA2, STO1, SL, TP, Lot;

   bool     DstLon, DstNY, BrkRangeUp = false, BrkRangeDn = false;

   int      Cnt, Ticket = -1, DstHr = 0, ShiftStart;

   datetime StartTrade, EndTrade;



   //--- Delete comment

   Comment("");



   //--- Checks if is trade allowed

   if(!IsTradeAllowed())

     {

      Comment("Trade is not allowed...");

      Print  ("Trade is not allowed...");

      return;

     }



   //--- CHECKS IF IS A NEW BAR...

   if(PrevTime != Time[0] && TimeCurrent() < Time[0] + 180)

     {

      //--- Moving Average indicator

      EMA1 = iMA(NULL, PERIOD_CURRENT, iTrendPeriod, 0, MODE_EMA, PRICE_CLOSE, 1);

      EMA2 = iMA(NULL, PERIOD_CURRENT, iTrendPeriod, 0, MODE_EMA, PRICE_CLOSE, 2);

      //--- Stochastic Oscillator indicator

      STO1 = iStochastic(NULL, PERIOD_CURRENT, iOverPeriod, int(MathRound(iOverPeriod * 0.60)), int(MathRound(iOverPeriod * 0.60)), MODE_EMA, STO_CLOSECLOSE, MODE_MAIN, 1);



      //--- Checks open positions

      for(Cnt = OrdersTotal() - 1; Cnt >= 0; Cnt--)

        {

         if(OrderSelect(Cnt, SELECT_BY_POS, MODE_TRADES))

           {

            if(OrderSymbol() == Symbol() && OrderMagicNumber() == MagicNumber)

              {

               if(OrderType() == OP_BUY)

                 {

                  //--- Checks if close positions

                  if(EMA1 < EMA2 || STO1 > 80 || (iBarsClose > 0 && iBarsClose <= int((Time[0] - OrderOpenTime()) / (Period() * 60))))

                    {

                     if(!OrderClose(OrderTicket(), OrderLots(), Bid, iSlippage, clrBlue))

                       {Print(Symbol(), Period(), " - Error ", GetLastError()); return;}

                    }

                  else

                    {

                     Ticket = OrderTicket();

                     //--- Trailing stop

                     Trail = NormalizePrice(Bid - iTrailStop * Point);

                     if(iTrailStop > 0 && OrderOpenPrice() <= Trail && OrderStopLoss() < Trail)

                       {

                        if(!OrderModify(OrderTicket(), OrderOpenPrice(), Trail, OrderTakeProfit(), 0, clrBlue))

                          {Print(Symbol(), " - Error ", GetLastError());}

                       }

                    }

                 }

               else if(OrderType() == OP_SELL)

                 {

                  //--- Checks if close positions

                  if(EMA1 > EMA2 || STO1 < 20 || (iBarsClose > 0 && iBarsClose <= int((Time[0] - OrderOpenTime()) / (Period() * 60))))

                    {

                     if(!OrderClose(OrderTicket(), OrderLots(), Ask, iSlippage, clrRed))

                       {Print(Symbol(), Period(), " - Error ", GetLastError()); return;}

                    }

                  else

                    {

                     Ticket = OrderTicket();

                     //--- Trailing stop

                     Trail = NormalizePrice(Ask + iTrailStop * Point);

                     if(iTrailStop > 0 && ((OrderOpenPrice() >= Trail && OrderStopLoss() > Trail) || OrderStopLoss() == 0.0))

                       {

                        if(!OrderModify(OrderTicket(), OrderOpenPrice(), Trail, OrderTakeProfit(), 0, clrRed))

                          {Print(Symbol(), " - Error ", GetLastError());}

                       }

                    }

                 }

              }

           }

        }



      //--- Checks daylight saving time (DST)

      DstLon = LondonDST();

      DstNY  = NewYorkDST();

      if(iSwitchDST == DstUSA)

        {

         if(!DstLon && DstNY) {DstHr =  3600;}   //--->  3600 sec =  1 hour

         else

         if(DstLon && !DstNY) {DstHr = -3600;}   //---> -3600 sec = -1 hour

        }

      else if(iSwitchDST == DstNo)

        {

         if(DstLon)           {DstHr = -3600;}   //--->  3600 sec =  1 hour

        }



      //--- Calculates trading hours

      StartTrade = StringToTime(TimeToString(TimeCurrent(), TIME_DATE)) + iStartTrade + DstHr;

      EndTrade   = StringToTime(TimeToString(TimeCurrent(), TIME_DATE)) + iEndTrade   + DstHr;



      //--- Checks trading hours

      if(TimeCurrent() < StartTrade || TimeCurrent() >= EndTrade) {PrevTime = Time[0]; return;}



      //--- Calculates trading range

      ShiftStart = iBarShift(NULL, PERIOD_CURRENT, StartTrade, true); if(ShiftStart < 0) {return;}

      RangeHigh  = High[iHighest(NULL, PERIOD_CURRENT, MODE_HIGH, iTradeRange, ShiftStart + 1)];

      RangeLow   = Low [iLowest (NULL, PERIOD_CURRENT, MODE_LOW,  iTradeRange, ShiftStart + 1)];

      RangeSize  = (RangeHigh - RangeLow) / Point;



      //--- Checks break of the trading range - UP

      MxPrice = NormalizeDouble(iClose(NULL, PERIOD_CURRENT, iHighest(NULL, PERIOD_CURRENT, MODE_CLOSE, iTradeRange + ShiftStart - 1, 2)), Digits());

      if(MxPrice >= RangeHigh + MinBrkRange) {BrkRangeUp = true;}



      //--- Checks break of the trading range - DOWN

      MnPrice = NormalizeDouble(iClose(NULL, PERIOD_CURRENT, iLowest (NULL, PERIOD_CURRENT, MODE_CLOSE, iTradeRange + ShiftStart - 1, 2)), Digits());

      if(MnPrice <= RangeLow  - MinBrkRange) {BrkRangeDn = true;}



      //--- Checks conditions to open position

      if(Ticket < 0 && RangeSize >= iMinRange && RangeSize <= iMaxRange)

        {

         //--- Checks bullish signal

         if(EMA1 > EMA2 && STO1 < (50 + iOverLevels) && Open[1] <= RangeHigh && Close[1] >= RangeHigh + MinBrkRange && Close[1] <= RangeHigh + MaxBrkRange && !BrkRangeUp)

           {

            //--- Checks spread

            if(iMaxSpread > 0 && iMaxSpread < MarketInfo(Symbol(), MODE_SPREAD))

              {Print(Symbol(), Period(), " - Spread exceeded."); return;}

            //--- Calculates stop loss, take profit, lot and opens position

            SL  = NormalizePrice(RangeLow - iStopLoss * Point);

            TP  = NormalizePrice(Ask + (Ask - SL) * iTPfactor);

            Lot = CalculateVolume(OP_BUY, SL);

            if(!CheckVolume(Lot))

              {Print(Symbol(), Period(), " - ", ErrMsg);}

            else if(AccountFreeMarginCheck(Symbol(), OP_BUY, Lot) <= 0.0 || _LastError == ERR_NOT_ENOUGH_MONEY)

              {Print(Symbol(), Period(), " - Error ", GetLastError());}

            else if(OrderSend(Symbol(), OP_BUY, Lot, Ask, iSlippage, SL, TP, "V1N1", MagicNumber, 0, clrBlue) == -1)

              {Print(Symbol(), Period(), " - Error ", GetLastError()); return;}

           }



         //--- Checks bearish signal

         else if(EMA1 < EMA2 && STO1 > (50 - iOverLevels) && Open[1] >= RangeLow && Close[1] <= RangeLow - MinBrkRange && Close[1] >= RangeLow - MaxBrkRange && !BrkRangeDn)

           {

            //--- Checks spread

            if(iMaxSpread > 0 && iMaxSpread < MarketInfo(Symbol(), MODE_SPREAD))

              {Print(Symbol(), Period(), " - Spread exceeded."); return;}

            //--- Calculates stop loss, take profit, lot and opens position

            SL  = NormalizePrice(RangeHigh + iStopLoss * Point);

            TP  = NormalizePrice(Bid - (SL - Bid) * iTPfactor);

            Lot = CalculateVolume(OP_SELL, SL);

            if(!CheckVolume(Lot))

              {Print(Symbol(), Period(), " - ", ErrMsg);}

            else if(AccountFreeMarginCheck(Symbol(), OP_SELL, Lot) <= 0.0 || _LastError == ERR_NOT_ENOUGH_MONEY)

              {Print(Symbol(), Period(), " - Error ", GetLastError());}

            else if(OrderSend(Symbol(), OP_SELL, Lot, Bid, iSlippage, SL, TP, "V1N1", MagicNumber, 0, clrRed) == -1)

              {Print(Symbol(), Period(), " - Error ", GetLastError()); return;}

           }

        }

      PrevTime = Time[0];

     }

  }

//+--------------------------------------------------------------------------------------------------------------------+

//| This function normalizes and adjusts the price to the TICK SIZE                                                    |

//+--------------------------------------------------------------------------------------------------------------------+

double NormalizePrice(double Price)

  {

   //--- Get the minimal price change

   double TickSize = SymbolInfoDouble(_Symbol, SYMBOL_TRADE_TICK_SIZE);



   //--- Return the price normalized and adjusted to the TICK SIZE

   if(TickSize == 0.0) {return(NormalizeDouble(Price, _Digits));}

   return(NormalizeDouble(MathRound(Price / TickSize ) * TickSize, _Digits));

  }

//+-----------------------------------------------------------------------------------------------------------------+

//| Calculate volume function                                                                                       |

//+-----------------------------------------------------------------------------------------------------------------+

double CalculateVolume(int OpType, double SL)

  {

   //--- Local variables

   double MinVolume, MaxVolume, TickValue, VolumeStep, Risk, Lot;

   int    nDigits = 2;



   //--- Minimal and Maximal allowed volume for trade operations

   MinVolume = SymbolInfoDouble(Symbol(), SYMBOL_VOLUME_MIN);

   MaxVolume = SymbolInfoDouble(Symbol(), SYMBOL_VOLUME_MAX);



   //--- Checks Set Positions Risk By

   if(iPosRiskBy == RiskFixLot) {return(iPosRisk);}



   //--- Tick Value

   if(OpType == OP_BUY)

     {TickValue = ((Ask - SL) / Point) * MarketInfo(Symbol(), MODE_TICKVALUE);}

   else   //--- OpType == OP_SELL

     {TickValue = ((SL - Bid) / Point) * MarketInfo(Symbol(), MODE_TICKVALUE);}



   if(TickValue == 0.0)

     {return(MinVolume);}



   //--- Get minimal step of volume changing

   VolumeStep = SymbolInfoDouble(Symbol(), SYMBOL_VOLUME_STEP);

   if(VolumeStep == 0.1) {nDigits = 1;}

   else

   if(VolumeStep == 1.0) {nDigits = 0;}



   //--- Volume Size (Risk Percentage)

   Risk = (AccountBalance() + AccountCredit()) * (iPosRisk / 100);

   Lot  =  NormalizeDouble(Risk / TickValue, nDigits);

   if(Lot < MinVolume) {Lot = MinVolume;}

   else

   if(Lot > MaxVolume) {Lot = MaxVolume;}



   return(Lot);

  }

//+-----------------------------------------------------------------------------------------------------------------+

//| Check volume function                                                                                           |

//+-----------------------------------------------------------------------------------------------------------------+

bool CheckVolume(double Lot)

  {

   //--- Minimal allowed volume for trade operations

   double MinVolume = SymbolInfoDouble(Symbol(), SYMBOL_VOLUME_MIN);

   if(Lot < MinVolume)

     {

      ErrMsg = StringConcatenate("Volume less than the minimum allowed. The minimum volume is ", MinVolume, ".");

      return(false);

     }



   //--- Maximal allowed volume of trade operations

   double MaxVolume = SymbolInfoDouble(Symbol(), SYMBOL_VOLUME_MAX);

   if(Lot > MaxVolume)

     {

      ErrMsg = StringConcatenate("Volume greater than the maximum allowed. The maximum volume is ", MaxVolume, ".");

      return(false);

     }



   //--- Get minimal step of volume changing

   double VolumeStep = SymbolInfoDouble(Symbol(), SYMBOL_VOLUME_STEP);



   int Ratio = int(MathRound(Lot / VolumeStep));

   if(MathAbs(Ratio * VolumeStep - Lot) > 0.0000001)

     {

      ErrMsg = StringConcatenate("The volume is not multiple of the minimum gradation ", VolumeStep, ". Volume closest to the valid ", Ratio * VolumeStep, ".");

      return(false);

     }



   //--- Correct volume value

   return(true);

  }

//+-----------------------------------------------------------------------------------------------------------------+

//| Check London daylight saving time (DST) function                                                                |

//+-----------------------------------------------------------------------------------------------------------------+

bool LondonDST()

  {

   //  ------------>>   London DST Start  ------------>>  London DST End

   if((TimeCurrent() >= D'2000.03.26' && TimeCurrent() <  D'2000.10.29')  ||

      (TimeCurrent() >= D'2001.03.25' && TimeCurrent() <  D'2001.10.28')  ||

      (TimeCurrent() >= D'2002.03.31' && TimeCurrent() <  D'2002.10.27')  ||

      (TimeCurrent() >= D'2003.03.30' && TimeCurrent() <  D'2003.10.26')  ||

      (TimeCurrent() >= D'2004.03.28' && TimeCurrent() <  D'2004.10.31')  ||

      (TimeCurrent() >= D'2005.03.27' && TimeCurrent() <  D'2005.10.30')  ||

      (TimeCurrent() >= D'2006.03.26' && TimeCurrent() <  D'2006.10.29')  ||

      (TimeCurrent() >= D'2007.03.25' && TimeCurrent() <  D'2007.10.28')  ||

      (TimeCurrent() >= D'2008.03.30' && TimeCurrent() <  D'2008.10.26')  ||

      (TimeCurrent() >= D'2009.03.29' && TimeCurrent() <  D'2009.10.25')  ||

      (TimeCurrent() >= D'2010.03.28' && TimeCurrent() <  D'2010.10.31')  ||

      (TimeCurrent() >= D'2011.03.27' && TimeCurrent() <  D'2011.10.30')  ||

      (TimeCurrent() >= D'2012.03.25' && TimeCurrent() <  D'2012.10.28')  ||

      (TimeCurrent() >= D'2013.03.31' && TimeCurrent() <  D'2013.10.27')  ||

      (TimeCurrent() >= D'2014.03.30' && TimeCurrent() <  D'2014.10.26')  ||

      (TimeCurrent() >= D'2015.03.29' && TimeCurrent() <  D'2015.10.25')  ||

      (TimeCurrent() >= D'2016.03.27' && TimeCurrent() <  D'2016.10.30')  ||

      (TimeCurrent() >= D'2017.03.26' && TimeCurrent() <  D'2017.10.29')  ||

      (TimeCurrent() >= D'2018.03.25' && TimeCurrent() <  D'2018.10.28')  ||

      (TimeCurrent() >= D'2019.03.31' && TimeCurrent() <  D'2019.10.27')  ||

      (TimeCurrent() >= D'2020.03.29' && TimeCurrent() <  D'2020.10.25')  ||

      (TimeCurrent() >= D'2021.03.28' && TimeCurrent() <  D'2021.10.31')  ||

      (TimeCurrent() >= D'2022.03.27' && TimeCurrent() <  D'2022.10.30')  ||

      (TimeCurrent() >= D'2023.03.26' && TimeCurrent() <  D'2023.10.29')  ||

      (TimeCurrent() >= D'2024.03.31' && TimeCurrent() <  D'2024.10.27')  ||

      (TimeCurrent() >= D'2025.03.30' && TimeCurrent() <  D'2025.10.26')  ||

      (TimeCurrent() >= D'2026.03.29' && TimeCurrent() <  D'2026.10.25')  ||

      (TimeCurrent() >= D'2027.03.28' && TimeCurrent() <  D'2027.10.31')  ||

      (TimeCurrent() >= D'2028.03.26' && TimeCurrent() <  D'2028.10.29')  ||

      (TimeCurrent() >= D'2029.03.25' && TimeCurrent() <  D'2029.10.28'))



      {return(true);}



   return(false);

  }

//+-----------------------------------------------------------------------------------------------------------------+

//| Check New York daylight saving time (DST) function                                                              |

//+-----------------------------------------------------------------------------------------------------------------+

bool NewYorkDST()

  {

   //  ------------>>   NY DST Start   ------------->>   NY DST End

   if((TimeCurrent() >= D'2000.04.02' && TimeCurrent() < D'2000.10.29')  ||

      (TimeCurrent() >= D'2001.04.01' && TimeCurrent() < D'2001.10.28')  ||

      (TimeCurrent() >= D'2002.04.07' && TimeCurrent() < D'2002.10.27')  ||

      (TimeCurrent() >= D'2003.04.06' && TimeCurrent() < D'2003.10.26')  ||

      (TimeCurrent() >= D'2004.04.04' && TimeCurrent() < D'2004.10.31')  ||

      (TimeCurrent() >= D'2005.04.03' && TimeCurrent() < D'2005.10.30')  ||

      (TimeCurrent() >= D'2006.04.02' && TimeCurrent() < D'2006.10.29')  ||

      (TimeCurrent() >= D'2007.03.11' && TimeCurrent() < D'2007.11.04')  ||

      (TimeCurrent() >= D'2008.03.09' && TimeCurrent() < D'2008.11.02')  ||

      (TimeCurrent() >= D'2009.03.08' && TimeCurrent() < D'2009.11.01')  ||

      (TimeCurrent() >= D'2010.03.14' && TimeCurrent() < D'2010.11.07')  ||

      (TimeCurrent() >= D'2011.03.13' && TimeCurrent() < D'2011.11.06')  ||

      (TimeCurrent() >= D'2012.03.11' && TimeCurrent() < D'2012.11.04')  ||

      (TimeCurrent() >= D'2013.03.10' && TimeCurrent() < D'2013.11.03')  ||

      (TimeCurrent() >= D'2014.03.09' && TimeCurrent() < D'2014.11.02')  ||

      (TimeCurrent() >= D'2015.03.08' && TimeCurrent() < D'2015.11.01')  ||

      (TimeCurrent() >= D'2016.03.13' && TimeCurrent() < D'2016.11.06')  ||

      (TimeCurrent() >= D'2017.03.12' && TimeCurrent() < D'2017.11.05')  ||

      (TimeCurrent() >= D'2018.03.11' && TimeCurrent() < D'2018.11.04')  ||

      (TimeCurrent() >= D'2019.03.10' && TimeCurrent() < D'2019.11.03')  ||

      (TimeCurrent() >= D'2020.03.08' && TimeCurrent() < D'2020.11.01')  ||

      (TimeCurrent() >= D'2021.03.14' && TimeCurrent() < D'2021.11.07')  ||

      (TimeCurrent() >= D'2022.03.13' && TimeCurrent() < D'2022.11.06')  ||

      (TimeCurrent() >= D'2023.03.12' && TimeCurrent() < D'2023.11.05')  ||

      (TimeCurrent() >= D'2024.03.10' && TimeCurrent() < D'2024.11.03')  ||

      (TimeCurrent() >= D'2025.03.09' && TimeCurrent() < D'2025.11.02')  ||

      (TimeCurrent() >= D'2026.03.08' && TimeCurrent() < D'2026.11.01')  ||

      (TimeCurrent() >= D'2027.03.14' && TimeCurrent() < D'2027.11.07')  ||

      (TimeCurrent() >= D'2028.03.12' && TimeCurrent() < D'2028.11.05')  ||

      (TimeCurrent() >= D'2029.03.11' && TimeCurrent() < D'2029.11.04'))



      {return(true);}



   return(false);

  }

//+-----------------------------------------------------------------------------------------------------------------+

//| Expert End                                                                                                      |

//+-----------------------------------------------------------------------------------------------------------------+  

Comments