Hey there guys – wondering if anyone could help with code condition for only taking a trade if price is a certain % above moving average?
so price must be within 5% of 200 ema? any help appreciated thanks
There you go:
// price must be within 5% of 200 ema
Ema200 = average[200,1](close)
Above = Ema200 * 1.05 //5% above
Below = Ema200 * 0.95 //5% below
Cond = (close <= Above) AND (close >= Below)
RETURN Cond AS "Within 5%"