Demo separator

Author: Copyright 2021, Alexander MAX
0 Views
0 Downloads
0 Favorites
Demo separator
ÿþ//+------------------------------------------------------------------+

//|                                                      ProjectName |

//|                                      Copyright 2018, CompanyName |

//|                                       http://www.companyname.net |

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

#property copyright  "Copyright 2021, Alexander MAX"

#property link       "https://www.mql5.com/ru/users/alexandermax"

#property version   "1.00"

#property strict

#property indicator_chart_window

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

//| Custom indicator initialization function                         |

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

int OnInit()

  {

//--- indicator buffers mapping



//---

   return(INIT_SUCCEEDED);

  }

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

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

  {



   double any_number = 6546546545.65;

   Print("K2545< G8c;> G5@57 DC=:F8N: "   +Separator(any_number));

   Comment("K2545< G8c;> G5@57 DC=:F8N: " +Separator(any_number));

   return(rates_total);

  }



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

//| Separator                                                        |

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

string Separator(string summa)

  {



   string main;                   // ?5@5<5==0O 3;02=>3> :CA:0

   string ostatok;                // ?5@5<5==0O >AB0B:0

   string output;                 // B> GB> 1C45< 2K2>48BL

   string parts[];                // <0AA82 4;O ?>;CG5=8O AB@>:

   string sep=".";                // @0745;8B5;L 2 2845 A8<2>;0

   ushort u_sep;                  // :>4 A8<2>;0 @0745;8B5;O

   u_sep=StringGetCharacter(sep,0); // ?>;CG8< :>4 @0745;8B5;O



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



   int k = StringSplit(summa,u_sep,parts);// @0745;8< AC<<C B0< 345 B>G:0.

   main    = parts[0]; // <K @0745;8;8 AB@>:C =0 :CA:8 parts[0] MB> >A=>2=>9 :CA>:

   ostatok = parts[1]; // MB> B> GB> ?>A;5 B>G:8

   int len = StringLen(main);// ?>;CG8< :>;8G5AB2> A8<2>;>2 2 AB@>:5 main

   int i = len-1; // 7=0:>2 =0 1 <5=LH5 2 3;02=>9 AB@>:5

//main=54321;





// 70?CAB8< F8:;

   while(i>=0)

     {

      output = CharToString((uchar)StringGetCharacter(main,i))+output; // ?@8102;O5B '' : ?>;CG5=><C A8<2>;C 87 AB@>:8 main



      if((len-i)%3 == 0 && i>0) // @0745;8< ?@>15;>< ?>A;5 :064E 3-E 7=0:>2 2 >1@0B=>< ?>@O4:5

        {

         output = " " + output;

        }

      i--;

     }



   if(k>1) //k= :>;8G5AB2C D@03<5=B>2 (8E 2)

     {

      output = output + "." + ostatok;// A>18@05< AB@>:C 2>548=> output +

     }



   return(output);

  }

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



Comments