MAChannel_Close

Author: Scriptong
Price Data Components
Series array that contains the lowest prices of each barSeries array that contains the highest prices of each barSeries array that contains close prices for each bar
Indicators Used
Moving average indicator
Miscellaneous
It issuies visual alerts to the screen
0 Views
0 Downloads
0 Favorites
MAChannel_Close
ÿþ#property copyright "Scriptong"

#property link      "scriptong@gmail.com"

#property description "English: Horizontal channel, based on extremums between the crossing of the two Moving Averages.\nRussian: >@87>=B0;L=K9 :0=0;, >?8@0NI89AO =0 M:AB@5<C<K <564C ?5@5A5G5=8O<8 42CE A:>;L7OI8E A@54=8E."

#define VERSION "211.017"

#property version  VERSION

#property strict



#property indicator_chart_window

#property indicator_buffers 5

#property indicator_plots   4



//--- plot Label1

#property indicator_type1   DRAW_LINE

#property indicator_color1  clrBlue

#property indicator_style1  STYLE_SOLID

#property indicator_width1  2

//--- plot Label2

#property indicator_type2   DRAW_LINE

#property indicator_color2  clrRed

#property indicator_style2  STYLE_SOLID

#property indicator_width2  2

//--- plot Label3

#property indicator_type3   DRAW_LINE

#property indicator_color3  clrBlue

#property indicator_style3  STYLE_DOT

//--- plot Label4

#property indicator_type4   DRAW_LINE

#property indicator_color4  clrRed

#property indicator_style4  STYLE_DOT



enum ENUM_YESNO

{

   NO,                                                                                             // No / 5B

   YES                                                                                             // Yes / 0

};



input    uint                 i_maFastPeriod             = 1;                                      // Period of fast MA / 5@8>4 @0AG5B0 1KAB@>9 

input    ENUM_MA_METHOD       i_maFastMethod             = MODE_SMA;                               // Method of fast MA / 5B>4 @0AG5B0 1KAB@>9 

input    ENUM_APPLIED_PRICE   i_maFastPrice              = PRICE_WEIGHTED;                         // Applied price of fast MA / &5=0 @0AG5B0 1KAB@>9 

input    uint                 i_maSlowPeriod             = 21;                                     // Period of slow MA / 5@8>4 @0AG5B0 <54;5==>9 

input    ENUM_MA_METHOD       i_maSlowMethod             = MODE_EMA;                               // Method of slow MA / 5B>4 @0AG5B0 <54;5==>9 

input    ENUM_APPLIED_PRICE   i_maSlowPrice              = PRICE_WEIGHTED;                         // Applied price od slow MA / &5=0 @0AG5B0 <54;5==>9 

input    ENUM_YESNO           i_isAlert                  = YES;                                    // Alert on trend change? / !83=0; ?@8 A<5=5 B@5=40?

input    ENUM_YESNO           i_isPush                   = YES;                                    // Notification on trend change? / #254><;OBL ?@8 A<5=5 B@5=40?

input    int                  i_indBarsCount             = 10000;                                  // Number of bars to display / >;-2> 10@>2 >B>1@065=8O



bool     g_bIsActivated;



int      g_nMaxMAPeriod,

         g_nMAFast = INVALID_HANDLE,

         g_nMASlow = INVALID_HANDLE; 



enum ENUM_TREND_TYPE

{

   TREND_TYPE_NONE,

   TREND_TYPE_UPWARD,

   TREND_TYPE_DOWNWARD

};



enum ENUM_MESSAGE_CODE

{

   MESSAGE_CODE_MA_FAST_LESS_THAN_ZERO,

   MESSAGE_CODE_MA_SLOW_LESS_THAN_ZERO,

   MESSAGE_CODE_TREND_CHANGE_TO_UPWARD,

   MESSAGE_CODE_TREND_CHANGE_TO_DOWNWARD,

   MESSAGE_CODE_MA_FAST_CANNOT_CREATE, 

   MESSAGE_CODE_MA_SLOW_CANNOT_CREATE,

   MESSAGE_CODE_BIND_ERROR

};





// 0AA82K 1CD5@>2 =48:0B>@0

double g_highSolid[];                                                                              

double g_lowSolid[];                                                                               

double g_highDot[];                                                                                

double g_lowDot[];                                                                                 

double g_curTrend[];                                                                               



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

//| Custom indicator initialization function                                                                                                                                                          |

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

int OnInit()

{

   g_bIsActivated = false;

   

   if (!TuningParameters())                        

      return INIT_FAILED;                          

       

   if (!BuffersBind())                             

      return INIT_FAILED;                          

                                                   

   g_bIsActivated = true;

   

   return INIT_SUCCEEDED;

}

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

//| Checking the correctness of values of tuning parameters                                                                                                                                           |

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

bool TuningParameters()

{

   string name = MQLInfoString(MQL_PROGRAM_NAME);



   if (i_maFastPeriod < 1)

   {

      Alert(name, GetStringByMessageCode(MESSAGE_CODE_MA_FAST_LESS_THAN_ZERO));

      return false;

   } 

   

   if (i_maSlowPeriod < 1)

   {

      Alert(name, GetStringByMessageCode(MESSAGE_CODE_MA_SLOW_LESS_THAN_ZERO));

      return false;

   } 

   

   g_nMAFast = iMA(NULL, PERIOD_CURRENT, i_maFastPeriod, 0, i_maFastMethod, i_maFastPrice);

   if (g_nMAFast == INVALID_HANDLE)

   {

      Alert(name, GetStringByMessageCode(MESSAGE_CODE_MA_FAST_CANNOT_CREATE));

      return false;

   } 



   g_nMASlow = iMA(NULL, PERIOD_CURRENT, i_maSlowPeriod, 0, i_maSlowMethod, i_maSlowPrice);

   if (g_nMASlow == INVALID_HANDLE)

   {

      Alert(name, GetStringByMessageCode(MESSAGE_CODE_MA_SLOW_CANNOT_CREATE));

      return false;

   } 



   g_nMaxMAPeriod = (int)MathMax(i_maFastPeriod, i_maSlowPeriod);

   

   return true;

}

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

//| Custom indicator deinitialization function                                                                                                                                                        |

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

void OnDeinit(const int reason)

{

   if (g_nMAFast != INVALID_HANDLE)

      IndicatorRelease(g_nMAFast);



   if (g_nMASlow != INVALID_HANDLE)

      IndicatorRelease(g_nMASlow);

}

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

//| Binding of array and the indicator buffers                                                                                                                                                        |

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

bool BuffersBind()

{

   string name = MQLInfoString(MQL_PROGRAM_NAME);

   

   // !2O7K20=85 1CD5@>2 8=48:0B>@0 A <0AA820<8

   if (!SetIndexBuffer(0, g_highSolid)                      ||

       !SetIndexBuffer(1, g_lowSolid)                       ||

       !SetIndexBuffer(2, g_highDot)                        ||

       !SetIndexBuffer(3, g_lowDot)                         ||

       !SetIndexBuffer(4, g_curTrend))

   {

      Alert(name, GetStringByMessageCode(MESSAGE_CODE_BIND_ERROR), GetLastError());

      return false;

   }



   // 040=85 3@0D8G5A:>3> B8?0 1CD5@>2

   for (int i = 0; i < 4; i++)

      PlotIndexSetInteger(i, PLOT_DRAW_TYPE, DRAW_LINE);

      

   PlotIndexSetInteger(4, PLOT_DRAW_TYPE, DRAW_NONE);

      

   ArraySetAsSeries(g_highSolid, true);

   ArraySetAsSeries(g_lowSolid, true);

   ArraySetAsSeries(g_highDot, true);

   ArraySetAsSeries(g_lowDot, true);

   ArraySetAsSeries(g_curTrend, true);



   PlotIndexSetString(0, PLOT_LABEL, "Resistance of downward trend");

   PlotIndexSetString(1, PLOT_LABEL, "Support of upward trend");

   PlotIndexSetString(2, PLOT_LABEL, "Breaking resistance");

   PlotIndexSetString(3, PLOT_LABEL, "Breaking support");

   PlotIndexSetString(4, PLOT_LABEL, "Trend direction");

   

   return true;

}

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

//| Initialize of all indicator buffers                                                                                                                                                               |

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

void BuffersInitializeAll()

{

   ArrayInitialize(g_highSolid, EMPTY_VALUE);  

   ArrayInitialize(g_lowSolid, EMPTY_VALUE);  

   ArrayInitialize(g_highDot, EMPTY_VALUE);  

   ArrayInitialize(g_lowDot, EMPTY_VALUE);  

   ArrayInitialize(g_curTrend, TREND_TYPE_NONE);  

}

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

//| Determination of bar index which needed to recalculate                                                                                                                                            |

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

int GetRecalcIndex(int &total, const int ratesTotal, const int prevCalculated)

{

   total = ratesTotal - g_nMaxMAPeriod - 2;                                                                         

                                                   

   if (i_indBarsCount > 0 && i_indBarsCount < total)

      total = MathMin(i_indBarsCount, total);                      

                                                   

   if (prevCalculated < ratesTotal - 1)                     

   {       

      BuffersInitializeAll();

      return total;

   }

   

   return (MathMin(ratesTotal - prevCalculated, total));                            

}

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

//| The minimal price at the downtrend interval                                                                                                                                                       |

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

double GetLowPrice(int barIndex)

{

   double lowPrice = iLow(NULL, PERIOD_CURRENT, barIndex);

   int nBars = Bars(NULL, PERIOD_CURRENT);

   double arrfMAFast[1], arrfMASlow[1];

   for (int i = barIndex + 1; i < nBars; i++)

   {

      if (CopyBuffer(g_nMAFast, 0, i, 1, arrfMAFast) != 1)

         return -1.0;

      if (CopyBuffer(g_nMASlow, 0, i, 1, arrfMASlow) != 1)

         return -1.0;



      if (arrfMAFast[0] > arrfMASlow[0])

         return lowPrice;

         

      lowPrice = MathMin(lowPrice, iLow(NULL, PERIOD_CURRENT, i));

   }

   

   return lowPrice;

}

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

//|  The maximal price at the downtrend interval                                                                                                                                                      |

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

double GetHighPrice(int barIndex)

{

   double highPrice = iHigh(NULL, PERIOD_CURRENT, barIndex);

   int nBars = Bars(NULL, PERIOD_CURRENT);

   double arrfMAFast[1], arrfMASlow[1];

   for (int i = barIndex + 1; i < nBars; i++)

   {

      if (CopyBuffer(g_nMAFast, 0, i, 1, arrfMAFast) != 1)

         return -1.0;

      if (CopyBuffer(g_nMASlow, 0, i, 1, arrfMASlow) != 1)

         return -1.0;



      if (arrfMAFast[0] < arrfMASlow[0])

         return highPrice;

         

      highPrice = MathMax(highPrice, iHigh(NULL, PERIOD_CURRENT, i));

   }

   

   return highPrice;

}

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

//| The continuity of the indicator buffers values                                                                                                                                                    |

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

void ContinuityBuffers(int barIndex)

{

   if (g_curTrend[barIndex + 1] == TREND_TYPE_UPWARD)

   {

      g_lowDot[barIndex + 1] = EMPTY_VALUE;

      g_highSolid[barIndex + 1] = EMPTY_VALUE;

   }



   if (g_curTrend[barIndex + 1] == TREND_TYPE_DOWNWARD)

   {

      g_highDot[barIndex + 1] = EMPTY_VALUE;

      g_lowSolid[barIndex + 1] = EMPTY_VALUE;

   }



   g_highSolid[barIndex] = g_highSolid[barIndex + 1];

   g_lowSolid[barIndex] = g_lowSolid[barIndex + 1]; 

   g_highDot[barIndex] = g_highDot[barIndex + 1];

   g_lowDot[barIndex] = g_lowDot[barIndex + 1]; 

   g_curTrend[barIndex] = g_curTrend[barIndex + 1];

}

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

//| To process the upward MA cross                                                                                                                                                                    |

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

void ProcessUpwardMACross(int barIndex)

{

   if (g_curTrend[barIndex + 1] == TREND_TYPE_DOWNWARD)

   {

      g_lowDot[barIndex] = GetLowPrice(barIndex);

      g_lowSolid[barIndex] = EMPTY_VALUE;

      if (g_lowDot[barIndex + 1] == EMPTY_VALUE)

         g_lowDot[barIndex + 1] = g_lowDot[barIndex];

         

      return;

   }



   g_lowSolid[barIndex] = GetLowPrice(barIndex);

   g_lowDot[barIndex] = EMPTY_VALUE;

   if (g_lowSolid[barIndex + 1] == EMPTY_VALUE)

      g_lowSolid[barIndex + 1] = g_lowSolid[barIndex];

}

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

//| To process the downward MA cross                                                                                                                                                                  |

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

void ProcessDownwardMACross(int barIndex)

{

   if (g_curTrend[barIndex + 1] == TREND_TYPE_UPWARD)

   {

      g_highDot[barIndex] = GetHighPrice(barIndex);

      g_highSolid[barIndex] = EMPTY_VALUE;

      if (g_highDot[barIndex + 1] == EMPTY_VALUE)

         g_highDot[barIndex + 1] = g_highDot[barIndex];

      return;

   }



   g_highSolid[barIndex] = GetHighPrice(barIndex);

   g_highDot[barIndex] = EMPTY_VALUE;

   if (g_highSolid[barIndex + 1] == EMPTY_VALUE)

      g_highSolid[barIndex + 1] = g_highSolid[barIndex];

      

}

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

//| Cast the timeframe to string value                                                                                                                                                                |

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

string CastTFToString(ENUM_TIMEFRAMES tf)

{



   switch(tf)

   {

      case PERIOD_H1: return "H1";

      case PERIOD_H4: return "H4";

      case PERIOD_D1: return "D1";

      case PERIOD_W1: return "W1";

      case PERIOD_MN1: return "MN1";

   }

   

   return "M" + IntegerToString((int)tf);

}

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

//| To process of breakout of resistance level                                                                                                                                                        |

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

void ProcessResistanceBreak(int barIndex)

{

   g_curTrend[barIndex] = TREND_TYPE_UPWARD;



   g_highDot[barIndex + 1] = g_highSolid[barIndex + 1];

   g_highDot[barIndex] = (g_highSolid[barIndex] == EMPTY_VALUE)? g_highSolid[barIndex + 1] : g_highSolid[barIndex];

   g_highSolid[barIndex] = EMPTY_VALUE;

   

   if (g_lowDot[barIndex + 1] == EMPTY_VALUE)

      return;

      

   g_lowSolid[barIndex + 1] = g_lowDot[barIndex + 1];

   g_lowSolid[barIndex] = (g_lowDot[barIndex] == EMPTY_VALUE)? g_lowDot[barIndex + 1] : g_lowDot[barIndex];

   g_lowDot[barIndex] = EMPTY_VALUE;

}

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

//| To process of breakout of the support level                                                                                                                                                       |

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

void ProcessSupportBreak(int barIndex)

{

   g_curTrend[barIndex] = TREND_TYPE_DOWNWARD;



   g_lowDot[barIndex + 1] = g_lowSolid[barIndex + 1];

   g_lowDot[barIndex] = (g_lowSolid[barIndex] == EMPTY_VALUE)? g_lowSolid[barIndex + 1] : g_lowSolid[barIndex];

   g_lowSolid[barIndex] = EMPTY_VALUE;



   if (g_highDot[barIndex + 1] == EMPTY_VALUE)

      return;



   g_highSolid[barIndex + 1] = g_highDot[barIndex + 1];

   g_highSolid[barIndex] = (g_highDot[barIndex] == EMPTY_VALUE)? g_highDot[barIndex + 1] : g_highDot[barIndex];

   g_highDot[barIndex] = EMPTY_VALUE;   

}

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

//| Calculation of the indicators values at the specified bar                                                                                                                                         |

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

void CalculateOneBarMA(int barIndex)

{

   double arrfMAFast[2], arrfMASlow[2];



   if (CopyBuffer(g_nMAFast, 0, barIndex, 2, arrfMAFast) != 2)

      return;

   if (CopyBuffer(g_nMASlow, 0, barIndex, 2, arrfMASlow) != 2)

      return;



   ContinuityBuffers(barIndex);



   if (arrfMAFast[1] > arrfMASlow[1] && arrfMAFast[0] < arrfMASlow[0])

      ProcessUpwardMACross(barIndex);



   if (arrfMAFast[1] < arrfMASlow[1] && arrfMAFast[0] > arrfMASlow[0])

      ProcessDownwardMACross(barIndex);   

   

   if (g_curTrend[barIndex] != TREND_TYPE_UPWARD && iClose(NULL, PERIOD_CURRENT, barIndex) > g_highSolid[barIndex])

   {

      ProcessResistanceBreak(barIndex);

      return;

   }

   

   if (g_curTrend[barIndex] != TREND_TYPE_DOWNWARD && iClose(NULL, PERIOD_CURRENT, barIndex) < g_lowSolid[barIndex] && g_lowSolid[barIndex] != EMPTY_VALUE)

      ProcessSupportBreak(barIndex);

}

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

//| Alert and notification on trend change                                                                                                                                                            |

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

void SignalOnTrendChange(string text)

{

   static datetime lastSignal = 0;

   if (lastSignal >= iTime(NULL, PERIOD_CURRENT, 0))

      return;

      

   lastSignal = iTime(NULL, PERIOD_CURRENT, 0);

   

   if (i_isAlert)

      Alert(_Symbol, ", ", CastTFToString((ENUM_TIMEFRAMES)_Period), ": ", text);

      

   if (i_isPush)

      SendNotification(_Symbol + ", " + CastTFToString((ENUM_TIMEFRAMES)_Period) + ": " + text);

}

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

//| Calculation of indicators values                                                                                                                                                                  |

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

void CalcIndicatorData(int limit, int total)

{

   for (int i = limit; i >= 0; i--)

      CalculateOneBarMA(i);

      

   if (g_curTrend[1] == TREND_TYPE_UPWARD && g_curTrend[2] != TREND_TYPE_UPWARD)

      SignalOnTrendChange(GetStringByMessageCode(MESSAGE_CODE_TREND_CHANGE_TO_UPWARD));

   

   if (g_curTrend[1] == TREND_TYPE_DOWNWARD && g_curTrend[2] != TREND_TYPE_DOWNWARD)

      SignalOnTrendChange(GetStringByMessageCode(MESSAGE_CODE_TREND_CHANGE_TO_DOWNWARD));

}

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

//| Custom indicator iteration function                                                                                                                                                               |

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

int OnCalculate(const int rates_total,

                const int prev_calculated,

                const datetime& time[],

                const double& open[],

                const double& high[],

                const double& low[],

                const double& close[],

                const long& tick_volume[],

                const long& volume[],

                const int& spread[])

{

   if (!g_bIsActivated || rates_total < g_nMaxMAPeriod)                                                                                

      return rates_total;                                 

    

   int total;   

   int limit = GetRecalcIndex(total, rates_total, prev_calculated);                                



   CalcIndicatorData(limit, total);                                                                

   

   return rates_total;

}

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

//| Getting string by code of message and terminal language                                                                                                                                           |

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

string GetStringByMessageCode(ENUM_MESSAGE_CODE messageCode)

{

   string language = TerminalInfoString(TERMINAL_LANGUAGE);

   if (language == "Russian")

      return GetRussianMessage(messageCode);

      

   return GetEnglishMessage(messageCode);

}

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

//| Getting string by code of message for russian language                                                                                                                                            |

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

string GetRussianMessage(ENUM_MESSAGE_CODE messageCode)

{

   switch (messageCode)

   {

      case MESSAGE_CODE_MA_FAST_LESS_THAN_ZERO:            return ": ?5@8>4 @0AG5B0 1KAB@>3> A@54=53> 4>;65= 1KBL 1>;LH5 =C;O. =48:0B>@ >B:;NG5=.";

      case MESSAGE_CODE_MA_SLOW_LESS_THAN_ZERO:            return ": ?5@8>4 @0AG5B0 <54;5==>3> A@54=53> 4>;65= 1KBL 1>;LH5 =C;O. =48:0B>@ >B:;NG5=.";

      case MESSAGE_CODE_BIND_ERROR:                        return ": >H81:0 A2O7K20=8O <0AA82>2 A 1CD5@0<8 8=48:0B>@0. H81:0 !";

      case MESSAGE_CODE_TREND_CHANGE_TO_UPWARD:            return ": A<5=0 B@5=40. >2K9 B@5=4 - 2>AE>4OI89.";

      case MESSAGE_CODE_TREND_CHANGE_TO_DOWNWARD:          return ": A<5=0 B@5=40. >2K9 B@5=4 - =8AE>4OI89.";

      case MESSAGE_CODE_MA_FAST_CANNOT_CREATE:             return ": >H81:0 A>740=8O 8=48:0B>@0 1KAB@>3> A:>;L7OI53> A@54=53>. =48:0B>@ >B:;NG5=.";

      case MESSAGE_CODE_MA_SLOW_CANNOT_CREATE:             return ": >H81:0 A>740=8O 8=48:0B>@0 <54;5==>3> A:>;L7OI53> A@54=53>. =48:0B>@ >B:;NG5=.";

   }

   

   return "";

}

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

//| Getting string by code of message for english language                                                                                                                                            |

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

string GetEnglishMessage(ENUM_MESSAGE_CODE messageCode)

{

   switch (messageCode)

   {

      case MESSAGE_CODE_MA_FAST_LESS_THAN_ZERO:            return ": calculation period of fast MA must be more than zero. The indicator is turned off.";

      case MESSAGE_CODE_MA_SLOW_LESS_THAN_ZERO:            return ": calculation period of slow MA must be more than zero. The indicator is turned off.";

      case MESSAGE_CODE_BIND_ERROR:                        return ": error of binding of the arrays and the indicator buffers. Error N";

      case MESSAGE_CODE_TREND_CHANGE_TO_UPWARD:            return ": change of trend. The new trend - upward.";

      case MESSAGE_CODE_TREND_CHANGE_TO_DOWNWARD:          return ": change of trend. The new trend - downward.";

      case MESSAGE_CODE_MA_FAST_CANNOT_CREATE:             return ": cannot create fast MA indicator. The indicator is turned off.";

      case MESSAGE_CODE_MA_SLOW_CANNOT_CREATE:             return ": cannot create slow MA indicator. The indicator is turned off.";

   }



   return "";

}

Comments

Markdown supported. Formatting help

Markdown Formatting Guide

Element Markdown Syntax
Heading # H1
## H2
### H3
Bold **bold text**
Italic *italicized text*
Link [title](https://www.example.com)
Image ![alt text](image.jpg)
Code `code`
Code Block ```
code block
```
Quote > blockquote
Unordered List - Item 1
- Item 2
Ordered List 1. First item
2. Second item
Horizontal Rule ---