Download MetaTrader 5
To add comments, please log in or register
Examine the Top MetaTrader 5 signals. Choose the best one and subscribe to it!
Eric
153
Eric 2014.10.22 02:05 
//| Script program start function                                    |
//+------------------------------------------------------------------+
//+------------------------------------------------------------------+
void OnStart()
  {
//---
  long currChart,prevChart=ChartFirst();
   int i=0,limit=100;
   Print("ChartFirst =",ChartSymbol(prevChart)," ID =",prevChart);
   while(i<limit)// We have certainly not more than 100 open charts
     {
      
      currChart=ChartNext(prevChart); // Get the new chart ID by using the previous chart ID
      if(currChart<0) break;          // Have reached the end of the chart list
     
    //  Print(ChartSymbol(currChart),ChartGetInteger(currChart,CHART_COLOR_BACKGROUND));
      if(ChartGetInteger(currChart,CHART_COLOR_BACKGROUND)==255)
       {
        Print("EXCECPTION DETECTED ON : ",ChartSymbol(currChart));
        break;
        
       }
      
      
      prevChart=currChart;// let's save the current chart ID for the ChartNext()
      i++;// Do not forget to increase the counter
     }
   
  } 
  
 
//+------------------------------------------------------------------+

hi,

anyone has an idea why when i drop this script to a chart, it gives me all i want for CFD chart only but ignore all forex chart and i receive this error message in journal

2014.10.21 21:42:06.726 Memory handler: cannot allocate 5610000 bytes of memory

this loop comes from the book of mql help so i thought it would be clean... i only added the part where i check if back ground of chart is red because my ea turn chart background to red when it requires me attention

is it normal that chart id as 18 digits ?!

thanks

Eric
153
Eric 2014.10.22 02:28  

sorry please use this code

fisrt copy paste was wrong, there are many mistake left in first code

but still have same issue with right code...


//+------------------------------------------------------------------+
void OnStart()
  {
//---
  long currChart,prevChart=ChartFirst();
   int i=0,limit=100;
   Print("ChartFirst =",ChartSymbol(prevChart)," ID =",prevChart);
   while(i<limit)// We have certainly not more than 100 open charts
     {
      
      currChart=ChartNext(prevChart); // Get the new chart ID by using the previous chart ID
      if(currChart<0) break;          // Have reached the end of the chart list
        //  Print(ChartSymbol(currChart),ChartGetInteger(currChart,CHART_COLOR_BACKGROUND));
      if(ChartGetInteger(currChart,CHART_COLOR_BACKGROUND)==255)
       {
        Print("EXCECPTION DETECTED ON : ",ChartSymbol(currChart));
        break;
        
       }
      
      
      prevChart=currChart;// let's save the current chart ID for the ChartNext()
      i++;// Do not forget to increase the counter
     }

   
  } 
  
 
//+------------------------------------------------------------------+
Ernst Van Der Merwe
4400
Ernst Van Der Merwe 2014.10.22 06:46  
Gachette:

sorry please use this code

fisrt copy paste was wrong, there are many mistake left in first code

but still have same issue with right code...


I don't think you can run that code in a script. Only expert or indicator.
Eric
153
Eric 2014.10.22 17:15  

pipPod:
I don't think you can run that code in a script. Only expert or indicator.

not sure of that info... it works for CFD chart and some FX to , but not all fx (those at the end of the list)


Eric
153
Eric 2014.10.23 01:56  

solved it myself.. an indicator i download (not from me) and add to charts was pumping all memori i guess because when i removed it from charts everything works just find when i start the script and it does exactly what it is supposed to do


note to myself: never ever add an indicator download from code base to charts without reading and understanding it code completely before, and if not sure just rewrite something similar i understand

/
To add comments, please log in or register