2147483647 MQL4 indicator code issue

 

Hi all


I have modified the below MQL4 code so I could transfer values from MT4 indicators to excel and I am struggling to obtain values from this indicator Casino_HAS_PIN_v3 which I have attached because it keeps putting 2147483647 in all the cells.


I would be grateful if anyone could please help me resolve this issue


//+------------------------------------------------------------------+
//|                                             Indicator_to_CSV.mq4 |
//|                                                                  |
//|                                                                  |
//+------------------------------------------------------------------+
#property copyright "Inovance"
#property link      "https://www.inovancetech.com/"
#property description "Save indicator values and OHLC data to a csv file."
#property version   "1.00"
#property strict
#property indicator_chart_window
#property indicator_buffers 3
#property indicator_color1 Black
#property indicator_color2 Black

   //Indicator periods


   //Filename
input string   FileName = "CCIRSIdata.csv";
input int Limit_candles = 50;

   //Indicator Buffers
double StochasticBuffer[];
double Casino_HAS_PIN_v3rBuffer[];




//+------------------------------------------------------------------+
//| Initialization function                                          |
//+------------------------------------------------------------------+
int OnInit()
  {
      //Indicator buffers mapping
   SetIndexBuffer(0,StochasticBuffer);   
   SetIndexBuffer(1,Casino_HAS_PIN_v3rBuffer);   
   
      //Indicator styling
    SetIndexStyle(0,DRAW_LINE);  
    SetIndexStyle(1,DRAW_LINE);  
   
//---
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
      //Define variables
      int limit,i;
      int counted_bars = IndicatorCounted();
      
      //Make sure on most recent bar
      if(counted_bars>0) counted_bars--;
   
      //Set limit
      limit = Limit_candles;
      
      
      //Main loop
      for(i = limit - 1; i>=0; i--) 
         { 
         
         
       
            //Indicators
            StochasticBuffer[i] = iCustom(NULL,0,"Stochastic Slope",8,3,3,0,1,0.05,1,0,i);         
            Casino_HAS_PIN_v3rBuffer[i] = iCustom(NULL,0,"Casino_HAS_PIN_v3r",false,false,false,false,false,false,true,0,1,0,1,false,20,false,false,0,0,3,Lime,Red,10,DodgerBlue,White,3,0,i);      
          
            //Create and Open file
            int handle=FileOpen(FileName,FILE_CSV|FILE_READ|FILE_WRITE,",");
            
            //Name column headers
            FileWrite(handle,"Open Timestamp","Open","High","Low","Close","Volume","Stochastic","Casino_HAS_PIN_v3r");
            
            //Go to end of file
            FileSeek(handle,0,SEEK_END);
            
            //Record Indicator values
            FileWrite(handle,Time[i],Open[i],High[i],Low[i],Close[i],Volume[i],StochasticBuffer[i],Casino_HAS_PIN_v3rBuffer[i]);
            
            //Close file
            FileClose(handle);    
            
         }
         
      return(0);
  }


Kind regards

George

<ex4 files deleted>

Files:
 
Your bogus call
 Stochastic Slope.mq4
iCustom(NULL,0,"Stochastic Slope",
         missing                 
8,
3,
3,
         missing                 
0,
         missing                 
1,
         missing                 
0.05,
1,       extra
0,i);

extern string    SettingsInfo="<< %K Period, %D Period, Slowing >>";
extern int       KPeriod=8;
extern int       DPeriod=3;
extern int       Slowing=3;
extern string    PriceInfo="<< 0=High/Low, 1=Close/Close >>";
extern int       PriceField=1;
extern string    MAInfo="<< SMA=0, EMA=1, SMMA=2, LWMA=3 >>";
extern int       MAMethod=0;
extern string    SlopeThreshholdInfo="<< Slope threshold=0.0 to 1.0 >>";
extern double    SlopeThreshold=0.05;

You should encapsulate your iCustom calls to make your code self-documenting.
          Detailed explanation of iCustom - MQL4 programming forum
Reason: