soru

soru (SR levels: dynamic and fixed)

327 1 36
snapshot
Remove from Favorite Scripts Add to Favorite Scripts
study(title="soru (SR levels: dynamic and fixed)", shorttitle="soru (SR levels: dynamic and fixed)", overlay=true) 
TW1 = input("2W", title="Timewindow1")
TW2 = input("2M", title="Timewindow2")

S1 = input(title="Show TW1", type=bool, defval=false)
S1M = input(title="Show TW1 Med line", type=bool, defval=false)
S2 = input(title="Show TW2", type=bool, defval=false)
S2M = input(title="Show TW2 Med line", type=bool, defval=false)



pf = (hlc3) *2
pla = pf - high
pha = pf - low
pma = hlc3
//TW1 
time_pfa = security(tickerid, TW1, pfa[1]) 
time_pla = security(tickerid, TW1, pla[1]) 
time_pha = security(tickerid, TW1, pha[1]) 
time_pma = security(tickerid, TW1, pma[1]) 
 
color_pla = close < time_pla ? red : yellow
color_pha = close > time_pha ? lime : yellow
color_pma = close > time_pma ? lime : red



plot(S1 and time_pla ? time_pla : na, title="Projected Low",style=circles, color=color_pla ,linewidth=1) 
plot(S1 and time_pha ? time_pha : na, title="Projected High",style=circles, color=color_pha ,linewidth=1) 
plot(S1M and time_pma ? time_pma : na, title="Projected Mid",style=circles, color=color_pma ,linewidth=1, join=false)





//TW2
time2_pfa = security(tickerid, TW2, pfa[1]) 
time2_pla = security(tickerid, TW2, pla[1]) 
time2_pha = security(tickerid, TW2, pha[1])
time2_pma = security(tickerid, TW2, pma[1]) 
 
color2_pla = close < time2_pla ? red : yellow
color2_pha = close > time2_pha ? lime : yellow
color2_pma = close > time2_pma ? lime : red


plot(S2 and time2_pla ? time2_pla : na, title="Projected Low 2",style=circles, color=color2_pla ,linewidth=2) 
plot(S2 and time2_pha ? time2_pha : na, title="Projected High 2",style=circles, color=color2_pha ,linewidth=2) 
plot(S2M and time2_pma ? time2_pma : na, title="Projected Mid 2",style=circles, color=color2_pma ,linewidth=2, join=false)


//moving part
periods=input(200, minval=1, title="MA Period")

pc = input(true, title="Draw swings?")



hld = iff(close > sma(high,periods)[1], 1, iff(close<sma(low,periods)[1],-1, 0))
hlv = valuewhen(hld != 0, hld, 1)

hi = pc and hlv == -1 ? sma(high, periods) : na
lo = pc and hlv == 1 ? sma(low,periods) : na


low_tf = input(title="5/3 min TF", type=bool, defval=false)
plot(avg(sma(high,periods)+2.5*(sma(high,periods)-sma(low,periods)),sma(low,periods)-2.5*(sma(high,periods)-sma(low,periods))), color=navy, style=linebr,linewidth=2)
plot(lo ? sma(high,periods)+2.5*(sma(high,periods)-sma(low,periods)):na, color=orange, style=linebr,linewidth=2)
plot(hi ? sma(low,periods)-2.5*(sma(high,periods)-sma(low,periods)):na, color=orange, style=linebr,linewidth=2)
plot(hi ? sma(low,periods)-5*(sma(high,periods)-sma(low,periods)):na, color=orange, style=linebr,linewidth=2)
plot(lo ? sma(high,periods)+5*(sma(high,periods)-sma(low,periods)):na, color=orange, style=linebr,linewidth=2)
plot(hi ? sma(low,periods)-7.5*(sma(high,periods)-sma(low,periods)):na, color=orange, style=linebr,linewidth=2)
plot(lo ? sma(high,periods)+7.5*(sma(high,periods)-sma(low,periods)):na, color=orange, style=linebr,linewidth=2)
plot(hi ? sma(low,periods)-10*(sma(high,periods)-sma(low,periods)):na, color=orange, style=linebr,linewidth=2)
plot(lo ? sma(high,periods)+10*(sma(high,periods)-sma(low,periods)):na, color=orange, style=linebr,linewidth=2)
plot(hi and low_tf ? sma(low,periods)-12.5*(sma(high,periods)-sma(low,periods)):na, color=orange, style=linebr,linewidth=2)
plot(lo and low_tf ? sma(high,periods)+12.5*(sma(high,periods)-sma(low,periods)):na, color=orange, style=linebr,linewidth=2)
plot(hi and low_tf ? sma(low,periods)-15*(sma(high,periods)-sma(low,periods)):na, color=blue, style=linebr,linewidth=2)
plot(lo and low_tf ? sma(high,periods)+15*(sma(high,periods)-sma(low,periods)):na, color=blue, style=linebr,linewidth=2)


plot(pc and sma(high, periods) ? sma(high, periods):na ,title="Swing High Plot", color=red,style=linebr, linewidth=2)
plot(pc and sma(low,periods) ? sma(low,periods) : na ,title="Swing Low Plot", color=lime,style=linebr, linewidth=2)


//previous WEEK closure
cw_draw = input(title="Draw previous WEEK closure", type=bool, defval=false)
cw = close
time_cw = security(tickerid, "1W", cw[1])
plot(cw_draw and time_cw ? time_cw : na, title="Weekly closure",style=circles, color=white ,linewidth=2)


Play with the settings:)

cheers
Reply
United States
United Kingdom
India
Deutschland
España
France
Việt Nam
Italia
Polska
Brasil
Россия
Türkiye
Indonesia
Malaysia
日本
한국
简体
繁體
Home Stock Screener Forex Signal Finder Cryptocurrency Signal Finder Economic Calendar How It Works Chart Features House Rules Moderators Website & Broker Solutions Widgets Stock Charting Library Feature Request Blog & News FAQ Help & Wiki Twitter
Profile Profile Settings Account and Billing Support Priority Support Report Issue Ideas Published Followers Following Private Messages Chat Sign Out