Trend Reversal / Potential pressure
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © BardiaB2

//@version=4
strategy("TR", calc_on_every_tick=true)

ATR=atr(7) * 1


trendMA = ema(close, 500)
is_trend_up = close>trendMA

is_red(i) => (close[i] < open[i]) ? 1 : 0
is_green(i) => is_red(i) ? 0 : 1

is_hammer(i) => is_red(i) ? ((high[i]-close[i]) < (high[i]-low[i])/3 ) : ((high[i]-open[i]) < (high[i]-low[i])/3 )  
is_stick(i)  => is_red(i) ? ((open[i]-low[i]) < (high[i]-low[i])/3 ) : ((close[i]-low[i]) < (high[i]-low[i])/3 )  



if is_hammer(1) and is_red(2) and is_green(0) and close>close[1] and open[1]>open and low>low[1] and is_trend_up
    strategy.entry("LE", strategy.long, 10000)
    strategy.exit("TP/SL LE", "LE", stop = low[1]-ATR, limit=close+(high[1]-low[1])+ATR)

if is_stick(1) and is_green(2) and is_red(0) and close<close[1] and open[1]<open and high<high[1] and (not is_trend_up)
    strategy.entry("SE", strategy.short, 10000)
    strategy.exit("TP/SL SE", "SE", stop = high[1]+ATR, limit=close-(high[1]-low[1])-ATR)




