Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Data array to Data Series conversion

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

    Data array to Data Series conversion

    Dear team,
    I have a data in an array, and would like to create an indicator using this array as input data, such that myArray[0] is the value used to create the current bar indicator plot,
    myArray[1] is the value used to create bar[1] in the indicator plot, as would normally be created below the chart, and so on.
    The total number of values in myArray matches the total number of bars in the main chart.
    Is this possible in NinjaScript ?
    Thanks in advance.

    #2
    Hello Louis335,

    Thanks for your post.

    There is not a way to directly convert an array to a Series and the values of the Series will have to be assigned individually. Instead of trying to convert the array to a Series, I would suggest writing your values to a Series instead of writing to an array.

    To enter the array values in a Series you will need to assign the current bar's value with each new bar that gets processed, or you could loop through the array elements and assign them to the historical values of the Series. I.E.

    Code:
    for (int i = 0; i < 100; i++)
        mySeries[i] = myArray[i];
    We look forward to assisting.

    Comment


      #3
      Thanks Jim, that's clear to me now.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by CarlTrading, 03-31-2026, 09:41 PM
      1 response
      42 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by CarlTrading, 04-01-2026, 02:41 AM
      0 responses
      20 views
      0 likes
      Last Post CarlTrading  
      Started by CaptainJack, 03-31-2026, 11:44 PM
      0 responses
      29 views
      1 like
      Last Post CaptainJack  
      Started by CarlTrading, 03-30-2026, 11:51 AM
      0 responses
      46 views
      0 likes
      Last Post CarlTrading  
      Started by CarlTrading, 03-30-2026, 11:48 AM
      0 responses
      38 views
      0 likes
      Last Post CarlTrading  
      Working...
      X