My name is Harry.
am trying to use attached linear regression slope indicator in my EA, but
I'm having trouble retrieving the values of the indicator in my EA.
It is returning always EMPTY_VALUE.
I have to use this indicator with MT4, so I have compiled the
indicator in MT4 and seems to draw fine. (attached in a chart, as well
as in the strategy tester)
The problem that I have is when I try to retrieve values to process in my EA, I get always EMPTY_VALUE.
That's how I 'm trying to retrieve:
double LRS1 = iCustom(NULL, RunningTF, "lrs", LRSPeriod, 0, 1); // linear regression slope
I need the previous bar value in my EA.
I do not have the same issue with other indicators I call similarly.
If anyone could help mde with this, I will be really obliged.
Greetings from Greece,
//--- main cycle
The indicator may work as expected for the first call, when prev_calculated is zero.
But after that i will be either Bars-1 or Bars-2, so as new bars are opened, no value is calculated for them
Keith, Thanks for your comment. The strange thing is that the indicator draws apparently normally, both attached to a chart and in the strategy tester!!! Try it. It has to be something else...
What is normal for you ?
... // default setting is PRICE_MEDIAN
For candle i, it uses Low/High of candle i-1 to i-40, these are future values.
I concur, there is no way that this indicator draws normally.
I am wondering if it is someone's attempt to convert an mq5 code to mq4?
This is confusing, why the use of capital letters?
int OnCalculate(const int rates_total,
const int prev_calculated,
const datetime &Time,
const double &Open,
const double &High,
const double &Low,
const double &Close,
const long &tick_volume,
const long &volume,
const int &spread)
Good catch. I came to the same conclusion but without finding a clue.
EDIT: It's not even an attempt to convert, only thing changed is extension .mq5 to .mq4. Original is here https://www.mql5.com/en/code/127
To add comments, please log in or register