Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Using an Int variable as an array selector in Multi-instrument strategy

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

    Using an Int variable as an array selector in Multi-instrument strategy

    Can I use an Int variable to define the array to be selected on the AddSeries() method? For example the variable int is "ArrayCL" and I use it so:
    If(BarsInProgress == ArrayCL && EMA(Closes[ArrayCL] ? The ArrayCL prints but appears not to be usable in trade logic as above. Regards to all.

    #2
    Hello elliot5,

    Thanks for your reply.

    You wrote AddSeries but I think you mean AddDataSeries().

    In the help guide for AddDataSeries() is this warning specification, "Arguments supplied to AddDataSeries() should be hardcoded and NOT dependent on run-time variables which cannot be reliably obtained during State.Configure (e.g., Instrument, Bars, or user input). Attempting to add a data series dynamically is NOT guaranteed and therefore should be avoided. Trying to load bars dynamically may result in an error similar to: Unable to load bars series. Your NinjaScript may be trying to use an additional data series dynamically in an unsupported manner."
    Reference: https://ninjatrader.com/support/help...dataseries.htm

    Comment


      #3
      noted and thank you for the guidance.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by NullPointStrategies, Yesterday, 05:17 AM
      0 responses
      54 views
      0 likes
      Last Post NullPointStrategies  
      Started by argusthome, 03-08-2026, 10:06 AM
      0 responses
      130 views
      0 likes
      Last Post argusthome  
      Started by NabilKhattabi, 03-06-2026, 11:18 AM
      0 responses
      72 views
      0 likes
      Last Post NabilKhattabi  
      Started by Deep42, 03-06-2026, 12:28 AM
      0 responses
      44 views
      0 likes
      Last Post Deep42
      by Deep42
       
      Started by TheRealMorford, 03-05-2026, 06:15 PM
      0 responses
      49 views
      0 likes
      Last Post TheRealMorford  
      Working...
      X