High Volume Day – VWAP lines

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #238074 quote
    trwcapital
    Participant
    New

    I’m trying to create an indicator that looks back x number of bars on the daily chart for days where volume exceeded y threshold, or just identify the top 3-5 volume days and then draws a horizontal line on the daily chart that also displays on inferior timeframes. A bonus would be to add text to the line for the date and shares traded on that day. Any help would be appreciated.

    #238081 quote
    robertogozzi
    Moderator
    Master

    There you go:

    DEFPARAM DrawOnLastBarOnly = true
    Bars     = 50
    Treshold = 50000
    Vol1     = 0
    Vol2     = 0
    Vol3     = 0
    Bar1     = 0
    Bar2     = 0
    Bar3     = 0
    FOR i = 0 TO (Bars - 1)
       IF Volume[i] > Treshold THEN
          IF (Volume[i] > Vol3) THEN
             Vol1 = Vol2
             Bar1 = Bar2
             Vol2 = Vol3
             Bar2 = Bar3
             Vol3 = volume[i]
             Bar3 = i
          ELSIF Volume[i] > Vol2 THEN
             Vol1 = Vol2
             Bar1 = Bar2
             Vol2 = volume[i]
             Bar2 = i
          ELSIF Volume[i] > Vol1 THEN
             Vol1 = volume[i]
             Bar1 = i
          ENDIF
       ENDIF
    NEXT
    IF Vol1 THEN
       yy     = OpenYear[Bar1] MOD 100   //drop Centtury
       mm     = OpenMonth[Bar1]
       dd     = OpenDay[Bar1]
       Offset = highest[Bars](high) + range*0.5
       DrawText("#yy##mm##dd#v#Vol1#",BarIndex[Bar1],offset)
    ENDIF
    IF Vol2 THEN
       yy     = OpenYear[Bar2] MOD 100  //drop Centtury
       mm     = OpenMonth[Bar2]
       dd     = OpenDay[Bar2]
       Offset = highest[Bars](high) + range*1
       DrawText("#yy##mm##dd#v#Vol2#",BarIndex[Bar2],offset)
    ENDIF
    IF Vol3 THEN
       yy     = OpenYear[Bar3] MOD 100  //drop Centtury
       mm     = OpenMonth[Bar3]
       dd     = OpenDay[Bar3]
       Offset = highest[Bars](high) + range*1.5
       DrawText("#yy##mm##dd#v#Vol3#",BarIndex[Bar3],offset)
    ENDIF
    RETURN

    It only prints some text for the highest 3 volume values > treshold in the last BARS periods, where exactly do you want the lines to be plotted?

    trwcapital and Iván González thanked this post
    #238083 quote
    robertogozzi
    Moderator
    Master

    All graphical objects and text are only visible on the chart  where the indicator has been added. Only PRT tools can plot objects than can be made visible in other timeframes.

    trwcapital thanked this post
    #238111 quote
    trwcapital
    Participant
    New

    This is great. I want the horizontal line to be drawn at the Typical Price on the identified days. I use this more on small cap stocks that trade wildly varying amounts of volume. By identifying where the “VWAP” (or typical price) is on prior high volume days, it helps me to identify where supply might come into play.

    Thank you!

    #238112 quote
    trwcapital
    Participant
    New
    DEFPARAM DrawOnLastBarOnly = true
    Bars     = 504
    Threshold = 1000000
    Vol1     = 0
    Vol2     = 0
    Vol3     = 0
    Bar1     = 0
    Bar2     = 0
    Bar3     = 0
    FOR i = 0 TO (Bars - 1)
    IF Volume[i] > Threshold THEN
    IF (Volume[i] > Vol3) THEN
    Vol1 = Vol2
    Bar1 = Bar2
    Vol2 = Vol3
    Bar2 = Bar3
    Vol3 = volume[i]
    Bar3 = i
    ELSIF Volume[i] > Vol2 THEN
    Vol1 = Vol2
    Bar1 = Bar2
    Vol2 = volume[i]
    Bar2 = i
    ELSIF Volume[i] > Vol1 THEN
    Vol1 = volume[i]
    Bar1 = i
    ENDIF
    ENDIF
    NEXT
    
    // Handle Bar1
    IF Vol1 THEN
    yy     = OpenYear[Bar1] MOD 100   // Drop century
    mm     = OpenMonth[Bar1]
    dd     = OpenDay[Bar1]
    Offset = ((DLow(Bar1) + DHigh(Bar1) + DClose(Bar1)) / 3) + ((DHigh(Bar1) - DLow(Bar1)) / 8)
    DrawText("#mm#/#dd#/#yy#- #Vol1#", BarIndex[Bar1] - 15, Offset) ANCHOR(left, INDEX, VALUE)
    DRAWHLINE((DLow(Bar1) + DHigh(Bar1) + DClose(Bar1)) / 3)
    ENDIF
    
    // Handle Bar2
    IF Vol2 THEN
    yy     = OpenYear[Bar2] MOD 100   // Drop century
    mm     = OpenMonth[Bar2]
    dd     = OpenDay[Bar2]
    Offset = ((DLow(Bar2) + DHigh(Bar2) + DClose(Bar2)) / 3) + ((DHigh(Bar2) - DLow(Bar2)) / 8)
    DrawText("#mm#/#dd#/#yy#- #Vol2#", BarIndex[Bar2] - 15, Offset) ANCHOR(left, INDEX, VALUE)
    DRAWHLINE((DLow(Bar2) + DHigh(Bar2) + DClose(Bar2)) / 3)
    ENDIF
    
    // Handle Bar3
    IF Vol3 THEN
    yy     = OpenYear[Bar3] MOD 100   // Drop century
    mm     = OpenMonth[Bar3]
    dd     = OpenDay[Bar3]
    Offset = ((DLow(Bar3) + DHigh(Bar3) + DClose(Bar3)) / 3) + ((DHigh(Bar3) - DLow(Bar3)) / 8)
    DrawText("#mm#/#dd#/#yy#- #Vol3#", BarIndex[Bar3] - 15, Offset) ANCHOR(left, INDEX, VALUE)
    DRAWHLINE((DLow(Bar3) + DHigh(Bar3) + DClose(Bar3)) / 3)
    ENDIF
    
    RETURN
    

    Made a few changes and will probably continue to tweak but you helped immensely. Thank you

    robertogozzi thanked this post
Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.

High Volume Day – VWAP lines


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
trwcapital @trwcapital Participant
Summary

This topic contains 4 replies,
has 2 voices, and was last updated by trwcapital
1 year, 4 months ago.

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 09/26/2024
Status: Active
Attachments: 1 files
Logo Logo
Loading...