PROTECTED SOURCE SCRIPT

ICT New Week Opening Gap

Zaktualizowano
Display the Current New Week Opening Gap (NWOG) on your Futures Market charts.

Disclaimer: this indicator is completely built from scratch, which is why not many features are added yet.
This indicator is 100% UNIQUE in the way that the NWOG remains accurately drawn on the chart, regardless of which chart settings are modified (for example, Settlement-as-Close, RTH/ETH, Back-Adjustment, etc.), unlike other NWOG plotting indicators.
Additionally, the NWOG can be plotted on a large variety of timeframes, from the Weekly chart, all the way down to the 1-second chart.

The NWOG is defined as Friday's closing price (e.g., at 4:59pm New York Time for ES1!) and Sunday's opening price (e.g., at 6:00pm New York Time for ES1!) on a new week.
This indicator draws a Box at these levels and extends it out in time to the most recent bar so that it can be visualized how price reacts to and gyrates around these levels.
Basically, the Box that is drawn on the chart by this indicator can be used as dynamic support & resistance levels. The actual price levels are shown at the top-right of the chart in a small table, for anyone wanting to remove the indicator and draw the levels themselves.
Only the current week's opening price and the previous week's closing price will be drawn on the chart.

snapshot
The indicator settings are only used to change the visuals such as box colors and text colors/size. The actual calculations are performed as mentioned above and cannot be changed by the Style/Settings Input.

Note: it is recommended to toggle ON the "Scale Price Chart Only" chart option if using auto-scaling on charts because TradingView by default will force indicator drawings to display on the chart area even if an NWOG is far away from the current price action.

This is a bare bones indicator (1st version) that will only draw the current NWOG. Future updates will add support for displaying historical NWOGs.
For support of additional markets or indicator settings/features, please leave a comment on this script.
Informacje o Wersji
  • Removed "futures" market restriction. This indicator can now be applied to other markets.
  • Updated NWOG label to show the date of the new week opening.
  • Do not show NWOG if the closing price and opening price are equal.
  • Added alternate version of NWOG to use Monday's RTH Opening price instead of Sunday's opening price.
  • Added option to show the 25%, 50%, and 75% levels of the NWOG.
Informacje o Wersji
With this release, the indicator displays up to 5 New Week Opening Gaps instead of only 1.
The table on the right displays the NWOG prices from most recent (top row) to oldest (bottom row).
Note: in the next update, the number of NWOGs to display will be configurable.

snapshot
This example shows the 5 most recent Actual NWOGs, with the "Use Actual Weekly Opening Price" option selected.

snapshot
In the chart above, the "Use Actual Weekly Opening Price" option is toggled OFF, so the indicator plots the first RTH opening of the week instead of the Sunday opening price.
  • Note: Regular Trading Hours (RTH) for the latest week had not begun yet, therefore only 4 of the 5 NWOGs are actually drawn on the chart (hence the opening price for the latest week being displayed as "N/A").


snapshot
As a tip/reminder, when the price data becomes too scrunched, you can enable Scale price chart only.
Informacje o Wersji
  • Display more details about a New Week Opening Gap (NWOG) by hovering over its text label (or hovering over its respective row in the Table).
  • Added toggle to show previous New Week Opening Gaps, up to 25 weeks ago.
  • Added option to hide the most recent New Week Opening Gap.
  • Easier to visualize the most recent NWOG by drawing it with a unique set of customizable colors.
  • Added option for hiding or showing the table containing the NWOG price levels (previously, it was permanently visible on the top-right).
  • Introduced the option for customizing the position, size, and colors of the Table.
  • Added the ability to hide or show specific NWOGs by typing a comma-separated list of integers.
  • Additional formatting options for things like Dates/Time Zones.


Besides the simple formatting Settings, the 3 Key Settings added in this release will be shown below:

snapshot
The number of NWOGs to show can now be configured under "Previous NWOGs". Note: this number does not include the current NWOG, so the total amount of NWOGs will always be + 1 (in this case, 12 + 1 = 13 NWOGs displayed).
The checkbox on the left can also be toggled OFF to quickly disable the previous NWOGs (which is the exact same effect as changing the numerical value to Zero).

snapshot
This is the same chart as shown previously, but now using the option to specifically choose which NWOGs to hide, using the "Overlap Handling" functionality. This can help clean the chart up if there are a lot of overlapping New Week Opening Gaps.
The comma-separated list uses the # of the NWOG, which can be found by either changing the settings to display the # on the label, or by hovering over the label (a pop-up will appear and the NWOG # will be shown at the top).
Note: for this to work, the "Choose a Strategy" drop-down must be changed to Custom, since it is None by default.
Also, if the drop-down in "Option 1" is switched from Hide to Show, then it would just flip the NWOGs that are currently hidden (in this example, only NWOG #s 6, 7, 8, and 13 would be shown if Show is selected in the drop-down).

snapshot
There is also the option to hide the current NWOG. This was not added for any particular reason. It's just there in case anybody wants to use it for whatever reason. Note: the price levels will still be visible in the table on the right, but the box won't be plotted on the chart.

Tip: if you make a lot of customizations to the indicator and wish to save it, you can use the "Save as default" option on the bottom-left drop-down of the Settings.

In summary, this release added much more customization options. Most are self-explanatory; for the ones that are not, be sure to look at the tooltips that are available in the Settings.
Informacje o Wersji
Added more options for filtering New Week Opening Gaps (NWOGs).

snapshot
Option 1: Gradients.
This option will not hide any NWOGs; it will only change the transparency of the previous NWOGs. The current NWOG (#1) will not be altered because it uses a different style. Starting from NWOG #2, the "Max" opacity percentage will be applied to it. Each subsequent NWOG will become more transparent, until it reaches the last NWOG which will have the "Min" opacity percentage that was specified.
This overlap handling strategy can be useful to focus your eye on the more recent NWOGs if there are multiple on the chart, because the older NWOGs will be less visible due to their increased transparency.

snapshot
Option 2: Hide nested NWOGs.
This option can help clean up the chart by hiding some of the NWOGs that may be nested within another NWOG. If an NWOG is "nested" within another, that means its high and low are fully contained inside of any other NWOG (these are the NWOGs that will be hidden in "Strict" mode). "Lenient" mode will consider multiple overlapping NWOGs to be a single range, and if any NWOG is nested within that single range, it will also be hidden.
In the example above, if "Lenient" mode were selected, it would additionally hide NWOG #8. This would occur because NWOGs #5, #8, and #12 are overlapping, therefore it would be considered a single range from the price of 5161.50 to 5225.50, which encapsulates the range of NWOG #8 (5166.50 to 5211.25).

snapshot
Option 3: Hide intersecting NWOGs.
This option is similar to the previous one, but it only requires NWOGs to have a single intersection point in order to be hidden from view. The drop-down allows choosing the priority of which NWOGs to hide. In the example above, "Oldest" is chosen in the drop-down, meaning that if some NWOGs are found to be intersecting, the indicator will begin hiding the older ones until there are no more intersecting NWOGs.
Regardless of the value chosen in the drop-down, the end result is that the chart will only display separated NWOGs, meaning that there will not be any NWOGs that overlap with each other.

snapshot
Option 4: Minimum and Maximum NWOG range.
This filtering option is pretty straightforward. It will just hide any NWOGs that are outside of the boundaries. In the example above, any NWOGs that are smaller than 5.00 points of range will be hidden, as well as any NWOGs that are larger than 30.00 points. For a reference of the width of the NWOGs that are currently on the chart, hover over its NWOG label or its table row; the width will be shown next to "Total Range".
Informacje o Wersji
Bug fixes:
  • Fix major bug mistakenly introduced in version 4.0 where in some scenarios, using NWOG - Regular (i.e., "Use Actual Weekly Opening Price" setting toggled OFF) would cause the script to fail.
  • Fix minor issue in coloring the price table when setting the previous NWOG border and background colors to 0% opacity on the slider, while using overlap handling Option 1 (gradients).
  • Adjusted anchor point for the NWOGs when using multi-day timeframes.
  • Allow historical NWOGs to be viewed when using Bar Replay.


The indicator was not functioning properly in Bar Replay (on the higher timeframes Daily/Weekly/Monthly).
This update includes some custom handling for Bar Replay scenarios, allowing older NWOGs to be anchored correctly on the chart.
snapshot
Note: this fix only applies to NWOG - Actual (i.e., when the input setting "Use Actual Weekly Opening Price" is toggled ON).
The script is not guaranteed to function correctly when using Bar Replay mode with the "Use Actual Weekly Opening Price" setting toggled OFF.
  • While it still may work fine in some scenarios, keep this warning in mind.
Informacje o Wersji
Updates:
  • Fixed minor text bug that was causing incorrect labeling of "NWOG High" or "NWOG Low" in some scenarios (in the tooltip when you hover over any NWOG text label).
  • Slightly improved Bar Replay support for NWOG - Regular (when the Use Actual Weekly Opening Price setting is toggled OFF).
  • Allow the Price Table size to be changed even when using the "Default Style" (via the drop-down next to the "Text" setting).
  • Added option to choose Monospace font for the NWOG text labels and/or the prices that are shown in the Table.
  • Added visual cues to the Price Table that shows which NWOGs are not plotted on the chart.
  • Restricted the 25% / 50% / 75% levels of NWOGs from being drawn on the chart for NWOGs that are too small (for example, if an NWOG is only 1 tick wide, there is no need to plot the middle point of that gap because the price won't even be able to print at that level).
  • Updated formatting of the price levels that are shown in the Price Table and the tooltips (example below).


Price Formatting:
snapshot
Updated the display of prices for charts that use the format of "120'31".
Previously, prices were converted to a string using "format.mintick". For Bond Futures, that may deceivingly show some NWOG closing/opening prices as being equal due to the prices losing precision after being rounded up or down. The new price format will allow displaying Bond Futures prices with better accuracy.

Markets with updated price formats:
  • Any market whose price scale does not use decimals. Example: ZW1!
  • Bond Yields that have a price scale showing percentages. Example: US30Y
  • Some Forex markets (shows gap widths in terms of pips in the pop-up tooltips). Example: USDJPY


Note: since going through each and every available market will not be humanly possible for me, I provided the option to switch back to the default format of displaying price levels, just in case there is any issue when using the updated format (change the Price Format drop-down to "Decimal").
Informacje o Wersji
  • Introduced new overlap handling strategy that lets you choose the number of weeks to extend an NWOG up to, rather than extending all NWOGs to the right-most candle on the chart.
  • Additional bug fixes related to anchoring NWOGs on multi-day timeframes (in some cases they would incorrectly be anchored 1 candle to the left of where it should have been).
  • Added an "info" tool at the bottom of the Price Table that will appear *only* when an overlap handling strategy is selected. By hovering over that new row in the table, it will show information related to the selected strategy and which NWOGs are being hidden from the chart. It can also give details about fixing invalid input settings.
Informacje o Wersji
  • Added customizable font styles for the NWOG labels as well as the prices displayed in the table.
  • Display Forex prices with a visually smaller pipette (last digit).
  • Improved informational/warning messages when using an overlap handling strategy (hover over the table row that says "🛈 𝖮𝗏𝖾𝗋𝗅𝖺𝗉 𝖧𝖺𝗇𝖽𝗅𝗂𝗇𝗀" to display the information tooltip text, when the 𝙎𝙚𝙡𝙚𝙘𝙩 𝙖 𝙎𝙩𝙧𝙖𝙩𝙚𝙜𝙮 drop-down has a value other than "None").
  • Updated warning messages when using Bar Replay mode due to some limitations (including some out of my control). Note: in some cases of a messed-up bar replay environment, the indicator may be able to automatically detect it and fail the script with a "Restart Bar Replay" error message.
  • New overlap handling strategy to only show the NWOGs that are within close proximity to the current market price.


snapshot
Close Proximity overlap handling: allows hiding NWOGs that may be too far out for them to be pertinent to current analysis.
In this example, only the NWOGs that are 0.51% above OR 0.51% below the market price 1.07108 will be displayed. In other words, it will show only the NWOGs within the price range: 1.06562 to 1.07654 (note: this detailed information is readily available in the "🛈 𝖮𝗏𝖾𝗋𝗅𝖺𝗉 𝖧𝖺𝗇𝖽𝗅𝗂𝗇𝗀" tooltip).

The proximity to current market price can be specified as either a percentage or an actual price distance (note: you can use TradingView's Measure tool to easily find a percentage or price distance that works for you).
Using this overlap handling strategy could also be useful for cases where NWOGs are too far away from current market action and cause the chart to be visually compressed when using auto-scale.
Informacje o Wersji
snapshot
Bug fix for Overlap Handling Tooltip when using Option 6: Close Proximity
There was an error in the calculations of the nearby/faraway NWOGs (the "reference" at the bottom of the tooltip).
Informacje o Wersji
Additional customization options

  • New checkbox setting "Show Zero-Width Gaps" to allow plotting NWOGs where the Sunday opening price is the same as the previous week's closing price; these can still be useful support/resistance levels even when there's no gap in price.
  • New setting "Bar Offset" that can be used to extend NWOGs to the right by a specified number of candles.
  • Added option of using dashed or dotted lines for NWOG box borders.
  • Line sizes can now be up to 4px; also introduced the ability to change size of the C.E. and Quadrant levels.
  • Additional date format options, including full month names.
Informacje o Wersji
Added the option to plot NWOGs using horizontal lines instead of rectangles.
Also added a filtering option to require previous NWOGs to be a minimum width in order to display the C.E. and Quadrant levels; this will allow reducing clutter on the chart.

snapshot
Example of using Lines for previous NWOGs instead of Boxes.
Informacje o Wersji
  • Fixed minor issue where selected Font type was not applied to the entire label text (when plotting NWOGs with Lines instead of Boxes).
  • Removed "Price Format" setting since no complaints have been received about incorrectly displayed prices.
  • Changed behavior: when increasing width of NWOG borders, it will no longer change the border width of the Price Table.
Informacje o Wersji
Improvements from User Feedback:
  • Split the "Minimum Gap Width for C.E / Quadrants" setting into 2 separate settings (one for C.E. and one for the Quadrants).
  • Increased the maximum limit for the "Bar Offset" setting.
Informacje o Wersji
Minor adjustment for plotting starting points of the New Week Opening Gaps.
Informacje o Wersji
Moved to Pine Script v6

Additional minor changes:
  • Text Labels: using the new built-in 𝗯𝗼𝗹𝗱 & 𝘪𝘵𝘢𝘭𝘪𝘤 text formatting. Also added the 𝕕𝕠𝕦𝕓𝕝𝕖-𝕤𝕥𝕣𝕦𝕔𝕜 font option.
  • Price Table: added the 𝘪𝘵𝘢𝘭𝘪𝘤 and 𝕕𝕠𝕦𝕓𝕝𝕖-𝕤𝕥𝕣𝕦𝕔𝕜 font options.
  • Text Size: larger variety of text sizes to choose from.
  • Date Format: additional date format options including DD/MM format.
  • Timezone: larger variety of timezones to choose from.
  • Using 12-hour format to display NWOG start & end times (within the pop-up tooltips) instead of the 24-hour format
gapictictconceptsinnercircletradernewweekopeningnwogsundaygapsundayopenSupport and Resistance

Skrypt chroniony

Ten skrypt został opublikowany z zamkniętym kodem źródłowym i możesz z niego dowolnie korzystać. Możesz go dodać do ulubionych, żeby używać go na wykresie. Nie możesz przeglądać ani modyfikować jego kodu źródłowego.

Chcesz użyć tego skryptu na wykresie?

Wyłączenie odpowiedzialności