Hello Guys,
I have created a simple RSI based EA in MT5. I would like to add one bar confirmation in it.
For example, lets say that if EA would take a “BUY” trade when RSI is 60…then instead of taking a trade right away…EA should wait for one more candle and if it is also green then only EA should take a “BUY” trade. (And vice-versa for Short trades)
Is it possible??
Hi,
So you need to check RSI for Candle[2] and then check Candle[1] if Close[1] > Open[1]
- You can create a boolean global variable which is false on init
- On tick, Check if you have new bar
- If there is a new bar
- Check if your variable is true - if it is > check if previous bar was green/read and then open a trade, if it is not set the variable to false
- check if RSI >= 60 If it is, change your variable to true
mirror for short
So it would work like this:
- first candle we have RSI > 60 - variable is false, so it goes to check RSI, RSI matches with cirterion, so variable switches to true
- next candle variable is true, so it checks previous candle if it is green/red - if it is, it opens a trade and switches to false (so you wont have multiple trades on single signal)
Hope this makes sense. Good luck!
2 Likes
@wilczasty has explained the process quite nicely. If you follow this, you can add the green and red bad confirmation.