RicardoSantos

[RS]Temporal Median Price V1

876 vizualizações
62
EXPERIMENTAL: previous custom time window median price and current time window open price in a neat package :p
(JeanLouisHardy) added option for bar count system, also added a donchian average.
Remover dos scripts favoritos Adicionar aos scripts favoritos
//@version=2
study(title='[RS]Temporal Median Price V1', shorttitle='TMP', overlay=true)
//  ||  Functions:
f_donchian(_window)=>avg(highest(_window), lowest(_window))
//  ||-----------------------------------------------------------------------------------------------------------------------------------------------------------||
USE_TF_OR_BAR = input(title='Use timeframe or bar count based system?', type=bool, defval=true)
//  ||  Timeframe based:
timewindow = input("3M")
topen = not USE_TF_OR_BAR ? na : security(tickerid, timewindow, open)
tmedian = not USE_TF_OR_BAR ? na : security(tickerid, timewindow, hl2[1])
plot(title='', series=tmedian, color=(tmedian != tmedian[1] ? na : black), linewidth=2)
plot(title='', series=topen, color=(topen != topen[1] ? na : black), linewidth=1)
//  ||  
window = input(title='Time window in bars:', defval=15)

counter = USE_TF_OR_BAR ? na : na(counter[1]) ? 0 : counter[1] >= window ? 0 : change(n) != 0 ? counter[1] + 1 : counter[1]

m_open = USE_TF_OR_BAR ? na : na(m_open[1]) ? open : counter == 0 ? sma(open, window) : m_open[1]
m_hl2 = USE_TF_OR_BAR ? na : na(m_hl2[1]) ? hl2 : counter == 0 ? sma(hl2[1], window) : m_hl2[1]
m_donchian = USE_TF_OR_BAR ? na : na(m_donchian[1]) ? hl2 : counter == 0 ? f_donchian(window) : m_donchian[1]
plot(title='', series=m_open, color=change(m_open)!=0?na:black)
plot(title='', series=m_hl2, color=change(m_hl2)!=0?na:blue)
plot(title='', series=m_donchian, color=change(m_donchian)!=0?na:red)

Comentários

sir i am new to pine scripting can you help in modifying your scrip to get below output.

9:15-10:15 am is MB time.
MB high - MB low= MB
T1=1/2MB
T2=MB,T3=1.5 MB and T4 is 2MB.Buy when candle cuts MBH.Sell when candle cuts MBL.
Resposta
SIr can u plz modify the code to provide below case

15minute high -(minus) 15minute low= Median value

15minute high-Median value= median points

BuyT1= 15minute high+median points
BuySL= 15minute high-median points

sell T1=15minute low-median points
sell SL=15minute low+median points

and plot these levels on chart
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