MultiJMACandleTrend_x10

Author: Copyright © 2018, Nikolay Kositsin
0 Views
0 Downloads
0 Favorites
MultiJMACandleTrend_x10
ÿþ//+---------------------------------------------------------------------+

//|                                         MultiJMACandleTrend_x10.mq5 | 

//|                                  Copyright © 2018, Nikolay Kositsin | 

//|                                 Khabarovsk,   farria@mail.redcom.ru | 

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

#property copyright "Copyright © 2018, Nikolay Kositsin"

#property link "farria@mail.redcom.ru"

#property description ""

//--- =><5@ 25@A88 8=48:0B>@0

#property version   "1.61"

//--- >B@8A>2:0 8=48:0B>@0 2 >B45;L=>< >:=5

#property indicator_separate_window

//--- D8:A8@>20==0O 2KA>B0 ?>4>:=0 8=48:0B>@0 2 ?8:A5;OE 

#property indicator_height 150

//--- =86=55 8 25@E=55 >3@0=8G5=8O H:0;K >B45;L=>3> >:=0 8=48:0B>@0

#property indicator_maximum +10.9

#property indicator_minimum +0.3

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

//|  >1JO2;5=85 :>=AB0=B                         |

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

#define RESET 0                                 // >=AB0=B0 4;O 2>72@0B0 B5@<8=0;C :><0=4K =0 ?5@5AG5B 8=48:0B>@0

#define INDTOTAL 10                             // >=AB0=B0 4;O :>;8G5AB20 >B>1@0605<KE 8=48:0B>@>2

#define INDICATOR_NAME "JMACandleTrend_x10"     // >=AB0=B0 4;O 8<5=8 8=48:0B>@0

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

//--- :>;8G5AB2> 8=48:0B>@=KE 1CD5@>2

#property indicator_buffers 40 // INDTOTAL*4

//--- 8A?>;L7>20=> 2A53> 3@0D8G5A:8E ?>AB@>5=89

#property indicator_plots   20 // INDTOTAL*2

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

//|  0@0<5B@K >B@8A>2:8 8=48:0B>@0 1            |

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

//--- >B@8A>2:0 8=48:0B>@0 1 2 2845 ;8=88

#property indicator_type1   DRAW_COLOR_LINE

//--- 2 :0G5AB25 F25B0 ;8=88 8=48:0B>@0 8A?>;L7>20=K

#property indicator_color1 clrDodgerBlue,clrMagenta

//--- ;8=8O 8=48:0B>@0 - HB@8E

#property indicator_style1  STYLE_SOLID

//--- B>;I8=0 ;8=88 8=48:0B>@0 @02=0 3

#property indicator_width1  3

//--- >B>1@065=85 <5B:8 8=48:0B>@0

#property indicator_label1  "Signal line 1"

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

//|  0@0<5B@K >B@8A>2:8 8=48:0B>@0 1            |

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

//--- >B@8A>2:0 8=48:0B>@0 1 2 2845 7=0G:0

#property indicator_type2   DRAW_COLOR_ARROW

//--- 2 :0G5AB25 F25B0 7=0G:0 8A?>;L7>20=

#property indicator_color2 clrDodgerBlue,clrMagenta

//--- B>;I8=0 ;8=88 8=48:0B>@0 @02=0 2

#property indicator_width2  2

//--- >B>1@065=85 <5B:8 8=48:0B>@0

#property indicator_label2  "Signal Arrow 1"

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

//|  0@0<5B@K >B@8A>2:8 8=48:0B>@0 2            |

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

//--- >B@8A>2:0 8=48:0B>@0 3 2 2845 ;8=88

#property indicator_type3   DRAW_COLOR_LINE

//--- 2 :0G5AB25 F25B0 ;8=88 8=48:0B>@0 8A?>;L7>20=K

#property indicator_color3 clrDodgerBlue,clrMagenta

//--- ;8=8O 8=48:0B>@0 - HB@8E

#property indicator_style3  STYLE_SOLID

//--- B>;I8=0 ;8=88 8=48:0B>@0 @02=0 3

#property indicator_width3  3

//--- >B>1@065=85 <5B:8 8=48:0B>@0

#property indicator_label3  "Signal line 2"

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

//|  0@0<5B@K >B@8A>2:8 8=48:0B>@0 2            |

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

//--- >B@8A>2:0 8=48:0B>@0 2 2 2845 7=0G:0

#property indicator_type4   DRAW_COLOR_ARROW

//--- 2 :0G5AB25 F25B0 7=0G:0 8A?>;L7>20=

#property indicator_color4 clrDodgerBlue,clrMagenta

//--- B>;I8=0 ;8=88 8=48:0B>@0 @02=0 2

#property indicator_width4  2

//--- >B>1@065=85 <5B:8 8=48:0B>@0

#property indicator_label4  "Signal Arrow 2"

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

//|  0@0<5B@K >B@8A>2:8 8=48:0B>@0 3            |

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

//--- >B@8A>2:0 8=48:0B>@0 3 2 2845 ;8=88

#property indicator_type5   DRAW_COLOR_LINE

//--- 2 :0G5AB25 F25B0 ;8=88 8=48:0B>@0 8A?>;L7>20=K

#property indicator_color5 clrDodgerBlue,clrMagenta

//--- ;8=8O 8=48:0B>@0 - HB@8E

#property indicator_style5  STYLE_SOLID

//--- B>;I8=0 ;8=88 8=48:0B>@0 @02=0 3

#property indicator_width5  3

//--- >B>1@065=85 <5B:8 8=48:0B>@0

#property indicator_label5  "Signal line 3"

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

//|  0@0<5B@K >B@8A>2:8 8=48:0B>@0 3            |

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

//--- >B@8A>2:0 8=48:0B>@0 3 2 2845 7=0G:0

#property indicator_type6   DRAW_COLOR_ARROW

//--- 2 :0G5AB25 F25B0 7=0G:0 8A?>;L7>20=

#property indicator_color6 clrDodgerBlue,clrMagenta

//--- B>;I8=0 ;8=88 8=48:0B>@0 @02=0 2

#property indicator_width6  2

//--- >B>1@065=85 <5B:8 8=48:0B>@0

#property indicator_label6  "Signal Arrow 3"

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

//|  0@0<5B@K >B@8A>2:8 8=48:0B>@0 4            |

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

//--- >B@8A>2:0 8=48:0B>@0 4 2 2845 ;8=88

#property indicator_type7   DRAW_COLOR_LINE

//--- 2 :0G5AB25 F25B0 ;8=88 8=48:0B>@0 8A?>;L7>20=K

#property indicator_color7 clrDodgerBlue,clrMagenta

//--- ;8=8O 8=48:0B>@0 - HB@8E

#property indicator_style7  STYLE_SOLID

//--- B>;I8=0 ;8=88 8=48:0B>@0 @02=0 3

#property indicator_width7  3

//--- >B>1@065=85 <5B:8 8=48:0B>@0

#property indicator_label7  "Signal line 4"

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

//|  0@0<5B@K >B@8A>2:8 8=48:0B>@0 4            |

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

//--- >B@8A>2:0 8=48:0B>@0 4 2 2845 7=0G:0

#property indicator_type8   DRAW_COLOR_ARROW

//--- 2 :0G5AB25 F25B0 7=0G:0 8A?>;L7>20=

#property indicator_color8 clrDodgerBlue,clrMagenta

//--- B>;I8=0 ;8=88 8=48:0B>@0 @02=0 2

#property indicator_width8  2

//--- >B>1@065=85 <5B:8 8=48:0B>@0

#property indicator_label8  "Signal Arrow 4"

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

//|  0@0<5B@K >B@8A>2:8 8=48:0B>@0 5            |

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

//--- >B@8A>2:0 8=48:0B>@0 5 2 2845 ;8=88

#property indicator_type9   DRAW_COLOR_LINE

//--- 2 :0G5AB25 F25B0 ;8=88 8=48:0B>@0 8A?>;L7>20=K

#property indicator_color9 clrDodgerBlue,clrMagenta

//--- ;8=8O 8=48:0B>@0 - HB@8E

#property indicator_style9  STYLE_SOLID

//--- B>;I8=0 ;8=88 8=48:0B>@0 @02=0 3

#property indicator_width9  3

//--- >B>1@065=85 <5B:8 8=48:0B>@0

#property indicator_label9  "Signal line 5"

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

//|  0@0<5B@K >B@8A>2:8 8=48:0B>@0 5            |

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

//--- >B@8A>2:0 8=48:0B>@0 5 2 2845 7=0G:0

#property indicator_type10   DRAW_COLOR_ARROW

//--- 2 :0G5AB25 F25B0 7=0G:0 8A?>;L7>20=

#property indicator_color10 clrDodgerBlue,clrMagenta

//--- B>;I8=0 ;8=88 8=48:0B>@0 @02=0 2

#property indicator_width10  2

//--- >B>1@065=85 <5B:8 8=48:0B>@0

#property indicator_label10  "Signal Arrow 5"

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

//|  0@0<5B@K >B@8A>2:8 8=48:0B>@0 6            |

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

//--- >B@8A>2:0 8=48:0B>@0 6 2 2845 ;8=88

#property indicator_type11   DRAW_COLOR_LINE

//--- 2 :0G5AB25 F25B0 ;8=88 8=48:0B>@0 8A?>;L7>20=K

#property indicator_color11 clrDodgerBlue,clrMagenta

//--- ;8=8O 8=48:0B>@0 - HB@8E

#property indicator_style11  STYLE_SOLID

//--- B>;I8=0 ;8=88 8=48:0B>@0 @02=0 3

#property indicator_width11  3

//--- >B>1@065=85 <5B:8 8=48:0B>@0

#property indicator_label11  "Signal line 6"

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

//|  0@0<5B@K >B@8A>2:8 8=48:0B>@0 6            |

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

//--- >B@8A>2:0 8=48:0B>@0 6 2 2845 7=0G:0

#property indicator_type12   DRAW_COLOR_ARROW

//--- 2 :0G5AB25 F25B0 7=0G:0 8A?>;L7>20=

#property indicator_color12 clrDodgerBlue,clrMagenta

//--- B>;I8=0 ;8=88 8=48:0B>@0 @02=0 2

#property indicator_width12  2

//--- >B>1@065=85 <5B:8 8=48:0B>@0

#property indicator_label12  "Signal Arrow 6"

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

//|  0@0<5B@K >B@8A>2:8 8=48:0B>@0 7            |

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

//--- >B@8A>2:0 8=48:0B>@0 7 2 2845 ;8=88

#property indicator_type13   DRAW_COLOR_LINE

//--- 2 :0G5AB25 F25B0 ;8=88 8=48:0B>@0 8A?>;L7>20=K

#property indicator_color13 clrDodgerBlue,clrMagenta

//--- ;8=8O 8=48:0B>@0 - HB@8E

#property indicator_style13  STYLE_SOLID

//--- B>;I8=0 ;8=88 8=48:0B>@0 @02=0 3

#property indicator_width13  3

//--- >B>1@065=85 <5B:8 8=48:0B>@0

#property indicator_label13  "Signal line 7"

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

//|  0@0<5B@K >B@8A>2:8 8=48:0B>@0 7            |

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

//--- >B@8A>2:0 8=48:0B>@0 7 2 2845 7=0G:0

#property indicator_type14   DRAW_COLOR_ARROW

//--- 2 :0G5AB25 F25B0 7=0G:0 8A?>;L7>20=

#property indicator_color14 clrDodgerBlue,clrMagenta

//--- B>;I8=0 ;8=88 8=48:0B>@0 @02=0 2

#property indicator_width14  2

//--- >B>1@065=85 <5B:8 8=48:0B>@0

#property indicator_label14  "Signal Arrow 7"

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

//|  0@0<5B@K >B@8A>2:8 8=48:0B>@0 8            |

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

//--- >B@8A>2:0 8=48:0B>@0 8 2 2845 ;8=88

#property indicator_type15   DRAW_COLOR_LINE

//--- 2 :0G5AB25 F25B0 ;8=88 8=48:0B>@0 8A?>;L7>20=K

#property indicator_color15 clrDodgerBlue,clrMagenta

//--- ;8=8O 8=48:0B>@0 - HB@8E

#property indicator_style15  STYLE_SOLID

//--- B>;I8=0 ;8=88 8=48:0B>@0 @02=0 3

#property indicator_width15  3

//--- >B>1@065=85 <5B:8 8=48:0B>@0

#property indicator_label15  "Signal line 8"

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

//|  0@0<5B@K >B@8A>2:8 8=48:0B>@0 8            |

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

//--- >B@8A>2:0 8=48:0B>@0 8 2 2845 7=0G:0

#property indicator_type16   DRAW_COLOR_ARROW

//--- 2 :0G5AB25 F25B0 7=0G:0 8A?>;L7>20=

#property indicator_color16 clrDodgerBlue,clrMagenta

//--- B>;I8=0 ;8=88 8=48:0B>@0 @02=0 2

#property indicator_width16  2

//--- >B>1@065=85 <5B:8 8=48:0B>@0

#property indicator_label16  "Signal Arrow 8"

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

//|  0@0<5B@K >B@8A>2:8 8=48:0B>@0 9            |

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

//--- >B@8A>2:0 8=48:0B>@0 9 2 2845 ;8=88

#property indicator_type17   DRAW_COLOR_LINE

//--- 2 :0G5AB25 F25B0 ;8=88 8=48:0B>@0 8A?>;L7>20=K

#property indicator_color17 clrDodgerBlue,clrMagenta

//--- ;8=8O 8=48:0B>@0 - HB@8E

#property indicator_style17  STYLE_SOLID

//--- B>;I8=0 ;8=88 8=48:0B>@0 @02=0 3

#property indicator_width17  3

//--- >B>1@065=85 <5B:8 8=48:0B>@0

#property indicator_label17  "Signal line 9"

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

//|  0@0<5B@K >B@8A>2:8 8=48:0B>@0 9            |

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

//--- >B@8A>2:0 8=48:0B>@0 9 2 2845 7=0G:0

#property indicator_type18   DRAW_COLOR_ARROW

//--- 2 :0G5AB25 F25B0 7=0G:0 8A?>;L7>20=

#property indicator_color18 clrDodgerBlue,clrMagenta

//--- B>;I8=0 ;8=88 8=48:0B>@0 @02=0 2

#property indicator_width18  2

//--- >B>1@065=85 <5B:8 8=48:0B>@0

#property indicator_label18  "Signal Arrow 9"

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

//|  0@0<5B@K >B@8A>2:8 8=48:0B>@0 10           |

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

//--- >B@8A>2:0 8=48:0B>@0 10 2 2845 ;8=88

#property indicator_type19   DRAW_COLOR_LINE

//--- 2 :0G5AB25 F25B0 ;8=88 8=48:0B>@0 8A?>;L7>20=K

#property indicator_color19 clrDodgerBlue,clrMagenta

//--- ;8=8O 8=48:0B>@0 - HB@8E

#property indicator_style19  STYLE_SOLID

//--- B>;I8=0 ;8=88 8=48:0B>@0 @02=0 3

#property indicator_width19  3

//--- >B>1@065=85 <5B:8 8=48:0B>@0

#property indicator_label19  "Signal line 10"

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

//|  0@0<5B@K >B@8A>2:8 8=48:0B>@0 10           |

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

//--- >B@8A>2:0 8=48:0B>@0 10 2 2845 7=0G:0

#property indicator_type20   DRAW_COLOR_ARROW

//--- 2 :0G5AB25 F25B0 7=0G:0 8A?>;L7>20=

#property indicator_color20 clrDodgerBlue,clrMagenta

//--- B>;I8=0 ;8=88 8=48:0B>@0 @02=0 2

#property indicator_width20  2

//--- >B>1@065=85 <5B:8 8=48:0B>@0

#property indicator_label20  "Signal Arrow 10"

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

//|  >1JO2;5=85 ?5@5G8A;5=89                     |

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

enum Smooth_Method

  {

   MODE_SMA_,  // SMA

   MODE_EMA_,  // EMA

   MODE_SMMA_, // SMMA

   MODE_LWMA_, // LWMA

   MODE_JJMA,  // JJMA

   MODE_JurX,  // JurX

   MODE_ParMA, // ParMA

   MODE_T3,    // T3

   MODE_VIDYA, // VIDYA

   MODE_AMA    // AMA

  };

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

//| E>4=K5 ?0@0<5B@K 8=48:0B>@0                 |

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

input ENUM_TIMEFRAMES TimeFrame0=PERIOD_H1;           //?5@8>4 3@0D8:0 1

input ENUM_TIMEFRAMES TimeFrame1=PERIOD_H2;           //?5@8>4 3@0D8:0 2

input ENUM_TIMEFRAMES TimeFrame2=PERIOD_H3;           //?5@8>4 3@0D8:0 3

input ENUM_TIMEFRAMES TimeFrame3=PERIOD_H4;           //?5@8>4 3@0D8:0 4

input ENUM_TIMEFRAMES TimeFrame4=PERIOD_H6;           //?5@8>4 3@0D8:0 5

input ENUM_TIMEFRAMES TimeFrame5=PERIOD_H8;           //?5@8>4 3@0D8:0 6

input ENUM_TIMEFRAMES TimeFrame6=PERIOD_H12;          //?5@8>4 3@0D8:0 7

input ENUM_TIMEFRAMES TimeFrame7=PERIOD_D1;           //?5@8>4 3@0D8:0 8

input ENUM_TIMEFRAMES TimeFrame8=PERIOD_W1;           //?5@8>4 3@0D8:0 9

input ENUM_TIMEFRAMES TimeFrame9=PERIOD_MN1;          //?5@8>4 3@0D8:0 10

//---- 0@0<5B@K JMACandleTrend

input Smooth_Method MA_Method1=MODE_JJMA;              //<5B>4 CA@54=5=8O

input int Length1=30;                                  //3;C18=0 CA@54=5=8O                    

input int Phase1=15;                                   //?0@0<5B@ CA@54=5=8O,

//---- 4;O JJMA 87<5=ONI89AO 2 ?@545;0E -100 ... +100, 2;8O5B =0 :0G5AB2> ?5@5E>4=>3> ?@>F5AA0;

//---- ;O VIDIA MB> ?5@8>4 CMO, 4;O AMA MB> ?5@8>4 <54;5==>9 A:>;L7OI59

input uint Gap=10;                                     //@07<5@ =5CG8BK205<>3> 3M?0 2 ?C=:B0E

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

//--- >1JO2;5=85 F5;>G8A;5==KE ?5@5<5==KE =0G0;0 >BAG5B0 40==KE

int min_rates_total;

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

//|  >;CG5=85 B09<D@59<0 2 2845 AB@>:8                              |

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

string GetStringTimeframe(ENUM_TIMEFRAMES timeframe)

  {return(StringSubstr(EnumToString(timeframe),7,-1));}

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

//|  ;0AA 8=48:0B>@=KE 1CD5@>2                                      |

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

class CIndBuffers

  {

   //---

public:

   double            m_ArrBuffer[];

   double            m_ColorArrBuffer[];

   double            m_LineBuffer[];

   double            m_ColorLineBuffer[];

   int               m_Handle;

   ENUM_TIMEFRAMES   m_TimeFrame;

   //--- 

  };

//--- >1JO2;5=85 48=0<8G5A:8E <0AA82>2, :>B>@K5 2 40;L=59H5<

//--- 1C4CB 8A?>;L7>20=K 2 :0G5AB25 8=48:0B>@=KE 1CD5@>2

CIndBuffers Ind[INDTOTAL];

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

//| JMACandleTrend_x10 indicator initialization function             | 

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

bool IndInit(uint Number)

  {

//---- >;CG5=85 E5=4;>2 8=48:0B>@>2  JMACandleTrend

   Ind[Number].m_Handle=iCustom(Symbol(),Ind[Number].m_TimeFrame,"JMACandleTrend",MA_Method1,Length1,Phase1,Gap,171,171);



   if(Ind[Number].m_Handle==INVALID_HANDLE)

     {

      Print("IndInit(",Number,"): 5 C40;>AL ?>;CG8BL E5=4; 8=48:0B>@0 JMACandleTrend");

      return(false);

     }

   uint BIndex=Number*4+0;

   uint PIndex=Number*2+0;

   InitTsIndBuffer(BIndex,PIndex,Ind[Number].m_LineBuffer,EMPTY_VALUE,min_rates_total);

   InitTsIndColorBuffer(BIndex+1,Ind[Number].m_ColorLineBuffer,min_rates_total);

   InitTsIndArrBuffer(BIndex+2,PIndex+1,Ind[Number].m_ArrBuffer,EMPTY_VALUE,min_rates_total);

   InitTsIndColorBuffer(BIndex+3,Ind[Number].m_ColorArrBuffer,min_rates_total);

//----   

   string tmf=GetStringTimeframe(Ind[Number].m_TimeFrame);

   PlotIndexSetString(PIndex+0,PLOT_LABEL,INDICATOR_NAME+"("+tmf+")");

   PlotIndexSetString(PIndex+1,PLOT_LABEL,INDICATOR_NAME+"Arr("+tmf+")");

//--- 7025@H5=85 8=8F80;870F88

   return(true);

  }

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

//|  =8F80;870F8O 8=48:0B>@=>3> 1CD5@0 B09<A5@88                    |

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

void InitTsIndBuffer(uint Number,uint Plot,double &IndBuffer[],double Empty_Value,uint Draw_Begin)

  {

//--- ?@52@0I5=85 48=0<8G5A:>3> <0AA820 2 8=48:0B>@=K9 1CD5@

   SetIndexBuffer(Number,IndBuffer,INDICATOR_DATA);

//--- >ACI5AB2;5=85 A42830 =0G0;0 >BAG5B0 >B@8A>2:8 8=48:0B>@0

   PlotIndexSetInteger(Plot,PLOT_DRAW_BEGIN,Draw_Begin);

//--- CAB0=>2:0 7=0G5=89 8=48:0B>@0, :>B>@K5 =5 1C4CB 2848<K =0 3@0D8:5

   PlotIndexSetDouble(Plot,PLOT_EMPTY_VALUE,Empty_Value);

//---- 70?@5B =0 >B>1@065=85 7=0G5=89 8=48:0B>@0 2 ;52>< 25@E=5< C3;C >:=0 8=48:0B>@0

   PlotIndexSetInteger(Plot,PLOT_SHOW_DATA,false);

//--- 8=45:A0F8O M;5<5=B>2 2 1CD5@5 :0: 2 B09<A5@88

   ArraySetAsSeries(IndBuffer,true);

//---

  }

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

//|  =8F80;870F8O 8=48:0B>@=>3> 1CD5@0 B09<A5@88                    |

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

void InitTsIndArrBuffer(uint Number,uint Plot,double &IndBuffer[],double Empty_Value,uint Draw_Begin)

  {

//--- ?@52@0I5=85 48=0<8G5A:>3> <0AA820 2 8=48:0B>@=K9 1CD5@

   SetIndexBuffer(Number,IndBuffer,INDICATOR_DATA);

//--- >ACI5AB2;5=85 A42830 =0G0;0 >BAG5B0 >B@8A>2:8 8=48:0B>@0

   PlotIndexSetInteger(Plot,PLOT_DRAW_BEGIN,Draw_Begin);

//--- CAB0=>2:0 7=0G5=89 8=48:0B>@0, :>B>@K5 =5 1C4CB 2848<K =0 3@0D8:5

   PlotIndexSetDouble(Plot,PLOT_EMPTY_VALUE,Empty_Value);

//--- 2K1>@ A8<2>;0 4;O >B@8A>2:8

   PlotIndexSetInteger(Plot,PLOT_ARROW,172);

//---- 70?@5B =0 >B>1@065=85 7=0G5=89 8=48:0B>@0 2 ;52>< 25@E=5< C3;C >:=0 8=48:0B>@0

   PlotIndexSetInteger(Plot,PLOT_SHOW_DATA,false);

//--- 8=45:A0F8O M;5<5=B>2 2 1CD5@5 :0: 2 B09<A5@88

   ArraySetAsSeries(IndBuffer,true);

//---

  }

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

//|  =8F80;870F8O 8=48:0B>@=>3> 1CD5@0 F25B0 B09<A5@88              |

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

void InitTsIndColorBuffer(uint Number,double &IndColorBuffer[],uint Draw_Begin)

  {

//--- ?@52@0I5=85 48=0<8G5A:>3> <0AA820 2 F25B>2>9 8=45:A=K9 1CD5@   

   SetIndexBuffer(Number,IndColorBuffer,INDICATOR_COLOR_INDEX);

//--- 8=45:A0F8O M;5<5=B>2 2 1CD5@5 :0: 2 B09<A5@88

   ArraySetAsSeries(IndColorBuffer,true);

//---

  }

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

//| IndOnCalculate                                                   | 

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

bool IndOnCalculate(int Number,int Limit,const datetime &Time[],uint Rates_Total,uint Prev_Calculated)

  {

//--- >1JO2;5=85 F5;>G8A;5===KE ?5@5<5==KE

   int limit_;

//--- >1JO2;5=85 ?5@5<5==KE A ?;020NI59 B>G:>9  

   double Main[1];

   datetime Time_[1],Time0;

   static int LastCountBar[INDTOTAL];

//--- @0AG5BK =5>1E>48<>3> :>;8G5AB20 :>?8@C5<KE 40==KE

//--- 8 AB0@B>2>3> =><5@0 limit 4;O F8:;0 ?5@5AG5B0 10@>2

   if(Prev_Calculated>Rates_Total || Prev_Calculated<=0)// ?@>25@:0 =0 ?5@2K9 AB0@B @0AG5B0 8=48:0B>@0

     {

      limit_=Limit;

      LastCountBar[Number]=limit_;

     }

   else limit_=int(MathMin(LastCountBar[Number]+Limit,Rates_Total-2)); // AB0@B>2K9 =><5@ 4;O @0AG5B0 =>2KE 10@>2

//--- >A=>2=>9 F8:; @0AG5B0 8=48:0B>@0

   for(int bar=int(limit_); bar>=0 && !IsStopped(); bar--)

     {

      //--- >1=C;8< A>45@68<>5 8=48:0B>@=KE 1CD5@>2 4> @0AG5B0

      Ind[Number].m_ArrBuffer[bar]=EMPTY_VALUE;

      Ind[Number].m_LineBuffer[bar]=Number+1.0;

      Time0=Time[bar];

      //--- :>?8@C5< 2=>2L ?>O282H85AO 40==K5 2 <0AA82

      if(CopyTime(Symbol(),Ind[Number].m_TimeFrame,Time0,1,Time_)<=0) return(false);



      if(Time0>=Time_[0] && Time[bar+1]<Time_[0])

        {

         LastCountBar[Number]=bar;

         Ind[Number].m_ArrBuffer[bar]=Number+1.0;

         Ind[Number].m_ColorLineBuffer[bar]=2;



         double Up[1],Dn[1];

         //--- :>?8@C5< 2=>2L ?>O282H85AO 40==K5 2 <0AA82K

         if(CopyBuffer(Ind[Number].m_Handle,0,Time0,1,Up)<=0) return(RESET);

         if(CopyBuffer(Ind[Number].m_Handle,1,Time0,1,Dn)<=0) return(RESET);



         if(Up[0])

           {

            Ind[Number].m_ColorLineBuffer[bar]=0;

            Ind[Number].m_ColorArrBuffer[bar]=0;

           }

         if(Dn[0])

           {

            Ind[Number].m_ColorLineBuffer[bar]=1;

            Ind[Number].m_ColorArrBuffer[bar]=1;

           }



         if(!Up[0] && !Dn[0])

           {

            Ind[Number].m_ColorLineBuffer[bar]=Ind[Number].m_ColorLineBuffer[bar+1];

            Ind[Number].m_ColorArrBuffer[bar]=Ind[Number].m_ColorLineBuffer[bar+1];

           }

        }

      else Ind[Number].m_ColorLineBuffer[bar]=Ind[Number].m_ColorLineBuffer[bar+1];

     }

//--- 7025@H5=85 @0AG5B0 >4=>3> 8=48:0B>@0    

   return(true);

  }

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

//| JMACandleTrend_x10 indicator initialization function             | 

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

int OnInit()

  {

//--- 8=8F80;870F8O ?5@5<5==KE =0G0;0 >BAG5B0 40==KE

   min_rates_total=100;

//--- 8=8F80;870F8O ?5@5<5==KE 

   Ind[0].m_TimeFrame=TimeFrame0;

   Ind[1].m_TimeFrame=TimeFrame1;

   Ind[2].m_TimeFrame=TimeFrame2;

   Ind[3].m_TimeFrame=TimeFrame3;

   Ind[4].m_TimeFrame=TimeFrame4;

   Ind[5].m_TimeFrame=TimeFrame5;

   Ind[6].m_TimeFrame=TimeFrame6;

   Ind[7].m_TimeFrame=TimeFrame7;

   Ind[8].m_TimeFrame=TimeFrame8;

   Ind[9].m_TimeFrame=TimeFrame9;

//--- 8=8F80;870F8O 1CD5@>2 8=48:0B>@>2

   for(int count=0; count<INDTOTAL; count++) if(!IndInit(count)) return(INIT_FAILED);

//--- A>740=85 8<5=8 4;O >B>1@065=8O 2 >B45;L=>< ?>4>:=5 8 2> 2A?;K20NI59 ?>4A:07:5

   IndicatorSetString(INDICATOR_SHORTNAME,"MultiJMACandleTrend_x10");

//--- >?@545;5=85 B>G=>AB8 >B>1@065=8O 7=0G5=89 8=48:0B>@0

   IndicatorSetInteger(INDICATOR_DIGITS,0);

//--- 7025@H5=85 8=8F80;870F88

   return(INIT_SUCCEEDED);

  }

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

//| Custom indicator deinitialization function                       |

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

void OnDeinit(const int reason)

  {

//----

   Comment("");

//----   

  }

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

//| JMACandleTrend_x10 iteration function                            | 

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

int OnCalculate(const int rates_total,    // :>;8G5AB2> 8AB>@88 2 10@0E =0 B5:CI5< B8:5

                const int prev_calculated,// :>;8G5AB2> 8AB>@88 2 10@0E =0 ?@54K4CI5< B8:5

                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[])

  {

//--- ?@>25@:0 ?5@8>4>2 3@0D8:>2 =0 :>@@5:B=>ABL

   for(int count=0; count<INDTOTAL; count++) if(!TimeFramesCheck(INDICATOR_NAME,Ind[count].m_TimeFrame)) return(RESET);

//--- ?@>25@:0 :>;8G5AB20 10@>2 =0 4>AB0B>G=>ABL 4;O @0AG5B0

   if(rates_total<min_rates_total) return(RESET);

//--- >1JO2;5=85 F5;>G8A;5==KE ?5@5<5==KE

   int limit;

//--- @0AG5B AB0@B>2>3> =><5@0 limit 4;O F8:;0 ?5@5AG5B0 10@>2

   if(prev_calculated>rates_total || prev_calculated<=0)// ?@>25@:0 =0 ?5@2K9 AB0@B @0AG5B0 8=48:0B>@0

      limit=rates_total-min_rates_total-1; // AB0@B>2K9 =><5@ 4;O @0AG5B0 2A5E 10@>2

   else limit=rates_total-prev_calculated; // AB0@B>2K9 =><5@ 4;O @0AG5B0 =>2KE 10@>2 

//--- 8=45:A0F8O M;5<5=B>2 2 <0AA820E :0: 2 B09<A5@8OE  

   ArraySetAsSeries(time,true);

   for(int count=0; count<INDTOTAL; count++) if(!IndOnCalculate(count,limit,time,rates_total,prev_calculated)) return(RESET);

//---   

   return(rates_total);

  }

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

//| TimeFramesCheck()                                                |

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

bool TimeFramesCheck(string IndName,

                     ENUM_TIMEFRAMES TFrame) // 5@8>4 3@0D8:0 8=48:0B>@0

  {

//--- ?@>25@:0 ?5@8>4>2 3@0D8:>2 =0 :>@@5:B=>ABL

   if(TFrame<Period() && TFrame!=PERIOD_CURRENT)

     {

      Comment("5@8>4 3@0D8:0 4;O 8=48:0B>@0 "+IndName+" =5 <>65B 1KBL <5=LH5 ?5@8>40 B5:CI53> 3@0D8:0! \n !;54C5B 87<5=8BL 2E>4=K5 ?0@0<5B@K 8=48:0B>@0!");

      return(RESET);

     }

//---

   return(true);

  }

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

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 ---