synapticEx

Nebula Advanced Dynamic Support/Resistance

Still I don't know. Maybe it was not the script, but a bug in trading view that seems to appear when one reach the maximum jackpot: http://imgur.com/5FxvjjL
Remove from Favorite Scripts Add to Favorite Scripts
//@version=2
//synapticex.com
study("Nebula", shorttitle="Nebula", overlay=true)
length = input(title="Length", type=integer, defval=20)

fractal(i, type)=>
    f = 0
    if(type == 1 and n>15)
        f := high[i]<high[i-1] and high[i-1]<high[i-2] and high[i-2]>high[i-3] and high[i-3]>high[i-4] ? 1 : 0
    if(type == 2 and n>15)
        f := low[i]>low[i-1] and low[i-1]>low[i-2] and low[i-2]<low[i-3] and low[i-3]<low[i-4] ? 1 : 0
    f
    
h = fractal(5, 1)
l = fractal(5, 2)
hVal =  h ? high[3] : 0
lVal = l ? low[3] : 0

lSum = n>length*2 ? sum(lVal, length) : 0
hSum = n>length*2 ? sum(hVal, length) : 0
lN = n>length*2 ? sum(l, length) : 0
hN = n>length*2 ? sum(h, length) : 0
r = lSum>0 and hSum>0 and lN>0 and hN>0 ? abs((hSum/hN) - (lSum/lN)): 0

hPlus = hVal  and r?hVal+r:na
hMinus = hVal  and r?hVal-r:na
lPlus = lVal  and r?lVal+r:na
lMinus = lVal  and r?lVal-r:na
    
plot(hPlus, "hPlus", color=lime, linewidth=1, style=cross, transp=0, offset =-3, join=false)
plot(hMinus, "hMinus", color=red, linewidth=1, style=cross, transp=0, offset=-3, join=false)

plot(lPlus, "lPlus", color=white, linewidth=1, style=cross, transp=0, offset =-3, join=false)
plot(lMinus, "lMinus", color=fuchsia, linewidth=1, style=cross, transp=0, offset=-3, join=false)
karabogerald
6 months ago
Great Stuff.
Reply
synapticEx karabogerald
6 months ago
thanks
Reply
Ideas Scripts Chart
United States
United Kingdom
India
España
Italia
Brasil
Россия
Türkiye
日本
한국
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