RSISTRATEGY
RSISTRATEGY
source = close
length = input.int(14, minval=1)
LLL= LL
SSS= SS
var pos = 0
var isLong = false
// we save it to a new number when long happens. Long can be 1
if LLL and pos <= 0 and not isLong
pos := 1
isLong:= true
// we save it again when short happens. Short can be -1
if SSS and pos >= 0 and isLong
pos := -1
isLong:= false
//
plotshape(longsignal, style=shape.cross, location=location.belowbar,
color=color.rgb(0, 255, 13), size=size.tiny, textcolor=color.new(color.white, 0))
//plotting up arrow when buy/long conditions met
plotshape(shortsignal, style=shape.cross, location=location.abovebar,
color=color.rgb(255, 0, 0), size=size.tiny,textcolor=color.new(color.white,
0)) //plotting down arrow when sell/short conditions met
var float PP = na
var float TPS = na
TPL1:= close+(close*0.004)
TPL2:= close+(close*0.008)
TPS := close-(close*0.013)
PP := close
TSL1 := close-(close*0.004)
TSL2 := close-(close*0.008)
TSS := close+(close*0.013)
if longsignal
strategy.entry("Enter Long", strategy.long)
strategy.exit("Exit Long", from_entry="Enter Long", limit=TPL2)
if shortsignal
strategy.entry("Enter Short", strategy.short)
strategy.exit("Exit Short", from_entry="Enter Short", limit=TSL2)