VWAP Boulevard [vnhilton]

vnhilton מעודכן   
The idea of this indicator comes from traders identifying supply to mainly look for shorts. Scenarios would be gap ups or pump & dumps where huge volume is transacted, & bag-holders are present. Some traders would draw resistance lines, I myself used to draw supply zones using the volume profile on that day, & others used the day VWAP on those days. VWAP Boulevard (I believe the name comes from the trader named team3dstocks) draws day VWAP lines from the highest volume days for a given period (excluding the current day).

- Draws horizontal & vertical lines from up to 250 highest volume days out of up to 3568 days, with the ability to hide either of these lines, their thicknesses, styles
- Extend/cut horizontal lines, or extend them all the way to the right
- Show the day VWAP, volume & age for these days in labels, with the ability to show what information you want to see only
- Separate customizable color forms for the lines & labels - ordinary (1 color); volume (2 color gradient from lowest to highest volume of the highest volume days); age (2 color gradient from youngest to oldest volume of the highest volume days)
- Edit offset & size of labels, & hide them
- Hide vertical lines

From left to right: Age color; ordinary color; volume color

250 highest volume days in the past year. Very messy so it's very likely you won't be using this but the ability to draw lines from 250 highest volume days is there if needed

- This indicator will only on the daily timeframe (error message will show up if unaware of this, & can be toggled off). Unfortunately, this would mean you would have to draw the lines manually yourself if you wish to use them on intraday timeframes.
- You may also encounter the 'Pine cannot determine the referencing length of a series. Try using max_bars_back' error. This occurs when the lookback period is very high & the indicator attempts to recalculate I believe. If this happens then reload the indicator.

The logic I used to obtain the highest volume days were to put all of the volume days in a given period in 1 array, then to sort them from highest to lowest, & also store their sorted indices in an separate array as well, so that drawings for each volume day could be done from the 2 arrays.

//Volume for last N periods
    var int [] pastVol = array.new_int(lookbackPeriodFixed)

    for i = 0 to lookbackPeriodFixed - 1
        array.set(pastVol, i, int(volume[i + 1]))

    sortedIndices = array.sort_indices(pastVol, order.descending)   //All Indices of sorted volume from highest to lowest
    sortedIndices2 = array.slice(sortedIndices, 0, highestVolDays)  //Indices of sorted volume from highest to lowest

    array.sort(pastVol, order.descending)                           //All Volume sorted from highest to lowest
    pastVol2 = array.slice(pastVol, 0, highestVolDays)              //Volume sorted from highest to lowest

    for i = 0 to highestVolDays - 1

        index := array.get(sortedIndices, i)
        vol   := array.get(pastVol,       i)

Since these array sizes were determined from the lookback period, it would mean that the function used to obtain daily values on intraday timeframes wouldn't work for a lookback period >20 (20 * 2 values I believe, which are the day VWAP & the day volume) as TradingView has put a maximum amount of calls of 40 in 1 script. Therefore, for intraday plots to work I would have to change the logic for getting the day VWAP & day volume for the highest days, as the function doesn't work on for loops, & this would also mean that the user would only be able to draw lines from up to 20 highest volume days instead of 250. I couldn't go forward with this as I wasn't able to find the logic to pick the highest volume days & their day VWAPs & times (indexes) without using a for loop. If anyone has any solutions (including for the 'Pine cannot determine the referencing length of a series. Try using max_bars_back' error) then please let me know. I've also left commented-out code for dealing with intraday drawings for future use.
הערות שחרור:
-Added minimum volume filter which will exclude days that have less volume than the value set by the user.

Left shows indicator showcasing 10 highest volume days in the past year with no minimum volume filter. Right shows indicator with the same settings as shown on Left, but with minimum volume filter of 5000000. (Note colors don't update since I haven't coded the solution to that problem. )
הערות שחרור:
- Added format.volume to display volume in a clear way e.g. 5,600,000 into 5.6M
הערות שחרור:
- Fixed minor issue regarding volume formatting.
סקריפט קוד פתוח

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

כתב ויתור

המידע והפרסומים אינם אמורים להיות, ואינם מהווים, עצות פיננסיות, השקעות, מסחר או סוגים אחרים של עצות או המלצות שסופקו או מאושרים על ידי TradingView. קרא עוד בתנאים וההגבלות.

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