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
- www.mql5.com
CiATR class provides the creation, setup, and access to the data of the Average True Range indicator...
Hello,
I tried to use for the ATR calculation the include files,
but I always get Empty Value out
here the script
is there something wrong?
https://www.mql5.com/en/docs/standardlibrary/technicalindicators/oscillatorindicators/ciatr/ciatrcreate