RicardoSantos

[RS]Modified McClellan Oscilator Candles V0

346 vizualizações
28
EXPERIMENTAL: for evaluation.
Update: added candles/signal ma and options.
still didnt incorporate nyse adv /dec index's.
Remover dos scripts favoritos Adicionar aos scripts favoritos
study(title="[RS]Modified McClellan Oscilator Candles V0")
//  ||----------------------------------------------------------------------------------------------------------------------------
//  source: http://stockcharts.com/school/doku.php?id=chart_school:technical_indicators:mcclellan_oscillator
//  Ratio Adjusted Net Advances (RANA): (Advances - Declines)/(Advances + Declines)
//
//    McClellan Oscillator: 19-day EMA of RANA - 39-day EMA of RANA
//
//  19-day EMA* = (Current Day RANA - Prior Day EMA) * .10 + Prior Day EMA)
//  39-day EMA* = (Current Day RANA - Prior Day EMA) * .05 + Prior Day EMA)
//
//  * The first EMA calculation is a simple average. 
//  ||----------------------------------------------------------------------------------------------------------------------------
fast_length = input(title='EMA - Fast Length:', type=integer, defval=19)
slow_length = input(title='EMA - Slow Length:', type=integer, defval=39)
USE_RANA = input(title='Use Ratio Adjustment Net Advancement:', type=bool, defval=true)
SHOW_SIGNAL = input(title='Show Lines:', type=bool, defval=true)
smooth_length = input(title='Smooth Signal Length:', type=integer, defval=4)

advance = cum(close > open ? close - open : 0)
decline = cum(close < open ? open - close : 0)

adv_dec = USE_RANA ? ((advance-decline)/(advance+decline)) : change(close)
ma_fast = ema(adv_dec, fast_length)
ma_slow = ema(adv_dec, slow_length)

mcl_osc = ma_fast-ma_slow

signal_slow = sma(mcl_osc, smooth_length)
signal_slower = sma(mcl_osc, smooth_length*2)

palete = mcl_osc >= signal_slow ? lime : red
plotcandle(signal_slow, mcl_osc, mcl_osc, signal_slower, color=palete, wickcolor=gray)

plot(not SHOW_SIGNAL ? na : mcl_osc, color=mcl_osc>0?green:mcl_osc<0?maroon:gray, editable=true)
hline(0, color=black, editable=true)

signal = not SHOW_SIGNAL ? na : sma(mcl_osc, smooth_length)
plot(not SHOW_SIGNAL ? na : signal, color=black, linewidth=2, editable=true)

Comentários

Could you make the line that weave on top and bottom thicker and fuchsia? Also green/buy and red/sell arrows would be great. Just an idea Thanks for your work!
Resposta
the line can be customized on the options, arrows can be added later
Resposta
fabfoot RicardoSantos
I tried to modify the line under the options and it only changed the color on a small segment of it. I am no script writer so it is probably my lack of knowledge. Any suggestions? Looking forward to you adding the arrows. Thanks for the reply.
Resposta
theres 3 color swatchs you need to change: green / maroon / grey colors, because it has a conditional statement.
Resposta
ic
Resposta
Início Rastreador de Fundamentos Rastreador Forex Rastreador de Criptomoedas Calendário Econômico Como Funciona Recursos gráficos Preços Indique um Amigo Regras da Casa Central de Ajuda Soluções para Sites & Corretoras Widgets Soluções em Gráficos Biblioteca de Gráficos Lightweight Blog & Notícias Twitter
Perfil Configurações de perfil Conta e Cobrança Amigos indicados Moedas Meus Tíquetes de Suporte Central de Ajuda Ideias Publicadas Seguidores Seguindo Mensagens Privadas Conversa Deslogar