Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Can I interrogate the details of Chart Data Series [0]?

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

    Can I interrogate the details of Chart Data Series [0]?

    Hello Coder-traders,
    I know how to refer to different Chart Data Series and to programmatically add data series when I write a strategy in the Ninjascript editor.

    Now I want to write a strategy that can be applied to any chart that has a single data series in candlestick format. The strategy might want to add the same contract on a different timeframe, or add an alternate data series from a logic statement. Is there a way to programmatically query the details of data series [0]? I wish to know it's name, expiration date, period type, period value, and market data type. Here is a sample series[0].

    "NQ 09-24", Data.BarsPeriodType.Tick, 1200, Data.MarketDataType.Last

    Is there a query that will return:

    "NQ", "09-24", "Tick", 1200, "Last"

    Thank you.​

    #2
    Hello Berry Trader,

    Thank you for your post.

    Take a look at the Help Guide for BarsPeriod, in particular: BarsPeriod.BarsPeriodType, BarsPeriod.Value, and BarsPeriod.MarketDataType.



    Instrument will also get you the name of an instrument and the expiry.



    Please let us know if you have any further questions.

    Comment


      #3
      I looked into both of these suggestions, but if I understand the documentation, the instrument or barsperiod query can't happen until we reach the (State == State.DataLoaded) point of the script. However, additional data series are added in the earlier (State == State.Configure) part of the script. I think the solution is to have the user specify the contract and month in the dialog box as they are selecting the indicator and it's parameters.

      If I use the dialog box solution, this means the user will have to adjust each chart that uses that indicator or strategy when the contract rolls over. The logs will let the user know there is an error, but I don't think it will tell them which chart is throwing the error. It might be a little confusing if the chart is minimized?

      Do I have a good grasp of the limitations of what I am trying to do?
      Thanks,
      Berry

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by argusthome, 03-08-2026, 10:06 AM
      0 responses
      110 views
      0 likes
      Last Post argusthome  
      Started by NabilKhattabi, 03-06-2026, 11:18 AM
      0 responses
      59 views
      0 likes
      Last Post NabilKhattabi  
      Started by Deep42, 03-06-2026, 12:28 AM
      0 responses
      37 views
      0 likes
      Last Post Deep42
      by Deep42
       
      Started by TheRealMorford, 03-05-2026, 06:15 PM
      0 responses
      41 views
      0 likes
      Last Post TheRealMorford  
      Started by Mindset, 02-28-2026, 06:16 AM
      0 responses
      78 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Working...
      X