CPR Script
CPR Script
2.0 at https://mozilla.org/MPL/2.0/
// © allanster
//@version=4
study(title = "CPR Weekly", shorttitle = "CPR", overlay = true, precision =
2, max_bars_back = 200)
//study(title="EMA 20/50/100/200", overlay=true)
ema15 = ema(close, 15)
ema35 = ema(close, 35)
ema100 = ema(close, 100)
ema200 = ema(close, 200)
plot(ema15 , title = "ema15", color = color.rgb(245, 197, 125), linewidth =
2)
plot(ema35 , title = "ema35", color = color.green, linewidth = 2,display=0)
plot(ema100 , title = "ema100", color = color.rgb(12, 12, 12), linewidth =
3,display=0)
plot(ema200 , title = "ema200", color =color.rgb(241, 9, 9, 1), linewidth =
4,display=0)
//@version=4
//Plotting
plot(dp and pivot ? pivot : na, title="Pivot", color=color.rgb(240, 24,
139), style=plot.style_circles, linewidth=3)
plot(dp and bc ? bc : na, title="BC", color=color.navy,
style=plot.style_circles, linewidth=3)
plot(dp and tc ? tc : na, title="TC", color=color.navy,
style=plot.style_circles, linewidth=3)
plot(dp and r1 ? r1 : na, title="R1", color=color.red,
style=plot.style_circles, linewidth=3)
plot(dp and s1 ? s1 : na, title="S1", color=color.green,
style=plot.style_circles, linewidth=3)
plot(tp and tppivot ? tppivot : na, title="Pivot",color=color.fuchsia,
style=plot.style_circles , linewidth=3)
plot(tp and tpbc ? tpbc : na, title="BC",color= color.navy,
style=plot.style_circles, linewidth=3)
plot(tp and tptc ? tptc : na, title="TC",color= color.navy,
style=plot.style_circles, linewidth=3)
plot(tp and tpr1 ? tpr1 : na, title="R1",color= color.red,
style=plot.style_circles, linewidth=3)
plot(tp and tps1 ? tps1 : na, title="S1",color= color.green,
style=plot.style_circles, linewidth=3)
//
lookback = input(title="Lookback:", type=input.integer, defval=7)
rsiLen = input(title="RSI Length:", type=input.integer, defval=14)
rsiSrc = input(title="RSI Source:", type=input.source, defval=close)
//@version=4
//study("Open Range Breakout",overlay=true)
//is the market trading in between the session timings? If yes then it
returns true
Barsinsession(session) => time(tf,session) != 0 //single line function
Insession = Barsinsession(session) ? 1 : 0
endofsession = Insession == 0 and Insession[1] == 1 //end of the session
if it is happening -> returns ture
//high value and low value from 60min timeframe charts
hi = security(syminfo.tickerid,tf,high)
lo = security(syminfo.tickerid,tf,low)
Buy = crossover(high,orbh)
Short = crossunder(low,orbl)
//flip
Buycontinue = barssince(Buy) < barssince(Short)
Shortcontinue = barssince(Short) < barssince(Buy)
//exrem
Buy := not isLong and Buy
Short := not isShort and Short
if Buy
isLong := true
isShort := false
if Short
isLong := false
isShort := true
if newday[1]
isLong := false
isShort := false
//plot(orbh,color=color.red,style=plot.style_circles,linewidth=linew)
//plot(orbl,color=color.lime,style=plot.style_circles,linewidth=linew)