RicardoSantos

[RS]Temporal Median Price V1

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.
Usuń z Ulubionych Skryptów Dodaj do Ulubionych Skryptów
//@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)

Komentarze

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.
Odpowiedz
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
Odpowiedz
Strona główna Skaner akcji Skaner Forex Skaner Krypto Kalendarz ekonomiczny Jak to działa Funkcje wykresów Cennik Poleć przyjaciela Dobre Praktyki Centrum Pomocy Rozwiązania internetowe i brokerskie Widżety Wykresy Lekka Biblioteka Wykresów Blog i wiadomości Twitter
Profil Ustawienia profilu Konto i płatności Poleceni znajomi Monety Wiadomości do działu obsługi Centrum Pomocy Opublikowane Pomysły Obserwujący Obserwujesz Wiadomość prywatna Czat Wyloguj