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 Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      650 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      370 views
      1 like
      Last Post Geovanny Suaza  
      Started by Mindset, 02-09-2026, 11:44 AM
      0 responses
      109 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
      0 responses
      574 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      577 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X