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

Calling an array from inside a function

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

    Calling an array from inside a function

    Error on triggering custom event for indicator 'DBAskBidFreqSenderv1': Object reference not set to an instance of an object

    I have tracked this to an Array I declare

    declared in Variables
    private double [] cc;

    declared in Initialize
    double[] cc= {0.0,0.026670057901, 0.188176800078, 0.527201188932,
    0.688459039454, 0.281172343661,-0.249846424327,
    -0.195946274377, 0.127369340336, 0.093057364604,
    -0.071394147166,-0.029457536822, 0.033212674059,
    0.003606553567,-0.010733175483, 0.001395351747,
    0.001992405295,-0.000685856695,-0.000116466855,
    0.000093588670,-0.000013264203};

    Then in a function I try to call it and get the above error

    How can I call an array from inside a function?

    Tinkerz
    Last edited by tinkerz; 07-30-2010, 06:13 AM.

    #2
    Hi tinkerz,

    Unfortunately, custom arrays like that are outside of the scope I can provide. However, the error means you are trying to access a value that does not yet exist, or is empty, null, during that context of the indicator.

    Try declaring in variables with values, even if they are all zeros, then give them the values during Initialize or OnBarUpdate.
    TimNinjaTrader Customer Service

    Comment


      #3
      I think Tim inadvertantly gave you the correct answer, I believe you need to check the scope of your function and be sure that it includes the array object.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by habeebft, Today, 07:27 AM
      1 response
      14 views
      0 likes
      Last Post NinjaTrader_ChristopherS  
      Started by AveryFlynn, Today, 04:57 AM
      1 response
      12 views
      0 likes
      Last Post NinjaTrader_Erick  
      Started by Max238, Today, 01:28 AM
      4 responses
      37 views
      0 likes
      Last Post Max238
      by Max238
       
      Started by r68cervera, Today, 05:29 AM
      1 response
      10 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by geddyisodin, Today, 05:20 AM
      1 response
      14 views
      0 likes
      Last Post NinjaTrader_Gaby  
      Working...
      X