Matboom

Monday range by Matboom

The "Monday Range" Pine Script indicator calculates and displays the lowest and highest prices during a specified trading session, focusing on Mondays. Users can configure the trading session parameters, such as start and end times and time zone. The indicator visually highlights the session range on the chart by plotting the session low and high prices and applying a background color within the session period. The customizable days of the week checkboxes allow users to choose which days the indicator should consider for analysis.

Session Configuration:
session = input.session("0000-0000", title="Trading Session")
timeZone = input.string("UTC", title="Time Zone")
monSession = input.bool(true, title="Mon ", group="Trading Session", inline="d1")
tueSession = input.bool(true, title="Tue ", group="Trading Session", inline="d1")
Users can configure the trading session start and end times and the time zone.
Checkboxes for Monday (monSession) and Tuesday (tueSession) sessions are provided.


SessionLow and SessionHigh Functions:
SessionLow(sessionTime, sessionTimeZone=syminfo.timezone) => ...
SessionHigh(sessionTime, sessionTimeZone=syminfo.timezone) => ...
Custom functions to calculate the lowest (SessionLow) and highest (SessionHigh) prices during a specified trading session.

InSession Function:
InSession(sessionTimes, sessionTimeZone=syminfo.timezone) => ...
Determines if the current bar is inside the specified trading session.

Days of Week String and Session String:
sessionDays = ""
if monSession
sessionDays += "2"
if tueSession
sessionDays += "3"
tradingSession = session + ":" + sessionDays
Constructs a string representing the selected days of the week for the session.

Fetch Session Low and High:
sessLow = SessionLow(tradingSession, timeZone)
sessHigh = SessionHigh(tradingSession, timeZone)
Calls the custom functions to obtain the session low and high prices.

Plot Session Low and High and Background Color for Session
plot(sessLow, color=color.red, title="Session Low")
plot(sessHigh, color=color.red, title="Session Low")
bgcolor(InSession(tradingSession, timeZone) ? color.new(color.aqua, 90) : na)

Script de código aberto

Dentro do verdadeiro espírito TradingView, o autor deste script publicou ele como um script de código aberto, para que os traders possam compreender e checar ele. Um viva ao autor! Você pode usá-lo gratuitamente, mas a reutilização deste código em uma publicação é regida pelas Regras da Casa. Você pode favoritá-lo para usá-lo em um gráfico.

Aviso legal

As informações e publicações não devem ser e não constituem conselhos ou recomendações financeiras, de investimento, de negociação ou de qualquer outro tipo, fornecidas ou endossadas pela TradingView. Leia mais em Termos de uso.

Quer usar esse script no gráfico?