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

    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.

    #2
    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();
    }

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by cbentrikin, Today, 03:49 PM
    0 responses
    7 views
    0 likes
    Last Post cbentrikin  
    Started by MiCe1999, 04-14-2025, 06:54 PM
    7 responses
    67 views
    0 likes
    Last Post b.j.d
    by b.j.d
     
    Started by NISNOS69, Today, 02:20 PM
    0 responses
    11 views
    0 likes
    Last Post NISNOS69  
    Started by hunter7, Today, 01:09 PM
    0 responses
    18 views
    0 likes
    Last Post hunter7
    by hunter7
     
    Started by pjsmith, 10-01-2019, 08:59 AM
    28 responses
    2,013 views
    0 likes
    Last Post nephew94  
    Working...
    X