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.



    JesseNinjaTrader Customer Service

    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.
        JesseNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by fx.practic, 10-15-2013, 12:53 AM
        5 responses
        5,404 views
        0 likes
        Last Post Bidder
        by Bidder
         
        Started by Shai Samuel, 07-02-2022, 02:46 PM
        4 responses
        95 views
        0 likes
        Last Post Bidder
        by Bidder
         
        Started by DJ888, Yesterday, 10:57 PM
        0 responses
        7 views
        0 likes
        Last Post DJ888
        by DJ888
         
        Started by MacDad, 02-25-2024, 11:48 PM
        7 responses
        159 views
        0 likes
        Last Post loganjarosz123  
        Started by Belfortbucks, Yesterday, 09:29 PM
        0 responses
        8 views
        0 likes
        Last Post Belfortbucks  
        Working...
        X