Humbolo:
Did you check the rsiTimeFrame and rsiAppliedpPrice variables (and what happens to them in the different parts of the EA)?
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 getCurrentRSI(rsiTimeFrame, rsiAppliedpPrice) = 54.08591494
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
Mladen Rakic:
Did you check the rsiTimeFrame and rsiAppliedpPrice variables (and what happens to them in the different parts of the EA)?
They are not changed during execution. Or at least not within the scope of the EA. This EA is meant to run on any currency pair, and assumes different values for each pair. Could there be a concorrence issue? Like a static variable being overwritten?
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.
honest_knave:
If you haven't accessed the other timeframe for a while, first call will be the "old" data. Second call shows the updated value.
Damn! Thanks so much for the reply, that fits the issues I'm having!
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
whroeder1:
-
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!!
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
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