Hi friends,
When I read an indicator value in a time frame other than the chart current time frame I get wrong values! Is there any consideration to follow to avoid this problem?
Thanks,
Shahram
you need to post your code so that we can look at what you are doing... otherwise there is no information to go on.
you need to post your code so that we can look at what you are doing... otherwise there is no information to go on.
For instance assuming my current time frame is on 5 min within strategy tester I try to read Bollinger Band on 15 min and I use below code:
for(int i=1; i<=4; i++) {
_iBands_Lower[i] = iBands(NULL,PERIOD_M15,20,2,0,PRICE_CLOSE,MODE_LOWER,i);
_iBands_Upper[i] = iBands(NULL,PERIOD_M15,20,2,0,PRICE_CLOSE,MODE_UPPER,i);
Print(" Lower = ", _iBands_Lower[i], " Upper", _iBands_Upper[i]);
}
Your code appears to be for mql4 but you have not posted in the MQL4 and Metatrader 4 section.
If you are referring to mql4, then please confirm and I will move this topic to the correct section.
If your code is supposed to be mql5, then please read the documentation.
- Post in the correct place.
- Please edit your (original) post and use the CODE
button (Alt-S)! (For large amounts of code, attach it.)
General rules and best pratices of the Forum. - General - MQL5 programming forum
Messages Editor -
for(int i=1; i<=4; i++) { _iBands_Lower[i] = iBands(NULL,PERIOD_M15,20,2,0,PRICE_CLOSE,MODE_LOWER,i); _iBands_Upper[i] = iBands(NULL,PERIOD_M15,20,2,0,PRICE_CLOSE,MODE_UPPER,i);
You are mixing apples and oranges. - On MT4: Unless the current chart is that specific symbol(s)/TF(s) referenced, you must handle 4066/4073
errors before accessing candle/indicator values.
Download history in MQL4 EA - Forex Calendar - MQL4 programming forum - Page 3 #26 № 4
I have deleted your other topic which is also about different timeframes.
Don't duplicate topics.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi friends,
When I read an indicator value in a time frame other than the chart current time frame I get wrong values! Is there any consideration to follow to avoid this problem?
Thanks,
Shahram