Hi
I would like some help with the code to merge two indicators into one
Indicator 1 – Signal (EMA9X20Signal)
Long Signal (EMA9 crosses over EMA 20) when both EMA9 and EMA20 are below EMA50
Short Signal (EMA9 crosses under EMA20) when both EMA9 and EMA20 are above EMA50
Essentially EMA9 should crossover EMA20 when they are both under EMA50, if the crossover happens when both or one of the EMA is above EMA50 then it is not a valid Long signal and vice versa for short
Indicator 2 – Confirmation (EMA9X20Confirm)
Long Confirmation (EMA9 and EMA20 both are above EMA50) and one of the candle touches the EMA9 and closes above EMA9 (pullback)
Short Confirmation (EMA9 and EMA20 both are below EMA50) and one of the candle touches the EMA9 and closes below EMA9 (pullback)
Essentially both signal and confirmation is that after the crossover of EMA9 and EMA20 whilst being under EMA50 now both EMA should rise above EMA50 but the signal to take the trade only happens when the candle pulls back to touch EMA9 and closes above it.
I managed to code these as two indicators individually but as you may notice confirmation indicator invalidates the signal indicator hence there will not be a scenario that all of these indicators will come true at the same time. I am not that familiar with loops to look back the value when the signal happened to use it as a starting point for my confirmation indicator hence my struggle.
I will not be able to test this strategy unless I have both the indicators into one, I really hope if anyone can help.
I have attached both the indicator file, I very much appreciate if you could assist me please?
thank you in advance.