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 Mindset, 04-21-2026, 06:46 AM
      0 responses
      87 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by M4ndoo, 04-20-2026, 05:21 PM
      0 responses
      132 views
      0 likes
      Last Post M4ndoo
      by M4ndoo
       
      Started by M4ndoo, 04-19-2026, 05:54 PM
      0 responses
      68 views
      0 likes
      Last Post M4ndoo
      by M4ndoo
       
      Started by cmoran13, 04-16-2026, 01:02 PM
      0 responses
      118 views
      0 likes
      Last Post cmoran13  
      Started by PaulMohn, 04-10-2026, 11:11 AM
      0 responses
      67 views
      0 likes
      Last Post PaulMohn  
      Working...
      X