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 memonic, Yesterday, 01:23 PM
      2 responses
      12 views
      0 likes
      Last Post memonic
      by memonic
       
      Started by merc410, Today, 03:41 AM
      2 responses
      13 views
      0 likes
      Last Post merc410
      by merc410
       
      Started by sugalt, 04-30-2024, 04:02 AM
      2 responses
      13 views
      0 likes
      Last Post sugalt
      by sugalt
       
      Started by Ndakotan1313, 03-14-2024, 05:02 PM
      2 responses
      64 views
      0 likes
      Last Post blaise_code  
      Started by claxxical, 05-30-2017, 12:30 PM
      37 responses
      4,464 views
      0 likes
      Last Post Padan
      by Padan
       
      Working...
      X