!ind_WSO-WRO-Trend_Line

Author: Copyright ©2004 Modify 13.10.2024 by LeonSi (MT5 Build 3446)
Price Data Components
Series array that contains open time of each bar
0 Views
0 Downloads
0 Favorites
!ind_WSO-WRO-Trend_Line
ÿþ//+------------------------------------------------------------------+

//|                                       Ind-WSO+WRO+Trend Line.mq4 |

//|                      Copyright © 2004 by LeonSi (MT4 Build 1353) |

//|                              http://www.mql5.com/ru/users/leonsi |

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

//--- History Modify

//---

//--- 1.07 / 13.10.2024 (MT5 Build 4620)

//--- >102;5=0 2K1>@:0 1) All variables; 2) only HI/LO 3) only Close

//--- >102;5=0 2K1>@:0 3 bars = 1 Fractal; 5 bars = 1 Fractal; 7 bars = 1 Fractal; 9 bars = 1 Fractal

//--- <5;:89 103 D8:A 8 >?B8<870F8O

//--- 1.06 / 05.06.2024 (MT5 Build 3446)

//--- >102;5= 2K1>@ 20@80=B0 >B@8A>2:8 A ?@82O7:>9 : HILO / Close

//--- input bool inp_HILO_CLOSE = true;  // (true=HI/LOW; false=CLOSE;)

//--- 87<5=8=K F25B0 ;8=89.

//--- 1.05 / 25.04.2024

//--- 7<5=5=0 @0A:@0A:0 ;8=89



#property copyright "Copyright ©2004 Modify 13.10.2024 by LeonSi (MT5 Build 3446)"

#property link      "http://www.mql5.com/ru/users/leonsi"

#property version   "1.07"

#property strict



#property description "The indicator is based on support and resistance points."

#property description "The parameters for determining WSO/WRO points are 9 bars by default"

#property description "(4 on the left | 5 point maximum/minimum HI/LO | 4 on the right)."

#property description "The length of the lines depends on the specified FIBO level. If you"

#property description "want to display multiple FIBO levels, select Do not delete Marker in the"

#property description "settings and change the fibo level."



#property indicator_chart_window

#property indicator_buffers 0

#property indicator_plots   0

//---

double   dFibo[] = {123.6,161.8,261.8,423.6};

bool     flag=true;

datetime last_time=0;

//--- for input menu

enum eHLC

  {

   hlc0 = 0,                                // HI/LO & Close

   hlc1 = 1,                                // HI/LO only

   hlc2 = 2                                 // Close only

  };

//--- for input menu

enum eFibo

  {

   L0 = 0,                                   // level Fibo 123.6

   L1 = 1,                                   // level Fibo 161.8

   L2 = 2,                                   // level Fibo 261.8

   L3 = 3                                    // level Fibo 423.6

  };

//--- for input menu

enum ePeriod

  {

   p0 = 3,                                   // 3 bars = 1 Fractal

   p1 = 5,                                   // 5 bars = 1 Fractal

   p2 = 7,                                   // 7 bars = 1 Fractal

   p3 = 9                                    // 9 bars = 1 Fractal

  };

//---- input parameters

input group    "===== Setting WSO/WRO ======"// ====== ! ======

input eHLC     HLC=hlc0;                     // Varible Drawing

input int      inp_Number_Line =  6;         // Number of lines (WSO, WRO, Trend Line) > 0

input ePeriod  inp_nPeriod = p3;             // Number bars for find point (WSO, WRO)

input eFibo    Fibo = L3;                    // Fibo lenght line

input group    "===== Comment & ID ====="

input bool     ray = false;                  // Drawing Line RAY Right

input bool     Draw_Horlizont_Line = true;   // Drawing Horizont Line (WSO/WRO)?

input bool     Draw_Trend_Line = true;       // Drawing Trend Line (WSO/WRO)?

input bool     Draw_Right_Marker = true;     // Drawing Right Marker?

input bool     bDelete_All_Marker = true;    // Delete All Right Marker if DeInit?

input bool     bDelete_All_Line = true;      // Delete All Line if DeInit?

input string   sID = "WSRT_";                // ID Drawing Object

//----------------------------------------------------------------

input group   "=== Style and Width Line ===" // ====== ! ======

input ENUM_LINE_STYLE sWSOa = STYLE_SOLID;   // Style WSO HI/LO

input int      wWSOa = 1;                    // Width WSO HI/LO

input ENUM_LINE_STYLE sTSOa = STYLE_DASH;    // Style WSO Trend HI/LO

input int      wTSOa = 1;                    // Width WSO Trend HI/LO

input ENUM_LINE_STYLE sWROa = STYLE_SOLID;   // Style WRO HI/LO

input int      wWROa = 1;                    // Width WRO HI/LO

input ENUM_LINE_STYLE sTROa = STYLE_DASH;    // Style WRO Trend HI/LO

input int      wTROa = 1;                    // Width WRO Trend HI/LO

//---

input ENUM_LINE_STYLE sWSOc = STYLE_SOLID;   // Style WSO Close

input int      wWSOc = 2;                    // Width WSO Close

input ENUM_LINE_STYLE sTSOc = STYLE_DOT;     // Style WSO Trend Close

input int      wTSOc = 1;                    // Width WSO Trend Close

input ENUM_LINE_STYLE sWROc = STYLE_SOLID;   // Style WRO Close

input int      wWROc = 2;                    // Width WRO Close

input ENUM_LINE_STYLE sTROc = STYLE_DOT;     // Style WRO Trend Close

input int      wTROc = 1;                    // Width WRO Trend Close

//---

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

//|                                                                  |

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

color cTROa(int i)

  {

   color z[6]= {C'0,255,255',C'0,170,255',C'0,85,255',C'0,0,255',C'0,0,170',C'0,0,85'};

   if(i<6)

      return(z[i]);

   else

      return(clrNavy);

  }

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

//|                                                                  |

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

color cTSOa(int i)

  {

   color z[6]= {C'255,204,153',C'255,153,51',C'255,153,102',C'255,102,51',C'204,102,51',C'153,102,51'};

   if(i<6)

      return(z[i]);

   else

      return(clrMaroon);

  }

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

//| Create OBJ_TREND line                                            |

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

bool Create_OBJ_TREND(const string name,

                      const string Description,

                      const ENUM_OBJECT obj = OBJ_TREND,

                      const datetime t1 = 0,

                      const double p1 = 0,

                      const datetime t2 = 0,

                      const double p2 = 0,

                      const color clr = clrCyan,

                      const int width = 1,

                      const ENUM_LINE_STYLE style = STYLE_SOLID,

                      const bool RAY_RIGHT = false,

                      const bool SELECTABLE = false)

  {

   if(ObjectFind(ChartID(), name) < 0)

      if(!ObjectCreate(ChartID(), name, obj, 0, t1, p1, t2, p2))

        {

         Print(__FUNCTION__, ": =5 C40;>AL A>740BL >1J5:B5! >4 >H81:8 = ",GetLastError());

         return(false);

        }

   ObjectSetInteger(ChartID(),name,OBJPROP_ARROWCODE,251);

   ObjectMove(ChartID(), name, 0, t1, p1);

   ObjectMove(ChartID(), name, 1, t2, p2);

   ObjectSetInteger(ChartID(), name, OBJPROP_COLOR, clr);

   ObjectSetInteger(ChartID(), name, OBJPROP_BACK, true);

   ObjectSetInteger(ChartID(), name, OBJPROP_WIDTH, width);

   ObjectSetInteger(ChartID(), name, OBJPROP_STYLE, style);

   ObjectSetString(ChartID(), name, OBJPROP_TEXT, Description);

   ObjectSetInteger(ChartID(), name, OBJPROP_HIDDEN, false);

   ObjectSetInteger(ChartID(), name, OBJPROP_RAY_RIGHT, RAY_RIGHT);                 //--- RAY_RIGHT

   ObjectSetInteger(ChartID(), name, OBJPROP_SELECTABLE, true);

   return(true);

  }

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

//| Custom indicator initialization function                         |

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

void OnInit()

  {

   flag=true;

   last_time=0;

   return;

  }

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

//| Custor indicator deinitialization function

//| =====

//| int  ObjectsDeleteAll(

//|    long           chart_id,   // 845=B8D8:0B>@ 3@0D8:0

//|    const string     prefix,   // ?@5D8:A 8<5=8 >1J5:B0

//|    int       sub_window=-1,   // 8=45:A >:=0

//|    int      object_type=-1    // B8? >1J5:B0 4;O C40;5=8O

//|    );                       |

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

void OnDeinit(const int reason)

  {

   if(bDelete_All_Line == true)

      ObjectsDeleteAll(ChartID(), sID, -1, OBJ_TREND);

   if(bDelete_All_Marker == true)

     {

      ObjectsDeleteAll(ChartID(), sID, -1, OBJ_ARROW_RIGHT_PRICE);

      ObjectsDeleteAll(ChartID(), sID, -1, OBJ_ARROW);

     }

  }

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

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

  {

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

//| Init Indicator                                                   |

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

   if(last_time>=time[0])

      return(rates_total);

//---

   double r[], s[];

   datetime rt[], st[];

   double rc[], sc[];

   datetime rtc[], stc[];

//---

   ArrayResize(r, inp_Number_Line + 1, 0);

   ArrayResize(s, inp_Number_Line + 1, 0);

   ArrayResize(rt, inp_Number_Line + 1, 0);

   ArrayResize(st, inp_Number_Line + 1, 0);

//---

   ArrayResize(rc, inp_Number_Line + 1, 0);

   ArrayResize(sc, inp_Number_Line + 1, 0);

   ArrayResize(rtc, inp_Number_Line + 1, 0);

   ArrayResize(stc, inp_Number_Line + 1, 0);

//---

   ArrayInitialize(r, 0);

   ArrayInitialize(s, 0);

   ArrayInitialize(rt, 0);

   ArrayInitialize(st, 0);

//---

   ArrayInitialize(rc, 0);

   ArrayInitialize(sc, 0);

   ArrayInitialize(rtc, 0);

   ArrayInitialize(stc, 0);

//---

   ArraySetAsSeries(time,true);

   ArraySetAsSeries(high,true);

   ArraySetAsSeries(low,true);

   ArraySetAsSeries(close,true);

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

   if(iBars(Symbol(), PERIOD_CURRENT) <= inp_nPeriod * inp_Number_Line)

     {

      Comment("!ind_WSO-WRO-Trend_Line: Low bars in chart... exit... Need:"+IntegerToString(inp_nPeriod * inp_Number_Line)+" Bars Total:"+IntegerToString(iBars(_Symbol,_Period)));

      Print("Low bars in chart... exit... Need:",inp_nPeriod * inp_Number_Line," Bars Total:",iBars(Symbol(), PERIOD_CURRENT));

      return(rates_total);

     }

   else

      Comment("");

//---

   if(prev_calculated==0 && flag==false)

      return(rates_total);

//---

   int  s_shift = 0, r_shift = 0, sc_shift = 0, rc_shift = 0;

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

   for(int i = 0; i < rates_total - inp_nPeriod && !_StopFlag; i++)

     {

      //--- Choose Mode: All or_HI/LO; s_shift / r_shift

      if(HLC==0 || HLC==1)

        {

         if(s_shift < inp_Number_Line + 1

            && low[i + (inp_nPeriod - 1) / 2] == low[iLowest(Symbol(), PERIOD_CURRENT, MODE_LOW, inp_nPeriod, i)])

           {

            //--- WSO PRICE

            s[s_shift] = NormalizeDouble(low[i + (inp_nPeriod - 1) / 2], _Digits);

            //--- WSO TIME (shift candle)

            st[s_shift] = time[i + (inp_nPeriod - 1) / 2];

            s_shift++;

           }

         //---

         if(r_shift < inp_Number_Line + 1

            && high[i + (inp_nPeriod - 1) / 2] == high[iHighest(Symbol(), PERIOD_CURRENT, MODE_HIGH, inp_nPeriod, i)])

           {

            //--- WRO PRICE

            r[r_shift] = NormalizeDouble(high[i + (inp_nPeriod - 1) / 2], _Digits);

            //--- WRO TIME (shift candle)

            rt[r_shift] = time[i + (inp_nPeriod - 1) / 2];

            r_shift++;

           }

        }

      //---------------------------------------------------------------

      //--- Choose Mode All or CLOSE;

      if(HLC==0 || HLC==2)

        {

         if(sc_shift < inp_Number_Line + 1

            && close[i + (inp_nPeriod - 1) / 2] == close[iLowest(_Symbol, _Period, MODE_CLOSE, inp_nPeriod, i)])

           {

            //--- WSO PRICE

            sc[sc_shift] = NormalizeDouble(close[i + (inp_nPeriod - 1) / 2], _Digits);

            //--- WSO TIME (shift candle)

            stc[sc_shift] = time[i + (inp_nPeriod - 1) / 2];

            sc_shift++;

           }

         //---

         if(rc_shift < inp_Number_Line + 1

            && close[i + (inp_nPeriod - 1) / 2] == close[iHighest(_Symbol, _Period, MODE_CLOSE, inp_nPeriod, i)])

           {

            //--- WRO PRICE

            rc[rc_shift] = NormalizeDouble(close[i + (inp_nPeriod - 1) / 2], _Digits);

            //--- WRO TIME (shift candle)

            rtc[rc_shift] = time[i + (inp_nPeriod - 1) / 2];

            rc_shift++;

           } // if(r_shift < inp_Number_Line + 1

        } // else

      //---

      if((HLC==0 && s_shift >= inp_Number_Line+1 && r_shift >= inp_Number_Line+1

          && sc_shift >= inp_Number_Line+1 && rc_shift >= inp_Number_Line+1)

         ||

         (HLC==1 && s_shift >= inp_Number_Line+1 && r_shift >= inp_Number_Line+1)

         ||

         (HLC==2 && sc_shift >= inp_Number_Line+1 && rc_shift >= inp_Number_Line+1))

         break;

     } // for(int i = 0; i < rates_total - inp_nPeriod-1 && !_StopFlag; i++)

//---

   if((HLC==0 && (s_shift < inp_Number_Line+1 || r_shift < inp_Number_Line+1

                  || sc_shift < inp_Number_Line+1 || rc_shift < inp_Number_Line+1))

      ||

      (HLC==1 && (s_shift < inp_Number_Line+1 || r_shift < inp_Number_Line+1))

      ||

      (HLC==2 && (sc_shift < inp_Number_Line+1 || rc_shift < inp_Number_Line+1)))

     {

      Comment("!ind_WSO-WRO-Trend_Line: Small bars in chart! Decrease number line in input menu! exit...");

      Print("Small bars in chart! Decrease number line in input menu! exit...");

      return(rates_total);

     }

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

//|  DRAWING Output in Char                                          |

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

//---- Move Object in Chart

   int z=Fibo;

   for(int i = 0; i < inp_Number_Line && !_StopFlag; i++)

     {

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

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

      //| if input chose All or HILO                                       |

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

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

      if(HLC==0 || HLC==1)

        {

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

         double wso_hl_price = NormalizeDouble(Length_Price(s[i], s[i + 1], dFibo[z]), _Digits);

         datetime wso_hl_time = Length_Time(st[i],st[i+1], int(dFibo[z]));

         double wro_hl_price = NormalizeDouble(Length_Price(r[i], r[i + 1], dFibo[z]), _Digits);

         datetime wro_hl_time = Length_Time(rt[i],rt[i+1], int(dFibo[z]));

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

         //--- WSO (HORIZONT)

         if(Draw_Horlizont_Line)

           {

            Create_OBJ_TREND(sID + IntegerToString(inp_nPeriod) + "WSH_" + IntegerToString(i) +"_"+ EnumToString(Period()),

                             "WSO Horizont line: " + IntegerToString(i) +" | "+  EnumToString(Period())

                             + " | Start Point:" + DoubleToString(s[i],_Digits) + " | "

                             + TimeToString(st[i], TIME_DATE|TIME_SECONDS),

                             OBJ_TREND, st[i], s[i], wso_hl_time, s[i], cTSOa(i), wWSOa, sWSOa, ray, false);

           }

         //--- WSO (TREND)

         if(Draw_Trend_Line)

           {

            Create_OBJ_TREND(sID + IntegerToString(inp_nPeriod) + "WST_" + IntegerToString(i) +"_"+ EnumToString(Period()),

                             "WSO Trend line:"+IntegerToString(i) +" | "+ EnumToString(Period())

                             +" | "+ DoubleToString(wso_hl_price, _Digits) +" | "+ TimeToString(wso_hl_time, TIME_DATE|TIME_SECONDS),

                             OBJ_TREND, st[i + 1], s[i + 1], wso_hl_time, wso_hl_price, cTSOa(i), wTSOa, sTSOa, ray, false);

           }

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

         //| Make Metka //--- WSO (MARKER)                                    |

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

         if(Draw_Right_Marker)

           {

            //--- WSO (MARKER)

            Create_OBJ_TREND(sID + IntegerToString(inp_nPeriod) + "WSM_" + IntegerToString(i)+"_"+ EnumToString(Period()),

                             "WSO Marker FIBO: "+DoubleToString(dFibo[z],1)+" | "+EnumToString(Period())

                             +" | "+DoubleToString(wso_hl_price,_Digits) +" | "+ TimeToString(wso_hl_time, TIME_DATE|TIME_SECONDS),

                             OBJ_ARROW_RIGHT_PRICE, wso_hl_time, wso_hl_price, 0, 0, cTSOa(i), 1, 0, false, false);

           }

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

         //--- Draw WRO UP

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

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

         //--- WRO (HORIZONT)

         if(Draw_Horlizont_Line)

           {

            Create_OBJ_TREND(sID + IntegerToString(inp_nPeriod) + "WSR_" + IntegerToString(i) +"_"+ EnumToString(Period()),

                             "WRO Horizont line: " + IntegerToString(i) +" | "+  EnumToString(Period())

                             + " | Start Point:" + DoubleToString(r[i],_Digits) + " | "

                             + TimeToString(rt[i], TIME_DATE|TIME_SECONDS),

                             OBJ_TREND, rt[i], r[i], wro_hl_time, r[i], cTROa(i), wWROa, sWROa, ray, false);

           }

         //--- WRO (TREND)

         if(Draw_Trend_Line)

           {

            Create_OBJ_TREND(sID + IntegerToString(inp_nPeriod) + "WRT_" + IntegerToString(i) +"_"+ EnumToString(Period()),

                             "WRO Trend line:"+IntegerToString(i) +" | "+ EnumToString(Period())

                             +" | "+ DoubleToString(wro_hl_price, _Digits) +" | "+ TimeToString(wro_hl_time, TIME_DATE|TIME_SECONDS),

                             OBJ_TREND, rt[i + 1], r[i + 1], wro_hl_time, wro_hl_price, cTROa(i), wTROa, sTROa, ray, false);

           }

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

         //| Make Metka //--- WRO (MARKER)                                    |

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

         if(Draw_Right_Marker)

           {

            //--- WRO (MARKER)

            Create_OBJ_TREND(sID + IntegerToString(inp_nPeriod) + "WRM_" + IntegerToString(i) +"_"+ EnumToString(Period()),

                             "WRO Marker FIBO: "+DoubleToString(dFibo[z],1)+" | "+EnumToString(Period())

                             +" | "+DoubleToString(wro_hl_price,_Digits) +" | "+ TimeToString(wro_hl_time, TIME_DATE|TIME_SECONDS),

                             OBJ_ARROW_RIGHT_PRICE, wro_hl_time, wro_hl_price, 0, 0, cTROa(i), 1, 0, false, false);

           }

        } //--- if input chose All or HILO

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

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

      //| if input chose All or Close                                      |

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

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

      if(HLC==0 || HLC==2)

        {

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

         double wso_c_price = NormalizeDouble(Length_Price(sc[i], sc[i + 1], dFibo[z]), _Digits);

         datetime wso_c_time = Length_Time(stc[i],stc[i+1], int(dFibo[z]));

         double wro_c_price = NormalizeDouble(Length_Price(rc[i], rc[i + 1], dFibo[z]), _Digits);

         datetime wro_c_time = Length_Time(rtc[i],rtc[i+1], int(dFibo[z]));

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

         //--- WSO (HORIZONT)

         if(Draw_Horlizont_Line)

           {

            Create_OBJ_TREND(sID + IntegerToString(inp_nPeriod) + "WSHc_"+IntegerToString(i) +"_"+ EnumToString(Period()),

                             "WSO Horizont line close: " + IntegerToString(i) +" | "+  EnumToString(Period())

                             + " | Start Point:" + DoubleToString(sc[i],_Digits) + " | "

                             + TimeToString(stc[i], TIME_DATE|TIME_SECONDS),

                             OBJ_TREND, stc[i], sc[i], wso_c_time, sc[i], cTSOa(i), wWSOc, sWSOc, ray, false);

           }

         //--- WSO (TREND)

         if(Draw_Trend_Line)

           {

            Create_OBJ_TREND(sID + IntegerToString(inp_nPeriod) + "WSTc_"+IntegerToString(i) +"_"+ EnumToString(Period()),

                             "WSO Trend line close:"+IntegerToString(i) +" | "+ EnumToString(Period())

                             +" | "+ DoubleToString(wso_c_price, _Digits) +" | "+ TimeToString(wso_c_time, TIME_DATE|TIME_SECONDS),

                             OBJ_TREND, stc[i + 1], sc[i + 1], wso_c_time, wso_c_price, cTSOa(i), wTSOc, sTSOc, ray, false);

           }

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

         //| Make Metka //--- WSO (MARKER)                                    |

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

         if(Draw_Right_Marker)

           {

            //--- WSO (MARKER)

            Create_OBJ_TREND(sID +  IntegerToString(inp_nPeriod) + "WSMc_"+IntegerToString(i)+"_"+ EnumToString(Period()),

                             "WSO Marker FIBO close: "+DoubleToString(dFibo[z],1)+" | "+EnumToString(Period())

                             +" | "+DoubleToString(wso_c_price,_Digits) +" | "+ TimeToString(wso_c_time, TIME_DATE|TIME_SECONDS),

                             OBJ_ARROW_RIGHT_PRICE, wso_c_time, wso_c_price, 0, 0, cTSOa(i), 1, 0, false, false);

           }

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

         //--- Draw WRO UP

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

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

         //--- WRO (HORIZONT)

         if(Draw_Horlizont_Line)

           {

            Create_OBJ_TREND(sID + IntegerToString(inp_nPeriod) + "WSRc_"+IntegerToString(i) +"_"+ EnumToString(Period()),

                             "WRO Horizont line close: " + IntegerToString(i) +" | "+  EnumToString(Period())

                             + " | Start Point:" + DoubleToString(rc[i],_Digits) + " | "

                             + TimeToString(rt[i], TIME_DATE|TIME_SECONDS),

                             OBJ_TREND, rtc[i], rc[i], wro_c_time, rc[i], cTROa(i), wWROc, sWROc, ray, false);

           }

         //--- WRO (TREND)

         if(Draw_Trend_Line)

           {

            Create_OBJ_TREND(sID + IntegerToString(inp_nPeriod) + "WRTc_"+IntegerToString(i) +"_"+ EnumToString(Period()),

                             "WRO Trend line close:"+IntegerToString(i) +" | "+ EnumToString(Period())

                             +" | "+ DoubleToString(wro_c_price, _Digits) +" | "+ TimeToString(wro_c_time, TIME_DATE|TIME_SECONDS),

                             OBJ_TREND, rtc[i + 1], rc[i + 1], wro_c_time, wro_c_price, cTROa(i), wTROc, sTROc, ray, false);

           }

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

         //| Make Metka //--- WRO (MARKER)                                    |

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

         if(Draw_Right_Marker)

           {

            //--- WRO (MARKER)

            Create_OBJ_TREND(sID +  IntegerToString(inp_nPeriod) + "WRMc_"+IntegerToString(i) +"_"+ EnumToString(Period()),

                             "WRO Marker FIBO close: "+DoubleToString(dFibo[z],1)+" | "+EnumToString(Period())

                             +" | "+DoubleToString(wro_c_price,_Digits) +" | "+ TimeToString(wro_c_time, TIME_DATE|TIME_SECONDS),

                             OBJ_ARROW_RIGHT_PRICE, wro_c_time, wro_c_price, 0, 0, cTROa(i), 1, 0, false, false);

           }

        } //--- if input chose All or CLOSE

     } //--- for(int i = 0; i < inp_Number_Line && !_StopFlag; i++)

//---

   ChartRedraw();

   flag=false;

   last_time=time[0];

//---

   return(rates_total);

  }

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

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

//| Lenght fibo price                                                |

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

double Length_Price(double price1, double price2,  double fibo)

  {

   return(NormalizeDouble(price1 + (((price1 - price2) / 100) * fibo), _Digits));

  }

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

//| Calculate lenght line                                            |

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

//| TimeDayOfWeek                                                    |

//| >72@0I05B 45=L =545;8 (0->A:@5A5=L5,1,2,3,4,5,6-!C11>B0)       |

//| 4;O C:070==>9 40BK.                                              |

//| TimeToStruct, MqlDateTime                                        |

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

datetime Length_Time(datetime time1, datetime time2, int fibo)

  {

   datetime range = time1, lens = 0;

//--- I5< ?@>?CI5==K5 10@K <564C 2E B>G5:

   for(datetime i=time2; i<time1; i=i+PeriodSeconds(PERIOD_CURRENT))

      if(iBarShift(Symbol(),PERIOD_CURRENT,i,true) == -1)

         range = range - PeriodSeconds(PERIOD_CURRENT);

//--- 2KG5A;O5< 4;8=C ;8=88 2 datetime

   lens = range + (((range - time2) / 100) * fibo);

//--- 8I5< ?@>?CI5==K5 10@K 4> B5:CI59 40BK

   for(datetime i=time2; i <=lens && i<=TimeCurrent(); i=i+PeriodSeconds(PERIOD_CURRENT))

      if(iBarShift(Symbol(),PERIOD_CURRENT,i,true) == -1)

         lens = lens + PeriodSeconds(PERIOD_CURRENT);

//---

   return(lens);

  }

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

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