Code for macd histogram and macd crossover simultaneously

hi all,

please provide code for a strategy with following condition.

Buy when bar on 0 line on macd histogram and macd crossover lines are also above 0 line on macd histogram.

please see arrow on attached image.


thanx in advance

paresh

As per above query

SET A = MACDSignal(13, 26, 9, SIMPLE)
SET B = MACD(13, 26, 9, SIMPLE)
CROSSOVER(A, B) = TRUE
1 Like

Sir script generating error…same script in tradescript is also giving error. .humble request pls test it and provide correct macd crossover algo

TRY THIS:
MACD(12, 26, 9, EXPONENTIAL) > MACDSIGNAL(12, 26, 9, EXPONENTIAL) AND
MACDSIGNAL(12, 26, 9, EXPONENTIAL) > 0

Sir
This script gives the number of times MACD is above MACD Signal line ( which is many many times) when MACD signal line is above o.
But what i want is regardless of if MACDsingnal line above or below zero…the exact moment when the crossover is happening…and not when it has already happened as per this algo…
Kindly provide correct alternative to the above stated algo