CIATR Error 4806

 

Hello,


im try to use the CTrade ATR Indicator class, 

void ATRGrid(const string symbol, const double bid)
  {
   ResetLastError();
   
   ATRValue=0;
         
   if(!atr.Create(symbol,ATR_TF,ATR_Periode)) Print("Fehler beim erzeugen des ATR");
ResetLastError();
   atr.Refresh();

   ATRValue = atr.Main(0);
   atr.FullRelease(true);
   Grid = (int)NormalizeDouble(ATRValue*MathPow(10,SymbolInfoInteger(symbol,SYMBOL_DIGITS)),0);    // wenn use ATR Grid, dann hier den Grid Value eintragen
Print(Grid);
   if(GetLastError() !=0)
      Print(__FUNCTION__," Failure in initialising ATR for ATRGrid, Symbol: ", symbol,", Last Error: ",GetLastError());
   ResetLastError();

   RunGrid(symbol,Grid, bid);
  }

and now I always got Error 4806.

this Error comes on the Refresh. Does someone know, why?


regards

amando

 
amando :

Hello,


im try to use the CTrade ATR Indicator class, 

and now I always got Error 4806.

this Error comes on the Refresh. Does someone know, why?


regards

amando

An indicator in MQL5 MUST BE CREATED ONCE !!! This is done in OnInit () !!!

 
Vladimir Karputov:

An indicator in MQL5 MUST BE CREATED ONCE !!! This is done in OnInit () !!!

I know, but I can't create it in to run over several symbols in OnInit. 

This is even not the failure, I also do the FullRelease after. 

The question is, why does the Refresh do the Error?

btw, I get the right values out, but if I don't do the refresh, I got EmptyValue
 
amando :

I know, but I can't create it in to run over several symbols in OnInit. 

This is even not the failure, I also do the FullRelease after. 

The question is, why does the Refresh do the Error?

btw, I get the right values out, but if I don't do the refresh, I got EmptyValue

Do it RIGHT first, and then ask the question.

 
Vladimir Karputov:

Do it RIGHT first, and then ask the question.

and then I get the same Error, only once and not in every Tick, now?

 
amando :

and then I get the same Error, only once and not in every Tick , now?

You haven't fixed anything.

Example (for the CiSAR class): An example of using the Trend.mqh library is the   CiSAR   class

How to start with MQL5
How to start with MQL5
  • 2021.02.10
  • www.mql5.com
This thread discusses MQL5 code examples. There will be examples of how to get data from indicators, how to program advisors...
 

Thanks Vladimir, now its working ;-)