Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Volumetric dataseries

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

    Volumetric dataseries

    Hello,

    I´m having error messages ref. onbarupdate when using volumetric dataseries and I cant find the reason. I have
    NinjaTrader.NinjaScript.BarsTypes.VolumetricBarsTy pe barsType = BarsArray[2].BarsType as NinjaTrader.NinjaScript.BarsTypes.VolumetricBarsTy pe;
    if (barsType == null) return;
    NinjaTrader.NinjaScript.BarsTypes.VolumetricBarsTy pe barsType2 = BarsArray[4].BarsType as NinjaTrader.NinjaScript.BarsTypes.VolumetricBarsTy pe;
    if (barsType2 == null) return;
    and I use it eg
    if(barsType2.Volumes[CurrentBars[4]].GetAskVolumeForPrice(Highs[4][0])>barsType.Volumes[CurrentBars[2]].GetAskVolumeForPrice(Highs[2][0]))
    and
    if(barsType.Volumes[CurrentBars[2]].GetBidVolumeForPrice(Highs[2][0])==0)
    and when accessing bars ago
    if(barsType2.Volumes[CurrentBars[4]-1].GetAskVolumeForPrice(Highs[4][1])>.....)

    Is there any syntax wrong please? I cant find from helpguide what would be wrong here.

    Thank you!
    Tony
    Last edited by tonynt; 12-18-2020, 02:44 PM. Reason: typo

    #2
    Hello Tony,

    Thanks for your post.

    I suggest using debugging prints to see which line of code is throwing the error. Once you identify the line of code that is throwing the error, check each object in that line to see which object is null when you are refencing it. The object you are referencing that is null would need to be corrected, either with a null check, or the object that is being referenced will need to be replaced with an object that is not null.

    Debugging Tips - https://ninjatrader.com/support/help...script_cod.htm

    Checking for null references - https://ninjatrader.com/support/help...references.htm

    We look forward to assisting.
    JimNinjaTrader Customer Service

    Comment


      #3
      Hello,

      I found the error...

      Thank you for your support!
      Tony
      Last edited by tonynt; 12-20-2020, 10:19 AM.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Aviram Y, Today, 05:29 AM
      0 responses
      1 view
      0 likes
      Last Post Aviram Y  
      Started by quantismo, 04-17-2024, 05:13 PM
      3 responses
      25 views
      0 likes
      Last Post NinjaTrader_Gaby  
      Started by ScottWalsh, 04-16-2024, 04:29 PM
      7 responses
      34 views
      0 likes
      Last Post NinjaTrader_Gaby  
      Started by cls71, Today, 04:45 AM
      0 responses
      5 views
      0 likes
      Last Post cls71
      by cls71
       
      Started by mjairg, 07-20-2023, 11:57 PM
      3 responses
      216 views
      1 like
      Last Post PaulMohn  
      Working...
      X