CIATR

Hello,


I tried to use for the ATR calculation the include files, 

but I always get Empty Value out


here the script

#include <Indicators\Indicator.mqh>      CIndicator _indi; #include <Indicators\Oscilators.mqh>     CiATR atr; void OnStart()   {    atr.Create(_Symbol,PERIOD_CURRENT,14);       Print(atr.Main(0));      }

is there something wrong?


https://www.mql5.com/en/docs/standardlibrary/technicalindicators/oscillatorindicators/ciatr/ciatrcreate

Documentation on MQL5: Standard Library / Indicators / Oscillators / CiATR / Create
Documentation on MQL5: Standard Library / Indicators / Oscillators / CiATR / Create
  • www.mql5.com
Create(string,ENUM_TIMEFRAMES,int) - CiATR - Oscillators - Indicators - Standard Library - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5

ok,

now I found it out


#include <Indicators\Oscilators.mqh>     CiATR atr; void OnStart()   { //---    //atr = new CiATR;       atr.Create(_Symbol,PERIOD_CURRENT,14);    atr.Refresh(-1);      Print(atr.Main(0));   }

but I don't know, why I have to refresh it


and is there a way to deinitialiszize?

Maybe it is 
atr.Destroy();

But i didn't test it so its best if you looked into the code it must be there.

Also you could use a fast timer.

atr.FullRelease(true);
releases the handle to the indicator. 

Nowhere in the class hierarchy of which CiATR is a member, does the Destroy() method exist.

More info can be found in the MT5 docs on CiATR. From there, you can navigate through the class hierarchy and look into the available methods.
Documentation on MQL5: CiATR / Standard Library
Documentation on MQL5: CiATR / Standard Library
  • www.mql5.com
CiATR class provides the creation, setup, and access to the data of the Average True Range indicator...
To add comments, please log in or register