Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Intrabar VWAP

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Intrabar VWAP

    Hello support,

    I would like to create an indicator, that creates a small dot onto the bar upon its close. This dot is to represent the VWAP for the given bar. Thus, I calculate followingly:


    Code:
    		
          #region Variables
            // Wizard generated variables
            // User defined variables (add any user defined variables below)
    		private double SumPrices;
    		private double SumVolume;
            #endregion
    
    ...
    
    protected override void OnMarketData(MarketDataEventArgs e)
    		{
    		if ( FirstTickOfBar ){
    			SumPrices = 0;
    			SumVolume = 0;
    			}
    			
    		SumPrices += e.Price;
    		SumVolume += e.Volume;
    		
    		DrawDot( "IntrabarVWAP" + CurrentBar, false, 0, SumPrices / SumVolume, Color.Black);
    		}
    However, some 3M bars with nonzero volume plot no dot, while some bars plot a dot which is outside the High-Low range. Where am I doing the mistake?

    Sincerely,
    Daniel.

    #2
    Hi Daniel, unfortunately we would not offer custom coded debugging services - I would suggest you add Print() statements in your script to understand where the calculations are not working out your expectations.

    Comment


      #3
      Hello Bertrand,

      OK no problem, just curious though whether you see some obvious errors in my code.

      Regards,
      Daniel.

      Comment


        #4
        Originally posted by Eubie View Post
        Hello Bertrand,

        OK no problem, just curious though whether you see some obvious errors in my code.

        Regards,
        Daniel.
        SumPrices / SumVolume is not the VWAP.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        578 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        334 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        101 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        553 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        551 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X