RicardoSantos

[RS]PA Zigzag Fibonacci FAN V0

EXPERIMENTAL:
fan projection from zigzag .
Eliminar de Scripts favoritos. Añadir a Scripts favoritos.
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)
Is it possible to add an alert for when a new fan starts?
Responder
Hi Ricardo:

Where the variable n comes from in: n_z = valuewhen(sz, n, 0) as I dont see it been declared.
Thanks.
+2 Responder
@RicardoSantos

Request:

Ability to only show the most recent fan. For example, if I set the time frame of the indicator to 1 hour, it would be great it only the current fan that is currently being drawn is shown. Having the option to choose this in the settings would be really great, if possible, and if you are willing! Thanks.
+2 Responder
@stockspy, thats not possible to do, its a restriction on how pinescript works.
Responder
stockspy RicardoSantos
@RicardoSantos, oh ok thank. Thanks for letting me know.
Responder
stockspy stockspy
@stockspy, I really like the script and enjoy many of your stuff
Responder
stockspy RicardoSantos
@RicardoSantos, I really like the script and enjoy many of your stuff
+1 Responder
And I am guessing the number of times that it repaints will depend on the market itself, but will be interesting to see how often it really does repaint, or if it can handle fluctuations without repainting immediately.
Responder
This is quite amazing. If only wanting to use it as minimally as possible, it appears to be useful in directing you as to which overall direction the market is trending (the fan is fanning upwards in an uptrend, and fanning downwards in a downtrend). I've noticed days where the market could surge upwards during the day, but the overall fan stays pointed downwards, and the market ultimately lowers back down at least a bit from it's intraday high.

Although, I haven't witnessed this yet during live trading, since I just found this great scipt, so looking forward to that!
Responder
Hi. RicardoSantos. Does it repaint?

thank you for making this masterpiece :)
Responder
Inicio Analizador de acciones Analizador de Forex Crypto Screener Calendario económico Shows Cómo funciona Funcionalidades del gráfico Precios Normas Moderadores Soluciones broker y sitio web Widgets Soluciones gráficas Biblioteca de gráficos ligeros Centro de ayuda Recomendar a un amigo Solicitud de funcionalidad Blog y Noticias Preguntas frecuentes Wiki Twitter
Perfil Opciones de configuración del perfil Cuenta y facturación Recomendar a un amigo Mis Tickets de Soporte Centro de ayuda Ideas publicadas Seguidores Siguiendo Mensajes privados Chat Cerrar sesión