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.
    JimNinjaTrader Customer Service

    Comment


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

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by bmartz, Today, 09:30 AM
      2 responses
      12 views
      0 likes
      Last Post bltdavid  
      Started by f.saeidi, Today, 11:02 AM
      1 response
      4 views
      0 likes
      Last Post NinjaTrader_BrandonH  
      Started by geotrades1, Today, 10:02 AM
      4 responses
      12 views
      0 likes
      Last Post geotrades1  
      Started by rajendrasubedi2023, Today, 09:50 AM
      3 responses
      16 views
      0 likes
      Last Post NinjaTrader_BrandonH  
      Started by lorem, Today, 09:18 AM
      2 responses
      11 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Working...
      X