Announcement

Collapse
No announcement yet.

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 Hwop38, 05-04-2026, 07:02 PM
      0 responses
      164 views
      0 likes
      Last Post Hwop38
      by Hwop38
       
      Started by CaptainJack, 04-24-2026, 11:07 PM
      0 responses
      318 views
      0 likes
      Last Post CaptainJack  
      Started by Mindset, 04-21-2026, 06:46 AM
      0 responses
      246 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by M4ndoo, 04-20-2026, 05:21 PM
      0 responses
      350 views
      0 likes
      Last Post M4ndoo
      by M4ndoo
       
      Started by M4ndoo, 04-19-2026, 05:54 PM
      0 responses
      179 views
      0 likes
      Last Post M4ndoo
      by M4ndoo
       
      Working...
      X