using iCustom with Renko chart

 

Hello,


i try to find out how to use iCustom with MQL5, for Mql4 there was ist easy, but here i always get an error


i use following code


double Renko[];
int   RenkoHandle=0;

double Ask = SymbolInfoDouble(_Symbol,SYMBOL_ASK);
double Bid = SymbolInfoDouble(_Symbol,SYMBOL_BID);
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+


int OnInit()
  {

   RenkoHandle=iCustom(_Symbol,NULL,"renko2","RENKO_TYPE_TICKS",100,true,10080);
   Print("Renko_handle = ",RenkoHandle,"  error = ",GetLastError()); 
 

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

//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
//--- release indicator handles
   IndicatorRelease(RenkoHandle);

  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
void OnTick()
  {
      
      CopyBuffer(RenkoHandle,0,0,50,Renko);
      ArraySetAsSeries(Renko,true);

  }

with following Renko indicator

https://www.mql5.com/en/code/19559


and get some error messages in the Terminal

what is the root cause of this fault? i dont understand why there comes an fault at the init of the indicator.


sure, i know, i only copy buffer 0, but for testing in the first step is this enogth for me


amando

Renko 2.0
Renko 2.0
  • votes: 14
  • 2017.12.28
  • Guilherme Santos
  • www.mql5.com
Implemented normal array buffer for better performance. w/ Aécio F. Neto Implemented chart reload algorithm and other corrections.
 

ok, i solved the first problem,


with the code

int OnInit()
  {
   ResetLastError();
   RenkoHandle=iCustom(_Symbol,NULL,"Renko2",0,100,true,10080);  // keine Werte damit der EA nicht keinen Error bring
   Print("Renko_handle = ",RenkoHandle,"  error = ",GetLastError()); 
   return(INIT_SUCCEEDED); 
  }

its working, i cannot input the ENUM as string, this will be ok so with 0 the expert get the default value.


on the other hand,

i filled out the rest of the arreys


double RenkoOpen[];
double RenkoHigh[];
double RenkoLow[];
double RenkoClose[];
int   RenkoHandle=0;

double Ask = SymbolInfoDouble(_Symbol,SYMBOL_ASK);
double Bid = SymbolInfoDouble(_Symbol,SYMBOL_BID);
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+


int OnInit()
  {
   ResetLastError();
   RenkoHandle=iCustom(_Symbol,NULL,"Renko2",0,100,true,10080);  // keine Werte damit der EA nicht keinen Error bring
   Print("Renko_handle = ",RenkoHandle,"  error = ",GetLastError()); 
   return(INIT_SUCCEEDED); 
  }
//+----

//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
//--- release indicator handles
   IndicatorRelease(RenkoHandle);

  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
void OnTick()
  {
      

 
      CopyBuffer(RenkoHandle,0,0,5,RenkoOpen);
      ArraySetAsSeries(RenkoOpen,true);
      CopyBuffer(RenkoHandle,1,0,5,RenkoHigh);
      ArraySetAsSeries(RenkoOpen,true);
      CopyBuffer(RenkoHandle,2,0,5,RenkoLow);
      ArraySetAsSeries(RenkoOpen,true);
      CopyBuffer(RenkoHandle,3,0,5,RenkoClose);
      ArraySetAsSeries(RenkoOpen,true);
      

   Print("Renko open:  ",NormalizeDouble(RenkoOpen[0],5));
   Print("Renko high:  ",NormalizeDouble(RenkoHigh[0],5));
   Print("Renko low :  ",NormalizeDouble(RenkoLow[0],5));
   Print("Renko close: ",NormalizeDouble(RenkoClose[0],5));
   

 
  }


what i expected, i have init the indicator handle, in this case RenkoHandle one time, and then i set every Buffer to an Series.


The result is


what i cannot understand bcs when i look to the data window provides the low value not in normal chart and not in renko chart



does anyone have an idea?


amando

 
      CopyBuffer(RenkoHandle,0,0,5,RenkoOpen);
      ArraySetAsSeries(RenkoOpen,true);
      CopyBuffer(RenkoHandle,1,0,5,RenkoHigh);
      ArraySetAsSeries(RenkoHigh,true);
      CopyBuffer(RenkoHandle,2,0,5,RenkoLow);
      ArraySetAsSeries(RenkoLow,true);
      CopyBuffer(RenkoHandle,3,0,5 ,RenkoClose);
      ArraySetAsSeries(RenkoClose,true);

always look to copied lines, the bad thing is, it brings no error only worng values

 
amando:

always look to copied lines, the bad thing is, it brings no error only worng values

Why are you thinking it's wrong values ?
Reason: