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 cmtjoancolmenero, Yesterday, 03:40 PM
      1 response
      14 views
      0 likes
      Last Post NinjaTrader_Jesse  
      Started by ageeholdings, 04-28-2024, 07:43 AM
      2 responses
      24 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by Taddypole, 04-26-2024, 02:47 PM
      6 responses
      39 views
      0 likes
      Last Post Rudmax
      by Rudmax
       
      Started by reynoldsn, Yesterday, 07:19 PM
      1 response
      16 views
      0 likes
      Last Post NinjaTrader_BrandonH  
      Started by marinam, Yesterday, 03:45 PM
      1 response
      14 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Working...
      X