stringtodouble not work

 

hi guys  i have this  script

//+------------------------------------------------------------------+
//|                                                                  |
//|                                                                  |
//|                                                                  |
//+------------------------------------------------------------------+

#property copyright " "
#property link      " "
#property version   " "
#property strict
#property indicator_chart_window

input color    colorAsk = Lime;
input color    colorBid = Red;
input color    colorNone = White;
input color    colorBack = Black;
input int      rows =80;
input int      columns = 5;
input string   csvName = "200619_MarketData.csv";
input int      corner = 1;
input int      tsX= 200;
input int      tsY= 0;

string sDelta;
string ts = "ts";

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+

//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int OnInit()
  {
//---
//  ObjectCreate(ts+"Label", OBJ_LABEL, 0, 0, 0);
//  ObjectSetText(ts+"Label", "TIME&SALES",14, "Arial Black");
//  ObjectSet(ts+"Label", OBJPROP_COLOR, colorBack);
//  ObjectSet(ts+"Label", OBJPROP_CORNER, corner);
//  ObjectSet(ts+"Label", OBJPROP_XDISTANCE, tsX-45);
//  ObjectSet(ts+"Label", OBJPROP_YDISTANCE, tsY+75);
//  ObjectSet(ts+"Label", OBJPROP_BACK, false);
//  ObjectSet(ts+"Label", OBJPROP_SELECTABLE, false);

   ObjectCreate(ts+"Back", OBJ_RECTANGLE_LABEL, 0, 0, 0);
   ObjectSet(ts+"Back", OBJPROP_BGCOLOR, colorBack);
   ObjectSet(ts+"Back", OBJPROP_CORNER, corner);
   ObjectSet(ts+"Back", OBJPROP_XDISTANCE, tsX-30);
   ObjectSet(ts+"Back", OBJPROP_YDISTANCE, tsY);
   ObjectSet(ts+"Back", OBJPROP_XSIZE, 170);
   ObjectSet(ts+"Back", OBJPROP_YSIZE, 946);
   ObjectSet(ts+"Back", OBJPROP_WIDTH, 1);
   ObjectSet(ts+"Back", OBJPROP_BACK, false);
   ObjectSet(ts+"Back", OBJPROP_SELECTABLE, false);

   return(INIT_SUCCEEDED);
  }

//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
//ObjectsDeleteAll(0, OBJ_LABEL);
//---
   for(int iObj=ObjectsTotal(); iObj >= 0; iObj--)
     {
      string obname = ObjectName(iObj);
      if(StringSubstr(obname,0, 2) == "ts")
         ObjectDelete(obname);
     }
  }

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

   for(int iObj=ObjectsTotal(); iObj >= 0; iObj--)
     {
      string obname = ObjectName(iObj);
      if(StringSubstr(obname,0, 2) == "ts"&&ObjectType(obname)==OBJ_LABEL)
         ObjectDelete(obname);
     }

   int fHandle = FileOpen(csvName, FILE_CSV | FILE_READ | FILE_SHARE_READ);

   if(fHandle < 0)
     {
      Print("ERROR " + IntegerToString(GetLastError()));
     }
   else
     {
      while(!FileIsEnding(fHandle))
        {


         sDelta  = FileReadString(fHandle);
         string sTime  = FileReadString(fHandle);
         string sType  = FileReadString(fHandle);
         string sPrice = FileReadString(fHandle);
         string sVol   = FileReadString(fHandle);


         //    ObjectCreate(ts+"time", OBJ_LABEL, 0, 0, 0);
         //    ObjectSetText(ts+"time", sDelta , 12, "Arial", Black);
         //    ObjectSet(ts+"time", OBJPROP_CORNER, 3);
         //    ObjectSet(ts+"time", OBJPROP_XDISTANCE, 420);
         //    ObjectSet(ts+"time", OBJPROP_YDISTANCE, 150);
        }

      FileClose(fHandle);

     }   //--- return value of prev_calculated for next call


   int last = StringToInteger(sDelta);
   int lastline = last - rows;
//      ObjectCreate(ts+"time2", OBJ_LABEL, 0, 0, 0);
//      ObjectSetText(ts+"time2", IntegerToString(lastline) , 12, "Arial", Black);
//      ObjectSet(ts+"time2", OBJPROP_CORNER, 3);
//      ObjectSet(ts+"time2", OBJPROP_XDISTANCE, 520);
//      ObjectSet(ts+"time2", OBJPROP_YDISTANCE, 150);
//---
   string TS[8735,5];
 
   int handle=FileOpen(csvName,FILE_CSV|FILE_READ,';');

   if(handle<0)
     {
      Print("ERROR " + IntegerToString(GetLastError()));
     }
   else
     {
     while(!FileIsEnding(handle))
        {

         for(int line=0; line<last; line++)
           {
            for(int i=0; i<5; i++)
              {
               TS[line,i]=FileReadString(handle);
              }
            if(StringToInteger(TS[line,0])>lastline)
              {
               ObjectCreate(ts+IntegerToString(line), OBJ_LABEL, 0, 0, 0);
               ObjectSetText(ts+IntegerToString(line), StringSubstr(TS[line,1], 10, 0) +"  "+ TS[line,3] +"  "+ TS[line,4],10, "Courier");
               ObjectSet(ts+IntegerToString(line), OBJPROP_CORNER, corner);
               ObjectSet(ts+IntegerToString(line), OBJPROP_XDISTANCE, tsX-190);
               ObjectSet(ts+IntegerToString(line), OBJPROP_YDISTANCE, tsY+940+(lastline-line)*12);
               if(TS[line,2] == "ASK")
                  ObjectSet(ts+IntegerToString(line), OBJPROP_COLOR, colorAsk);
               else
                  if(TS[line,2] == "BID")
                     ObjectSet(ts+IntegerToString(line), OBJPROP_COLOR, colorBid);
                  else
                     ObjectSet(ts+IntegerToString(line), OBJPROP_COLOR, colorNone);


              }

           }

 
        }

      FileClose(handle);
     }

//--- return value of prev_calculated for next call

   return(rates_total);
  }
//+------------------------------------------------------------------+


in this  part of  code i have   this  array  ObjectSetText(ts+IntegerToString(line), StringSubstr(TS[line,1], 10, 0) +"  "+ TS[line,3] +"  "+ TS[line,4],10, "Courier");

TS[line,3]  inside of them i  have  a  price , i want normilize a double  because in file csv  some time  i have  a price  without a zero after dot 1.5  and i want 1.50000

i create a code like this   normalizedouble (StringoTouble(TS[line,3]),5) , but  not print nothing , how  is possible to do that ?

thankz

 
faustf:

hi guys  i have this  script


in this  part of  code i have   this  array  ObjectSetText(ts+IntegerToString(line), StringSubstr(TS[line,1], 10, 0) +"  "+ TS[line,3] +"  "+ TS[line,4],10, "Courier");

TS[line,3]  inside of them i  have  a  price , i want normilize a double  because in file csv  some time  i have  a price  without a zero after dot 1.5  and i want 1.50000

i create a code like this   normalizedouble (StringoTouble(TS[line,3]),5) , but  not print nothing , how  is possible to do that ?

thankz

show your code with StringToDouble function.

 
//+------------------------------------------------------------------+
//|                                                                  |
//|                                                                  |
//|                                                                  |
//+------------------------------------------------------------------+

#property copyright " "
#property link      " "
#property version   " "
#property strict
#property indicator_chart_window

input color    colorAsk = Lime;
input color    colorBid = Red;
input color    colorNone = White;
input color    colorBack = Black;
input int      rows =80;
input int      columns = 5;
input string   csvName = "200619_MarketData.csv";
input int      corner = 1;
input int      tsX= 200;
input int      tsY= 0;

string sDelta;
string ts = "ts";

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+

//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int OnInit()
  {
//---
//  ObjectCreate(ts+"Label", OBJ_LABEL, 0, 0, 0);
//  ObjectSetText(ts+"Label", "TIME&SALES",14, "Arial Black");
//  ObjectSet(ts+"Label", OBJPROP_COLOR, colorBack);
//  ObjectSet(ts+"Label", OBJPROP_CORNER, corner);
//  ObjectSet(ts+"Label", OBJPROP_XDISTANCE, tsX-45);
//  ObjectSet(ts+"Label", OBJPROP_YDISTANCE, tsY+75);
//  ObjectSet(ts+"Label", OBJPROP_BACK, false);
//  ObjectSet(ts+"Label", OBJPROP_SELECTABLE, false);

   ObjectCreate(ts+"Back", OBJ_RECTANGLE_LABEL, 0, 0, 0);
   ObjectSet(ts+"Back", OBJPROP_BGCOLOR, colorBack);
   ObjectSet(ts+"Back", OBJPROP_CORNER, corner);
   ObjectSet(ts+"Back", OBJPROP_XDISTANCE, tsX-30);
   ObjectSet(ts+"Back", OBJPROP_YDISTANCE, tsY);
   ObjectSet(ts+"Back", OBJPROP_XSIZE, 170);
   ObjectSet(ts+"Back", OBJPROP_YSIZE, 946);
   ObjectSet(ts+"Back", OBJPROP_WIDTH, 1);
   ObjectSet(ts+"Back", OBJPROP_BACK, false);
   ObjectSet(ts+"Back", OBJPROP_SELECTABLE, false);

   return(INIT_SUCCEEDED);
  }

//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
//ObjectsDeleteAll(0, OBJ_LABEL);
//---
   for(int iObj=ObjectsTotal(); iObj >= 0; iObj--)
     {
      string obname = ObjectName(iObj);
      if(StringSubstr(obname,0, 2) == "ts")
         ObjectDelete(obname);
     }
  }

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

   for(int iObj=ObjectsTotal(); iObj >= 0; iObj--)
     {
      string obname = ObjectName(iObj);
      if(StringSubstr(obname,0, 2) == "ts"&&ObjectType(obname)==OBJ_LABEL)
         ObjectDelete(obname);
     }

   int fHandle = FileOpen(csvName, FILE_CSV | FILE_READ | FILE_SHARE_READ);

   if(fHandle < 0)
     {
      Print("ERROR " + IntegerToString(GetLastError()));
     }
   else
     {
      while(!FileIsEnding(fHandle))
        {


         sDelta  = FileReadString(fHandle);
         string sTime  = FileReadString(fHandle);
         string sType  = FileReadString(fHandle);
         string sPrice = FileReadString(fHandle);
         string sVol   = FileReadString(fHandle);


         //    ObjectCreate(ts+"time", OBJ_LABEL, 0, 0, 0);
         //    ObjectSetText(ts+"time", sDelta , 12, "Arial", Black);
         //    ObjectSet(ts+"time", OBJPROP_CORNER, 3);
         //    ObjectSet(ts+"time", OBJPROP_XDISTANCE, 420);
         //    ObjectSet(ts+"time", OBJPROP_YDISTANCE, 150);
        }

      FileClose(fHandle);

     }   //--- return value of prev_calculated for next call


   int last = StringToInteger(sDelta);
   int lastline = last - rows;
//      ObjectCreate(ts+"time2", OBJ_LABEL, 0, 0, 0);
//      ObjectSetText(ts+"time2", IntegerToString(lastline) , 12, "Arial", Black);
//      ObjectSet(ts+"time2", OBJPROP_CORNER, 3);
//      ObjectSet(ts+"time2", OBJPROP_XDISTANCE, 520);
//      ObjectSet(ts+"time2", OBJPROP_YDISTANCE, 150);
//---
   string TS[8735,5];
 
   int handle=FileOpen(csvName,FILE_CSV|FILE_READ,';');

   if(handle<0)
     {
      Print("ERROR " + IntegerToString(GetLastError()));
     }
   else
     {
     while(!FileIsEnding(handle))
        {

         for(int line=0; line<last; line++)
           {
            for(int i=0; i<5; i++)
              {
               TS[line,i]=FileReadString(handle);
              }
            if(StringToInteger(TS[line,0])>lastline)
              {
Pritn("Somthing "+NormalizeDouble( StringToDouble( TS[line,3] ),Digits));
               ObjectCreate(ts+IntegerToString(line), OBJ_LABEL, 0, 0, 0);
               ObjectSetText(ts+IntegerToString(line), StringSubstr(TS[line,1], 10, 0) +"  "+ TS[line,3] +"  "+ TS[line,4],10, "Courier");
               ObjectSet(ts+IntegerToString(line), OBJPROP_CORNER, corner);
               ObjectSet(ts+IntegerToString(line), OBJPROP_XDISTANCE, tsX-190);
               ObjectSet(ts+IntegerToString(line), OBJPROP_YDISTANCE, tsY+940+(lastline-line)*12);
               if(TS[line,2] == "ASK")
                  ObjectSet(ts+IntegerToString(line), OBJPROP_COLOR, colorAsk);
               else
                  if(TS[line,2] == "BID")
                     ObjectSet(ts+IntegerToString(line), OBJPROP_COLOR, colorBid);
                  else
                     ObjectSet(ts+IntegerToString(line), OBJPROP_COLOR, colorNone);


              }

           }

 
        }

      FileClose(handle);
     }

//--- return value of prev_calculated for next call

   return(rates_total);
  }
//+------------------------------------------------------------------+
 

Where is the declaration of the 

Pritn("Somthing "+NormalizeDouble( StringToDouble( TS[line,3] ),Digits));

Pritn function

 
Print
 
someone  have idea ?? thankz at all
Reason: