• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Possible to set a strategy's Primary Data series via code?

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

  • NinjaTrader_PatrickH
    replied
    Hello Matheyas5,

    Thank you for your post.

    There is no means to set the primary series (chart series) through NinjaScript code. Although you could use SendKeys to send keys to the chart to change the primary bar series. Other than that you could put a check in your code and display a message using DrawTextFixed that advises that the incorrect bar type and value is in use.

    For SendKeys, here is an unsupported example:
    Code:
    // check that the bars are Renko and that they are not at the desired 6 value
    if(BarsPeriod.Id == PeriodType.Renko && BarsPeriod.Value != 6)
    {
    // if so, invoke the ninjatrader mini instrument selector which will change the period to the 6RE (6 Renko)
    MiniInstrumentSelector MIS = new MiniInstrumentSelector(ChartControl, "6RE");
    System.Windows.Forms.SendKeys.Send("{ENTER}");
    MIS.ShowDialog();
    }

    Leave a comment:


  • Possible to set a strategy's Primary Data series via code?

    Hello NT,

    Is it possible to set a strategy's Primary Data series via code?

    For example, I'd like to code my strategy so it knows to always use 1 Minute Last bars as the primary data series (aka BarsInProgress ==0).

    Thanks.

Latest Posts

Collapse

Topics Statistics Last Post
Started by Twingo445, Today, 09:16 AM
0 responses
2 views
0 likes
Last Post Twingo445  
Started by frankduc, Today, 07:26 AM
0 responses
7 views
0 likes
Last Post frankduc  
Started by chnh1, Yesterday, 11:51 PM
1 response
16 views
0 likes
Last Post NinjaTrader_PaulH  
Started by Jasper99, Yesterday, 10:29 PM
1 response
29 views
0 likes
Last Post NinjaTrader_ChrisSch  
Started by Jasper99, Yesterday, 09:50 PM
1 response
12 views
0 likes
Last Post NinjaTrader_ChrisSch  
Working...
X