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 sjsj2732, 03-23-2026, 04:31 AM
        0 responses
        45 views
        0 likes
        Last Post sjsj2732  
        Started by NullPointStrategies, 03-13-2026, 05:17 AM
        0 responses
        296 views
        0 likes
        Last Post NullPointStrategies  
        Started by argusthome, 03-08-2026, 10:06 AM
        0 responses
        290 views
        0 likes
        Last Post argusthome  
        Started by NabilKhattabi, 03-06-2026, 11:18 AM
        0 responses
        135 views
        1 like
        Last Post NabilKhattabi  
        Started by Deep42, 03-06-2026, 12:28 AM
        0 responses
        98 views
        0 likes
        Last Post Deep42
        by Deep42
         
        Working...
        X