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 jxs_xrj, 01-12-2020, 09:49 AM
      6 responses
      3,290 views
      1 like
      Last Post jgualdronc  
      Started by Touch-Ups, Today, 10:36 AM
      0 responses
      8 views
      0 likes
      Last Post Touch-Ups  
      Started by geddyisodin, 04-25-2024, 05:20 AM
      11 responses
      61 views
      0 likes
      Last Post halgo_boulder  
      Started by Option Whisperer, Today, 09:55 AM
      0 responses
      8 views
      0 likes
      Last Post Option Whisperer  
      Started by halgo_boulder, 04-20-2024, 08:44 AM
      2 responses
      24 views
      0 likes
      Last Post halgo_boulder  
      Working...
      X