0% found this document useful (0 votes)
107 views1 page

Scripts For Ta

This document contains the code for two technical indicators - a parabolic SAR indicator and a stochastic RSI indicator. The parabolic SAR indicator code calculates a parabolic SAR value and entry/exit signals for a long/short trading strategy based on the parabolic SAR and extreme price levels. The stochastic RSI indicator code calculates stochastic and RSI values from price data, plots the stochastic and RSI lines, and highlights a crossover signal between the stochastic and its SMA.

Uploaded by

John Mark Verar
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)
107 views1 page

Scripts For Ta

This document contains the code for two technical indicators - a parabolic SAR indicator and a stochastic RSI indicator. The parabolic SAR indicator code calculates a parabolic SAR value and entry/exit signals for a long/short trading strategy based on the parabolic SAR and extreme price levels. The stochastic RSI indicator code calculates stochastic and RSI values from price data, plots the stochastic and RSI lines, and highlights a crossover signal between the stochastic and its SMA.

Uploaded by

John Mark Verar
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/ 1

mult = input(2.0, minval=0.

001, maxval=50) basis = sma(src, length) dev = mult *


stdev(src, length) upper = basis + dev lower = basis - dev plot(basis,
color=color.red) p1 = plot(upper, color=color.blue) p2 = plot(lower,
color=color.blue) fill(p1, p2) //end of bollinger //parabolic start = input(0.02)
increment = input(0.02) maximum = input(0.5) var bool uptrend = na var float EP =
na var float SAR = na var float AF = start var float nextBarSAR = na if bar_index >
0 firstTrendBar = false SAR := nextBarSAR if bar_index == 1 float prevSAR = na
float prevEP = na lowPrev = low[1] highPrev = high[1] closeCur = close closePrev =
close[1] if closeCur > closePrev uptrend := true EP := high prevSAR := lowPrev
prevEP := high else uptrend := false EP := low prevSAR := highPrev prevEP := low
firstTrendBar := true SAR := prevSAR + start * (prevEP - prevSAR) if uptrend if SAR
> low firstTrendBar := true uptrend := false SAR := max(EP, high) EP := low AF :=
start else if SAR < high firstTrendBar := true uptrend := true SAR := min(EP, low)
EP := high AF := start if not firstTrendBar if uptrend if high > EP EP := high
AF := min(AF + increment, maximum) else if low < EP EP := low AF := min(AF +
increment, maximum) if uptrend SAR := min(SAR, low[1]) if bar_index > 1 SAR :=
min(SAR, low[2]) else SAR := max(SAR, high[1]) if bar_index > 1 SAR := max(SAR,
high[2]) nextBarSAR := SAR + AF * (EP - SAR) if barstate.isconfirmed if uptrend
strategy.entry("SELL", strategy.short, stop=nextBarSAR, comment="SELL")
strategy.cancel("ParLE") else strategy.entry("BUY", strategy.long, stop=nextBarSAR,
comment="BUY") strategy.cancel("ParSE")

//@version=4
study(title="Stochastic RSI CROSS+RSI", shorttitle="SRSI CROSS+RSI",
format=format.price, precision=2, resolution="")
smoothK = input(3, minval=1)
smoothD = input(3, minval=1)
lengthRSI = input(14, minval=1)
lengthStoch = input(14, minval=1)
src = input(close, title="RSI Source")

rsi1 = rsi(src, lengthRSI)


k = sma(stoch(rsi1, rsi1, rsi1, lengthStoch), smoothK)
d = sma(k, smoothD)

plot(k, color=color.blue)
plot(d, color=color.orange)
h0 = hline(80)
h1 = hline(20)
fill(h0, h1, color=color.purple, transp=80)

plot(cross(k, d) ? k : na, style = plot.style_cross, linewidth = 4)

//
len = input(title="RSI Period", minval=1, defval=14)
myRsi = rsi(close,len)
plot(myRsi, title="RSI", linewidth=2, color=color.navy, transp=20)

You might also like