Hello everyone, and thanks for taking the time to read this.
To the point, I'm programming a custom indicator which uses the standard indicator for MA (Moving Averages), the one we have in the mql5 library. And, I'm using the short version of OnCalculate() because all I need is the price.
The problem is:
1) I need to initialize the handler of the standard MA indicator in OnInit():
2) As you can see, we have to set the specific 'price base' up (in this case PRICE_CLOSE from ENUM_APPLIED_PRICE). BUT THE SHORT VERSION OF OnCalculate() ALREADY HAS A 'PRICE BASE' SET UP (When you launch a custom indicator you have to pick up the 'price base' from a drop-down list).
int OnCalculate(const int rates_total,
const int prev_calculated,
const int begin,
const double &price[]) <<<<<< Already comes from a 'price base' (PRICE_CLOSE, PRICE_OPEN, PRICE_HIGH, etc.)
{
So, is there a way where I can initialize the handler iMA (in the OnInit() function of course) with the 'price base' used for the variable &price[] of OnCalculate()? Maybe the 'price base' used to initialize the custom indicator is saved in some global constant, à la _Digits or _Point.
Anyway, I will really appreciate any help you could give me, or for pointing me to the right direction.
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
Hello everyone, and thanks for taking the time to read this.
To the point, I'm programming a custom indicator which uses the standard indicator for MA (Moving Averages), the one we have in the mql5 library. And, I'm using the short version of OnCalculate() because all I need is the price.
The problem is:
1) I need to initialize the handler of the standard MA indicator in OnInit():
2) As you can see, we have to set the specific 'price base' up (in this case PRICE_CLOSE from ENUM_APPLIED_PRICE). BUT THE SHORT VERSION OF OnCalculate() ALREADY HAS A 'PRICE BASE' SET UP (When you launch a custom indicator you have to pick up the 'price base' from a drop-down list).
So, is there a way where I can initialize the handler iMA (in the OnInit() function of course) with the 'price base' used for the variable &price[] of OnCalculate()? Maybe the 'price base' used to initialize the custom indicator is saved in some global constant, à la _Digits or _Point.
Anyway, I will really appreciate any help you could give me, or for pointing me to the right direction.
Thanks in advance,
Multi.