Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Minor bug/issue with Stock VWMA indicator when used with zero volume bars

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

    Minor bug/issue with Stock VWMA indicator when used with zero volume bars

    Hello,

    There is a minor issue when the stock default VWMA indicator is used with bars that might have zero volume. For instance, renko and small range bars. This is represented with the blue plot in the examples. This occurs when several bars have zero volume and the formula fails in this instance to give a value, per the 2 examples below.



    And with autoscale off

    The blue plot is the stock VWMA indicator.

    This effect can be fixed with the following simple code change

    line 78

    Code:
    vol = Instrument.MasterInstrument.InstrumentType == InstrumentType.CryptoCurrency ? Core.Globals.ToCryptocurrencyVolume((long)Volume[i]) : Volume[i];
    becomes

    Code:
    vol = Math.Max(1,Instrument.MasterInstrument.InstrumentT ype == InstrumentType.CryptoCurrency ? Core.Globals.ToCryptocurrencyVolume((long)Volume[i]) : Volume[i]);
    ​​
    Ensuring that the multiplication factor is always at least 1.

    resulting in this for the same period



    I leave the code and info here​ for others who might wish to fix the indie themselves in their install.

    All the best,

    Paul

    #2
    Hello pjsmith,

    Unfortunately the images did not come through so I cannot see your examples, are you seeing 0 volume bars with stock bars types or custom bars types? I tried using stock renko and range bars with the minimum values however I don't see any instances of 0 volume being reported. Do you have a specific example that includes the instrument used and chart settings used to produce 0 volume bars?

    The indicators calculation is expecting a constant dataset like most other indicators so the math it uses relies on having a value for each bar processed. If you are using a series that is somehow making 0 volume bars then that would be expected as the calculation will now include 0's instead of an amount of volume. You would have to modify the script in that situation to artificially inject a volume if 0 is observed.



    Comment


      #3
      Strange. I can see them in the forum. Here is a screenshot of the post attched. Stock bar types such as range / renko do the same, yes.

      And, FWIW, many small time frame renko/range bars will have zero volumes around fast moves - Gaps, etc. It is normal
      Attached Files

      Comment


        #4
        Hello pjsmith,

        Unfortunately that does not help to see the examples, that image is too small. If you can just type in the instrument and chart settings that you used which reproduces 0 volume bars I would be able to test that and then submit that to development if something is happening unexpected. Please include the instrument being tested, the specific settings that you modified when creating the chart and also how you are confirming there are 0 volume bars for example applying the VOL indicator would be one way of displaying volume information on the chart.

        Comment

        Latest Posts

        Collapse

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