Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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 geotrades1, Today, 10:02 AM
      1 response
      5 views
      0 likes
      Last Post NinjaTrader_BrandonH  
      Started by ender_wiggum, Today, 09:50 AM
      1 response
      5 views
      0 likes
      Last Post NinjaTrader_Gaby  
      Started by rajendrasubedi2023, Today, 09:50 AM
      1 response
      12 views
      0 likes
      Last Post NinjaTrader_BrandonH  
      Started by bmartz, Today, 09:30 AM
      1 response
      10 views
      0 likes
      Last Post NinjaTrader_Erick  
      Started by geddyisodin, Today, 05:20 AM
      3 responses
      27 views
      0 likes
      Last Post NinjaTrader_Gaby  
      Working...
      X