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)

开源脚本

本着真正的TradingView精神,该脚本的作者将其开源发布,以便交易者可以理解和验证它。为作者喝彩!您可以免费使用它,但在出版物中重复使用此代码受网站规则的约束。 您可以收藏它以在图表上使用。

免责声明

这些信息和出版物并不意味着也不构成TradingView提供或认可的金融、投资、交易或其它类型的建议或背书。请在使用条款阅读更多信息。

想在图表上使用此脚本?