Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

What calls would I used to identify chart type and chart scale (Eg # ticks per bar)

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

    What calls would I used to identify chart type and chart scale (Eg # ticks per bar)



    I am getting tired of tweaking parameters in indicators and strategies per chart.

    I know how to identify the primary instrument but not the rest below and search has not yet surfaced answers.

    I know this will limit some efficiency opportunities but in some cases I would like to code up my indicators and strategies to query for the chart type, selected scale of bars (e..g # of ticks or Range value per bar) and if Chart Trader has been enabled or not.

    How would I do (code) that?

    Thanks!

    #2
    Hello hedgeplay,

    Thank you for your note.

    You can find these in the ChartControl.Properties and the ChartBars.Properties:

    https://ninjatrader.com/support/help...properties.htm

    https://ninjatrader.com/support/help...properties.htm

    Here's a quick example that will print some information for each bar when used in OnBarUpdate():

    Code:
    protected override void OnBarUpdate()
    {
    if(ChartControl != null)
    {
    Print(ChartControl.Properties.ChartTraderVisibility);
    }
    if(ChartBars != null)
    {
    Print(ChartBars.Properties.BarsPeriod.BarsPeriodTypeName);
    Print(ChartBars.Properties.BarsPeriod.Value);
    Print(ChartBars.Properties.ChartStyle.ChartStyleType);
    }
    }
    Since a strategy or indicator can be applied in other places than a chart, it's important to have the ChartBars and ChartControl null checks so the code is only executed if the indicator/strategy is running on a chart.

    Please let us know if we may be of further assistance to you.
    Kate W.NinjaTrader Customer Service

    Comment


      #3
      Perfect.

      Thanks Kate!

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Cross161, Today, 10:33 PM
      0 responses
      2 views
      0 likes
      Last Post Cross161  
      Started by neilzep, Today, 08:55 PM
      0 responses
      5 views
      0 likes
      Last Post neilzep
      by neilzep
       
      Started by javier.filgueira, Today, 03:29 PM
      3 responses
      10 views
      0 likes
      Last Post javier.filgueira  
      Started by Da vinci, Today, 03:15 PM
      1 response
      7 views
      0 likes
      Last Post NinjaTrader_ChrisL  
      Started by Da vinci, Today, 02:51 PM
      1 response
      14 views
      0 likes
      Last Post NinjaTrader_ChrisL  
      Working...
      X