Can't figure this out, iRSI bug?
Greetings!
First time poster here. I have a bug that's nagging at me.
It has to do with iRSI indicator, which is giving me funky results.
...
Consider that my chart time frame is different than the variable timeFrame being used to calculate iRSI.
And this is what shows up on my console:
2017.02.21 04:00:02.934 currRsi = 44.80842249
Notice the difference. This is obviously throwing a wrench on my EA. It doesn't make sense to me that in the space of millisseconds, iRSI would change this much. What am I missing?
And does this kind of stuff happen to other indicators?
edit: this is running on MT4
Did you check the rsiTimeFrame and rsiAppliedpPrice variables (and what happens to them in the different parts of the EA)?
If you haven't accessed the other timeframe for a while, first call will be the "old" data. Second call shows the updated value.
-

Play videoPlease edit your post.
For large amounts of code, attach it - Why did you post your MT4 code/question in a MT5 forum?
- Make sure your other pairs/TFs are updated. History data and error 4066 - MQL4 forum
-
Please edit your post.
For large amounts of code, attach it - Why did you post your MT4 code/question in a MT5 forum?
- Make sure your other pairs/TFs are updated. History data and error 4066 - MQL4 forum
My apologies, won't happen again.
Thanks for the tip, will check it out!!
Greetings!
First time poster here. I have a bug that's nagging at me.
It has to do with iRSI indicator, which is giving me funky results.
Context: I have a chart running EA with the following method:
double getCurrentRSI(int timeFrame, ENUM_APPLIED_PRICE appPrice) {
double returnValue = iRSI(Symbol(),timeFrame,rsiPeriod,appPrice,1);
return returnValue;
}
And the method is called here, in two different places:
...
double currRsi = getCurrentRSI(rsiTimeframe, rsiAppliedPrice);
if (currRsi > 50.0 and [other conditions]) {
//opens a position
Print("currRsi" + currRsi);
Print("getCurrentRSI(rsiTimeFrame, rsiAppliedpPrice) = " + getCurrentRSI(rsiTimeframe, rsiAppliedPrice));
}
...
Consider that my chart time frame is different than the variable timeFrame being used to calculate iRSI.
And this is what shows up on my console:
2017.02.21 04:00:02.934 currRsi = 44.80842249
Notice the difference. This is obviously throwing a wrench on my EA. It doesn't make sense to me that in the space of millisseconds, iRSI would change this much. What am I missing?
And does this kind of stuff happen to other indicators?
edit: this is running on MT4