i was trying to get candle close and open price but my compiler keeps giving me undeclared identifier issues. I put it in properly as Close[1]; and Open[1]; any idea on why this is happening?
You're trying to use outdated MQL4 code in MQL5.
Just put this at the top of your MQL5 code:
//--- store price, time, and volume data for access as in MQL4 #define SERIES(name,type) \ class C##name \ { \ public: \ type operator[](const int i){return i##name(NULL,0,i);} \ }name; SERIES(Open,double) SERIES(Low,double) SERIES(High,double) SERIES(Close,double) SERIES(Time,datetime) SERIES(Volume,long) SERIES(TickVolume,long)Then you can use it.
You're trying to use outdated MQL4 code in MQL5.
Just put this at the top of your MQL5 code:
Then you can use it.Hi I was using this: MQL5 mentioned that i did not need to declare Close and open positions separately as they are are built-in arrays
bool BearishEngulfing()
{
double close1 = Close[1]; // Previous candle's close price
double open1 = Open[1]; // Previous candle's open price
double close0 = Close[0]; // Current candle's close price
double open0 = Open[0]; // Current candle's open price
return (close1 > open1 &&
close0 < open0 &&
open0 > close1 &&
close0 < open1);
}
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
i was trying to get candle close and open price but my compiler keeps giving me undeclared identifier issues. I put it in properly as Close[1]; and Open[1]; any idea on why this is happening?
for reference: bool BearishEngulfing()
{
double close1 = Close[1]; // Previous candle's close price
double open1 = Open[1]; // Previous candle's open price
double close0 = Close[0]; // Current candle's close price
double open0 = Open[0]; // Current candle's open price
return (close1 > open1 &&
close0 < open0 &&
open0 > close1 &&
close0 < open1);
}