Code help
Please explain what you mean by "doesn't work"
Are all conditions satsified, but it doesn'y open a trade?
If so, what was the error?
- "Doesn't work" is meaningless - just like saying the car doesn't work. Doesn't start, won't go in gear, no electrical, missing the key, flat tires - meaningless. There are no mind readers here.
-
Your condition is that the MA cross and the RSI cross must occur on the same bar, which is unlikely. if(PreviousFastMA < PreviousSlowMA && CurrentFastMA > CurrentSlowMA) { if(PreviousRSI < 50.0 && CurrentRSI > 50.00)
What you want is both conditions correct and open on a change of signal (to prevent multiple opens.) static bool isBuy=false, isSell=false; bool wasBuy=isBuy, wasSell=isSell; isBuy = CurrentFastMA > CurrentSlowMA && CurrentRSI > 50.00; isSell = CurrentFastMA < CurrentSlowMA && CurrentRSI < 50.00; if(isBuy && !wasBuy)
WHRoeder:
Thanks for your help, I've tried to alter this with your code above but I'm still having problems with this, I'm going to take this code back to the drawing board.
- "Doesn't work" is meaningless - just like saying the car doesn't work. Doesn't start, won't go in gear, no electrical, missing the key, flat tires - meaningless. There are no mind readers here.
-
Your condition is that the MA cross and the RSI cross must occur on the same bar, which is unlikely. What you want is both conditions correct and open on a change of signal (to prevent multiple opens.)
if(PreviousFastMA < PreviousSlowMA && CurrentFastMA > CurrentSlowMA) { if(PreviousRSI < 50.0 && CurrentRSI > 50.00) {
In this case you need double cross at same bar. MA and rsi. Try like this
if(PreviousFastMA < PreviousSlowMA && CurrentFastMA > CurrentSlowMA) { if(CurrentRSI > 50.00) {
Hi this is my 1st code I've complied without errors or warnings, however this EA code doesn't seem to work, any advise?