wintonbanks

B A N K $ - Opening Lines / Daily Separators

wintonbanks 已更新   
This is a simple indicator that aids the trader in being able to visualise each trading day of the week;

Key Features
  • Weekly Open Line
  • Daily Open Line
  • Option for Background Lines



Weekly & Daily Open Lines
Information ℹ️
These are vertical lines that are anchored to the hour of the Weekly Open and the hour of each Daily Candle Open. The settings are customisable, allowing to you edit the Width, Style & Colour. You can also select Monday as the Weekly Open if Monday is a no-trade day for you.

Settings ⚙️
1h Toggle - by default Daily Open Lines are only visible under the 1h, you can select to also make them visible on the 1h.
Background Lines - you can replace the chart lines with background lines, this can improve performance and allow you to load more lines on the chart when going back in price.
Show Days of Week - this prints the current day on the chart.
發布通知:
New Features
  • Show Week Separator on 4h Chart
  • Show Only Last 2 Weekly Opens
  • Weekly & Daily Line Offset



Show Week Separator on 4h Chart
This is a toggle option that allows you so show Week Separators on the 4h chart. By default all vertical lines are invisible on any timeframe above the 1h. This toggle is disabled by default.
user_show_on_4hour = input(title='Show Week Separator on 4h Chart', defval=false, group="Weekly Open", tooltip="Week Separators are only shown on timeframes higher than 4h by default.")

Show Only Last 2 Weekly Opens
I have added this option to make only the last 2 weekly opens visible, I have added this to make the charts more minimalistic if desired by the trader.
show_last_two_weekly_opens = input(title='Show Only Last 2 Weekly Opens', defval=false, group="Weekly Open")

Weekly & Daily Line Offset
The original code only worked on instruments that had 24 hourly candles within the day. Instruments like DXY or XAUUSD wouldn't show the lines. I have added an offset option for both the Weekly & Daily lines to allow the trader to adjust the hour the lines are anchored to, this allows you to adjust the lines and make them visible across all instruments.
week_offset_hours = input.int(title="Weekly Line Offset", defval=0, minval=-23, maxval=23, group="Weekly Open", tooltip="Sometimes the lines aren't visible when the pair has less than 24 hourly candles. Increase this option until the lines show. (DXY = 1)")
day_offset_hours = input.int(title="Daily Line Offset", defval=0, minval=-23, maxval=23, group="Daily Open", tooltip="Sometimes the lines aren't visible when the pair has less than 24 hourly candles. Increase this option until the lines show. (DXY = 3)")
(I have changed isStartTime to adjusted_new_day_start_time and made some adjustments to the code to allow the trader to offset the lines)
發布通知:
New Feature
  • Show Daily Close

Information ℹ️
This adds a new toggle option that displays a vertical line at the current days closing price so you can visualise how long until the end of the current trading day.

This is the code that adds the toggle option to the settings list
show_future_close = input(title='Show Daily Close', defval=true, group="Daily Open")

This is the code that ensures the Daily Close line is shown on timeframes under the 1h unless the 'Show Day Separator on 1h Chart' is selected. This code also calculates where the line is displayed. By default it is set to the hour that the Daily candle closes / a new one opens
// Show future lines for the current day's close at 17:00 ahead of the current price
if show_future_close and (timeframe.period != '60' or user_show_on_1hour) and timeframe.period != '120' and timeframe.period != '240' and timeframe.period != '180' and timeframe.period != '360' and not timeframe.isdwm
    var line future_day_line = na
    if not na(future_day_line)
        line.delete(future_day_line)
    future_close_time = timestamp(year, month, dayofmonth + (hour >= 17 ? 1 : 0), 17, 0)
    future_bar_index = bar_index + int((future_close_time - time) / (1000 * 60 * timeframe.multiplier))
    if time < future_close_time
        future_day_line := line.new(future_bar_index, 0, future_bar_index, 1, extend=extend.both, color=day_line_color, style=day_line_style, width=dayLineWidth)
發布通知:
New Features
  • Show Weekly Close
  • Tidied up the Settings + Code

Show Weekly Close
This adds a new toggle option that allows you to see the current week close. Below is the additional code for this;
show_weekly_close = input(title='Show Weekly Close', defval=true, group="Weekly Open", inline="wk")
// Show future lines for the weekly close at 17:00 on Sunday ahead of the current price
if show_weekly_close and (timeframe.period != '240' or user_show_on_4hour) and not timeframe.isdwm
    var line future_week_line = na
    if not na(future_week_line)
        line.delete(future_week_line)
    future_week_close_time = timestamp(year, month, dayofmonth + (6 - dayofweek) % 7 + (hour >= 17 and dayofweek == dayofweek.saturday ? 6 : 0), 17, 0)
    future_week_bar_index = bar_index + int((future_week_close_time - time) / (1000 * 60 * timeframe.multiplier))
    if time < future_week_close_time
        future_week_line := line.new(future_week_bar_index, 0, future_week_bar_index, 1, extend=extend.both, color=week_line_color, style=week_line_style, width=weekLineWidth

I have also tidied up the code to make the settings page tidy & minimal.

開源腳本

本著真正的TradingView精神,該腳本的作者將其開源發布,以便交易者可以理解和驗證它。為作者喝彩吧!您可以免費使用它,但在出版物中重複使用此代碼受網站規則的約束。 您可以收藏它以在圖表上使用。

免責聲明

這些資訊和出版物並不意味著也不構成TradingView提供或認可的金融、投資、交易或其他類型的意見或建議。請在使用條款閱讀更多資訊。

想在圖表上使用此腳本?