0% found this document useful (0 votes)
4 views3 pages

RSISTRATEGY

Uploaded by

a78m
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views3 pages

RSISTRATEGY

Uploaded by

a78m
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 3

//@version=5

strategy(title='MIO_RsiStrategy2', shorttitle='MIO_RsiStrategy2', overlay=true)

source = close
length = input.int(14, minval=1)

TTa = input.timeframe("60", title="Time Frame ")

rsi = request.security(syminfo.tickerid, TTa, ta.rsi(source, length))


LL= rsi>60
SS= rsi<40

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

longsignal = pos == 1 and (pos != 1)[1]


shortsignal = pos == -1 and (pos != -1)[1]

//
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

topPer = input(20, "Top Band Lookback Period")


botPer = input(20, "Bot Band Lookback Period")
maPer = input(20, "Moving Average Pereiod")
topSrc = input(high)
botSrc = input(low)

top = ta.highest(topSrc, topPer)


bot = ta.lowest(botSrc, botPer)

if longsignal //or zba


//TPL1:= close*1.005
//PP:= close
pph= math.round_to_mintick(top)
//th= math.round_to_mintick(TPL1)
//lk1= line.new(bar_index[0], th, bar_index+30, th, extend=extend.none,
color=color.white, width=2 )
lk2= line.new(bar_index[0], pph, bar_index+25, pph, extend=extend.none,
color=color.white, width=2 )
//lj1= label.new(bar_index - 2, th, "TP1", color=color.white,
style=label.style_none, color=color.white)
lj2= label.new(bar_index - 2, pph, "Long", color=color.white,
style=label.style_none, color=color.white)

if shortsignal //or zbb


//TSL1 := close/1.005
//lh= math.round_to_mintick(bot)
//PP:= close
pph= math.round_to_mintick(bot)
//sk1= line.new(bar_index[0], lh, bar_index+30, lh, extend=extend.none,
color=color.rgb(255, 255, 0), width=2 )
sk2= line.new(bar_index[0], pph, bar_index+25, pph, extend=extend.none,
color=color.rgb(255, 255, 0), width=2 )
//sl1= label.new(bar_index - 2, lh, "TP1", color=color.rgb(255, 255, 0),
style=label.style_none, color=color.rgb(255, 255, 0))
sl2= label.new(bar_index - 2, pph, "Short", color=color.rgb(255, 255, 0),
style=label.style_none, color=color.rgb(255, 255, 0))
//line.delete(sk1[1])

var float TPL1 = na


var float TPL2 = na
var float TPP = na
var float TSL1 = na
var float TSL2 = na
var float TSS = na
var float TPP1 = na

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)

alertcondition(longsignal, "RSI LONG", "RSI LONG")


alertcondition(shortsignal, "RSI SHORT", "RSI SHORT")

You might also like