בחירות העורכים
OPEN-SOURCE SCRIPT

Volume-based Support & Resistance Zones

מעודכן
The new and improved Support & Resistance Zones indicator is here. This indicator is based on high volume at fractal lows or fractal highs with the zones based on the size of the wick for that timeframe’s candle.
This helps traders visualize which price levels are of the most significance for either reversals or continuation of the trend when zones are broken and then re-tested.

Original script is thanks to synapticex and additional modifications is thanks to Lij_MC. Credit to both of them for most of the logic behind this script.
Since then I have made many changes to this script as noted below:

  • Changed default S/R lines from plots to lines, and gave option to user to change between solid line, dashed line, or dotted line for both S/R lines.
  • Added additional time frame and gave more TF options for TF1 other than current TF. Now you will have 4 time frames to plot S/R zones from.
  • Gave user option to easily change line thickness for all S/R lines.
  • Made it easier to change colors of S/R lines and zones by consolidating the options under settings (rather than under style).
  • Added extensions to active SR Zones to extend all the way right.
  • Added option to extend or not extend the previous S/R zones up to next S/R zone.
  • Added optional time frame labels to active S/R zones, with left and right options as well as option to adjust how far to the right label is set.
  • Fixed issue where the higher time frame S/R zone was not properly starting from the high/low of fractal. Now any higher time frame S/R will begin exactly at the High/Low points. Note that this may not work perfectly on stocks and if a fractal high/low is too many bars in the past, it will revert to a default max bars back to avoid script errors.
  • Added to script a function that will prevent S/R zones from lower time frames displaying while on a higher time frame. This helps clean up the chart quite a bit.
  • Created arrays for each time frame's boxes and lines so that the number of S/R zones can be controlled for each time frame and limit memory consumption.
  • New alert options added and customized alert messages.


- The way this indicator works is it looks for fractal highs or fractal lows with volume that pierces above the volume's Moving Average. This moving average value can be modified in the settings for each time frame.
- The fractal highs will be confirmed with 3 successive higher highs followed by 2 successive lower highs and vice versa for the fractal lows.
- The zone is created from the fractal high/low and the close of the candle for whatever time frame you selected. The bigger the zone, the more significant that zone is.
- You can disable any zone, change the zones to show lines only, and modify all the colors, transparencies, and thickness of lines for all the zones.
- To create alerts, you first want to enable the types of alerts you want for each time frame in the indicator's settings. Then after you apply changes, right click on one of the zones on the chart, and click "Add Alert on Vol S/R Zones". You do not need to add a title as the correct alert messages are already built-in.
- More changes will be coming in the future!

I hope you find this indicator useful, if so please give it a thumbs up!
If you have any suggestions or features you would like to see, just let me know in the comment section. Thanks and enjoy!
הערות שחרור
  • Migrated script to Pine Script Version 5.
  • Added higher number of total boxes/lines to show on chart.
  • Increased the max bars count to the maximum pine script allows, this way we can utilize as many bars as possible when drawing the left side of SR zones that are very far back on the chart.
  • Fixed issue where indicator would not load on 1 minute and 3 minute charts unless higher time frame SR zones were set to lower time frame. Now every time frame combination will work and there will be no loading issues regardless of how low chart time frame is.
  • Fixed the issue where boxes/lines/labels were being loaded twice when chart time frame was the same as one of the time frames manually selected in settings. This issue also resulted in time frame labels showing 4h/4h for example. Now it will only draw one zone and one label if chart time frame is same as one selected in settings.
  • Rescripted the way bar_index loads for stocks using a much more efficient method, changing the number of hours in a day, days in a week, and days in a month for only stocks charts under the f_resInMinutes() calculation.
  • Consolidated most of the script to reduce the total number of lines of code.


To apply the update, please remove the existing indicator on your chart, then re-add it and it should reflect the updated version of this indicator!
הערות שחרור
Minor update to address bug with labels.
הערות שחרור
- Daily labels were showing up incorrectly on stocks charts on certain time frames due to recent update on f_resInMinutes. Now it should correctly display "D" for daily time frame.
- In rare instances where the candle open is exactly the same value as candle close on a pivot high or low, the script was drawing the FractalUpZones/FractalDownZones from the previous zones instead of placing it on the candle open/close. This has now been fixed. Thank you to Linktind for spotting this bug!
- Please re-attach indicator to your chart to apply update, and make sure the source code says it is set to version 4.0!
הערות שחרור
Added (S) and (R) to the time frame labels to indicate if the zone is Support or Resistance
הערות שחרור
Version 6.0
  • Added index charts to calculation for aligning left side of SR zone properly.
  • Removed all boxes and their arrays, using pine script's new linefill() feature instead.
הערות שחרור
  • Added new alerts for each time frame: You can now receive an alert as soon as a new S/R zone is formed.
  • In response to the many comments from people who thought the indicator wasn't working on certain symbols, I have decided to add warning label to chart if the symbol does not have volume data.


Make sure to remove existing SR indicator and re-apply this to see the update. Revision # should be set to 7 in pine editor, then add to chart.
הערות שחרור
Minor fix to new alerts for current time frame. Changed message from showing "Chart" to now showing the actual time frame of chart TF when alert was made.

Make sure indicator is now set to Revision 8.0 in Pine Editor, then add to chart and remove old one. You will also need to re-apply any existing alerts to reflect changes.
הערות שחרור
  • Added more time frame options for each zone.
  • Functionalized most of the script to make it more compact and easier to apply any new changes/features in the future.
    Major updates:
  • Re-scripted the calculations for identifying the correct bar index for left side of higher time frame zones. Instead of estimating how many bars back to scan for high/low (which caused many issues on stock and futures charts), the exact bar index is returned which allows the zones to be perfectly aligned to the high/low on every type of chart no matter what the session hours are for that asset.
  • Added user option to select the number of SR zones back to display on the chart for each time frame. This option is going to be especially useful when using the feature described next.
  • Added option to extend all S/R Zones all the way to the right. This feature is best utilized with only one of the time frames enabled, and also by limiting how many historical zones are displayed as they will all be extended right.

Below is an example of how this feature can be used. This is a daily chart with only the weekly time frame zones enabled, and limited to 5 zones back. Normally without this feature, when a new SR zone is found, the older zones do not extend all the way right despite the fact that those older SR zones can still be very powerful and reliable to trade off of. This becomes especially apparent when viewing charts on mobile devices, where you would have to manually scroll left to find those older zones. Now you will be able to easily see the older zones extend across the chart.
תמונת-בזק

To get these updates, delete and re-add the indicator to your chart, and make sure that Revision number is set to 9.0 in Pine Editor.

Enjoy!
הערות שחרור
Added the option to extend all historical S/R zones to the right for each time frame individually, instead of one setting for all as it was previously.
הערות שחרור
  • Fixed bug that caused "Pine cannot determine the referencing length of a series" error.
  • Added new option to settings "Extend active S/R Zones to Right".
    - Now you can uncheck this for a cleaner chart if you'd like. First picture below shows an example with this option unchecked, and with label location also changed to "Left".
  • Added new option to settings "Show High/Low Line" and "Show Open/Close Line".
    - This gives you the option to only show the top or bottom line of each zone. See the second picture below for an example with only the "Show High/Low Line" option enabled.

תמונת-בזק

תמונת-בזק

Revision number in Pine Editor should be set to 11.0
הערות שחרור
Fixed another bug with candle referencing on higher time frame zones.
Revision # should now be 12.0 (check in Pine Editor after re-attaching indicator to chart)
הערות שחרור
Minor update
הערות שחרור
Minor Update: Added 1 minute and 12 month time frames to settings per user request.
Demand Zonemulti-timeframeSupply ZoneSupport and ResistanceVolume

סקריפט קוד פתוח

ברוח TradingView אמיתית, מחבר הסקריפט הזה פרסם אותו בקוד פתוח, כך שסוחרים יוכלו להבין ולאמת אותו. כל הכבוד למחבר! אתה יכול להשתמש בו בחינם, אבל השימוש החוזר בקוד זה בפרסום כפוף לכללי הבית. אתה יכול להכניס אותו למועדפים כדי להשתמש בו בגרף.

רוצה להשתמש בסקריפ זה בגרף?

כתב ויתור