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 Karado58, 11-26-2012, 02:57 PM
      8 responses
      14,828 views
      0 likes
      Last Post Option Whisperer  
      Started by Option Whisperer, Today, 09:05 AM
      0 responses
      1 view
      0 likes
      Last Post Option Whisperer  
      Started by cre8able, Yesterday, 01:16 PM
      3 responses
      11 views
      0 likes
      Last Post cre8able  
      Started by Harry, 05-02-2018, 01:54 PM
      10 responses
      3,204 views
      0 likes
      Last Post tharton3  
      Started by ChartTourist, Today, 08:22 AM
      0 responses
      6 views
      0 likes
      Last Post ChartTourist  
      Working...
      X