@Draken The code calls DrawDivergence for either bullish or bearish signal. variable curr contains bar index for the signal. Just call some trade function in addition to DrawDivergence method. Here's a very simple buy/sell order creation logic. Should be enough for backtesting. https://www.mql5.com/en/code/viewcode/103/129838/k_esimplema.mq5

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
Hello!
I found a RSI Divergence indicator that someone had built (custom indicator). I tried to make my EA buy when the indicator drew bullish flags and sell when the indicator drew a bearish flag. I solved this by detecting when the objects (a line and an arrow) was created. But this only works with the strategy tester vizualiser or when live trading. It does not work in backtesting (since there is no window --> no objects are created --> EA can't use the signals).
I tried to add a buffer to the indicator and give it a standard value = 0 and = 1 when it is a bullish signal and = 2 when bearish signal.
This does not work and it does not work to give the other buffers these or other values.
I am going crazy over this, it feels like I have solved more difficult problems in the past.
What I want is to recieve a signal from a buffer from this indicator in the form of 0, 1 or 2 depending on if there is no signal, a bullish or a bearish signal.
I will link the indicator, grateful for help on this matter!