RicardoSantos

[RS]PA Zigzag Fibonacci FAN V0

EXPERIMENTAL:
fan projection from zigzag.
Remove from Favorite Scripts Add to Favorite Scripts
study(title='[RS]PA Zigzag Fibonacci FAN V0', shorttitle='F', overlay=true)
useHA = input(false, title='Use Heikken Ashi Candles')
useAltTF = input(true, title='Use Alt Timeframe')
tf = input('D', title='Alt Timeframe')

zigzag() =>
    _isUp = close >= close[1]
    _isDown = close <= close[1]
    _direction = _isUp[1] and _isDown ? -1 : _isDown[1] and _isUp ? 1 : nz(_direction[1])
    _zigzag = _isUp[1] and _isDown and _direction[1] != -1 ? highest(2) : _isDown[1] and _isUp and _direction[1] != 1 ? lowest(2) : na

_ticker = useHA ? heikenashi(tickerid) : tickerid
sz = useAltTF ? (change(time(tf)) != 0 ? security(_ticker, tf, zigzag()) : na) : zigzag()

plot(sz, title='zigzag', color=black, linewidth=2)

//  ||---   Pattern Recognition:

x = valuewhen(sz, sz, 1) 
z = valuewhen(sz, sz, 0)
n_x = valuewhen(sz, n, 1) 
n_z = valuewhen(sz, n, 0)

price_range = z-x
bar_range = n_z-n_x
step = price_range/bar_range
projection = sz ? na : z + ((n-n_z)*step)
projection_n0236 = sz ? na : z + ((n-n_z)*step)*-0.236
projection_n0382 = sz ? na : z + ((n-n_z)*step)*-0.382
projection_n0500 = sz ? na : z + ((n-n_z)*step)*-0.500
projection_n0618 = sz ? na : z + ((n-n_z)*step)*-0.618
projection_n1000 = sz ? na : z + ((n-n_z)*step)*-1.000
projection_n1618 = sz ? na : z + ((n-n_z)*step)*-1.618
projection_n3141 = sz ? na : z + ((n-n_z)*step)*-3.141
plot(title='0.0', series=projection, style=linebr, color=blue)
plot(title='-0.236', series=projection_n0236, style=linebr, color=gray)
plot(title='-0.382', series=projection_n0382, style=linebr, color=yellow)
plot(title='-0.500', series=projection_n0500, style=linebr, color=orange)
plot(title='-0.618', series=projection_n0618, style=linebr, color=red)
plot(title='-1.000', series=projection_n1000, style=linebr, color=black)
plot(title='-1.618', series=projection_n1618, style=linebr, color=maroon)
plot(title='-3.141', series=projection_n3141, style=linebr, color=aqua)
xel_arjona
a year ago
Interesting projection approach, I'm currently studying lot's of Gann research. If you'r interesting here are some interesting readings:
http://www.tradingfives.com/addenda.html

An interesting book:
http://www.amazon.com/The-Square-Spiral-Trevor-Casey/dp/1921681438

Cheers for your work Ricardo!
Reply
RicardoSantos PRO xel_arjona
a year ago
thx, will take a look when i got some time.
Reply
Hi. RicardoSantos. Does it repaint?

thank you for making this masterpiece :)
Reply
RicardoSantos PRO tlzkrh1029
12 days ago
@tlzkrh1029, it does while the higher timeframes arent closed at reversion points
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