I am very new to pine script and trying to generate an EMA mean reversion algo. Conditions are as follows TimeFrame: 10mins, Time 9:15 a.m to 10:15.a.m otherwise no entry
Candle low should be far away and above from the user input EMA (example 7EMA).
If there are multiple candles far away from that EMA than consider that candle which has farthest low.(Ambiguity: havenot decided how much far way the low should be but it should not be very near to the EMA)
If the low of that farthest candle is broken take short enrty,if time is > 10.15 no entry to be taken.
SL should be the HH(Highest high) of the candles which are away from the EMA.
As I am new to Pine Script
I have only been able to plot EMA.
Also found out the candles whose close and low are away from EMA.
Yet to decide the exit condition
Code:
//@version=5
strategy("7ema", overlay=true)
ema_input=input.int(7,'EMA Length')
ema_=ta.ema(close,ema_input)
plot(ema_)
barcolor((close > ema_) and (low > ema_ or high < ema_) ? color.black : na)