soru dynamics®

486 4 64
this is reworked version dynamics indicator I published earlier. Now it's automatic - no input required.
It shows current TF bias and also longer term bias. Just choose TF and see how it draws channels.

My favourite TFs I use with that indicator are: 1m, 5m, 15m, 2h, 1D

Have fun and let me know what do you think about it.

Remove from Favorite Scripts Add to Favorite Scripts
study(title="soru dynamics®", shorttitle="soru dynamics®", overlay=true)
k = ismonthly? "M" : isweekly? "W" : isdaily ? "D" : ""
TW1 = tostring(interval)+k 
TW2 = tostring(interval*8)+k
s_TW1 = input(defval=true, title='Render TW1 Dynamics')
s_TW2 = input(defval=true, title='Render TW2 Dynamics')

// script
lvl(x) =>
    sma_l = security(tickerid, x, sma(low, periods))
    sma_h = security(tickerid, x, sma(high, periods))
    sma_m = sma_l+(sma_h-sma_l)/2
    k = close >= sma_m ? 1 : -1
    cond = sma_h-sma_l
    a = k > 0 ? ((abs(close - sma_h)/cond)/2.5) : ((abs(close - sma_l)/cond)/2.5)     
    m_1 = round(a)*2.5
    m_2 = round(a)*2.5+2.5
    m_3 = round(a)*2.5-2.5
    l = round(a)*2.5 < 5 ? sma_l : na
    h = round(a)*2.5 < 5 ? sma_h : na
    j= k==1 ? sma_h : sma_l
    lvl1 = j + k*m_1*cond
    lvl2 = j + k*m_2*cond
    lvl3 = j +k*m_3*cond
    [l, h, lvl1,lvl2,lvl3]

lc = security(tickerid, TW2, sma(low, periods))
hc = security(tickerid, TW2, sma(high, periods))
TW1_col = close > hc ? #579951 : close < lc ? #ca3925 : #747258    
TW2_col = black
[l1,h1, u1,u2,u3] = lvl(TW1)
plot_l1=plot(s_TW1 ? l1 : na, style=circles, color = TW1_col)
plot_h1=plot(s_TW1 ? h1 : na, style=circles, color = TW1_col)
plot(s_TW1 ? u1 : na, style=circles, color = TW1_col)
plot(s_TW1 ? u2 : na, style=circles, color = TW1_col)
plot(s_TW1 ? u3 : na, style=circles, color = TW1_col)
[l2, h2, d1, d2, d3] = lvl(TW2)
plot_l2=plot(s_TW2 ? l2 : na, style=circles, color= TW2_col)
plot_h2=plot(s_TW2 ? h2 : na, style=circles, color= TW2_col)
plot(s_TW2 ? d1 : na, style=circles, color= TW2_col)
plot(s_TW2 ? d2 : na, style=circles, color= TW2_col)
plot(s_TW2 ? d3 : na, style=circles, color= TW2_col)
Very smart coding, thanks for sharing.
+1 Reply
soru IvanLabrie
a year ago
thank you
soru IvanLabrie
a year ago
first version of this indicator had 200+ lines:) it worked slowly. Now I've added few things to this indicator and managed to close within 46 lines:) Still learning pine but I'm getting better and better. By the way if anyone know how to read certain value onload instead of rereading it with each candle that is drawn on chart - do let me know.
+2 Reply
a year ago
wow... beautiful
Ideas Scripts Chart
United States
United Kingdom
Home Stock Screener Economic Calendar How It Works Chart Features House Rules Moderators For the WEB Widgets Stock Charting Library Priority Support Feature Request Blog & News FAQ Help & Wiki Twitter
Private Messages Chat Ideas Published Followers Following Priority Support Public Profile Profile Settings Billing Sign Out