Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How to add custom charts in strategy?

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

    How to add custom charts in strategy?

    Hello!

    How to add custom charts as second dataseries in indicators and strateges?

    I identified the type of custom bars - it is PeriodType.Final2

    I use the following code:

    protected override void Initialize()
    {
    Overlay = true;
    Add(PeriodType.Final2, 1);
    }

    protected override void OnBarUpdate()
    {
    if(BarsInProgress == 0)
    {
    Print("BarsInProgress == 0 Close[0] = " + Close[0]);
    }
    if(BarsInProgress == 1)
    {
    Print("BarsInProgress == 1 Close[0] = " + Close[0]);
    }
    }

    In Output window i get this:

    BarsInProgress == 1 Close[0] = 51,1
    BarsInProgress == 1 Close[0] = 51,11
    BarsInProgress == 0 Close[0] = 51,08
    BarsInProgress == 0 Close[0] = 51,09
    BarsInProgress == 0 Close[0] = 51,1
    BarsInProgress == 0 Close[0] = 51,11
    BarsInProgress == 0 Close[0] = 51,12
    BarsInProgress == 1 Close[0] = 51,12
    BarsInProgress == 1 Close[0] = 51,11
    BarsInProgress == 1 Close[0] = 51,1
    BarsInProgress == 1 Close[0] = 51,09
    BarsInProgress == 1 Close[0] = 51,1
    BarsInProgress == 1 Close[0] = 51,11
    BarsInProgress == 1 Close[0] = 51,12
    BarsInProgress == 0 Close[0] = 51,13
    BarsInProgress == 1 Close[0] = 51,13

    That is the second dataseries added and doing something.

    How to set properties of DTBRenko chart?

    Obviously, NinjaTrader that creates an instance of the class NinjaTrader.Data.DTBRenko.

    How to get acsess to properties?

    #2
    Hello topor,

    Thank you for your post.

    You are using the correct syntax for Add(), but you need to reference the values for the bar type. So if it uses a base period type, a value for the base and any other values (such as it's own value of course).
    Which is information you can find by going to the chart and right clicking and looking at the Data Series menu.

    Otherwise there is no information in NinjaTrader on those custom bar types that you could pull for the correct syntax.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by charlesugo_1, 05-26-2026, 05:03 PM
    0 responses
    52 views
    0 likes
    Last Post charlesugo_1  
    Started by DannyP96, 05-18-2026, 02:38 PM
    1 response
    142 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 05-11-2026, 05:56 AM
    0 responses
    160 views
    0 likes
    Last Post CarlTrading  
    Started by CarlTrading, 05-10-2026, 08:12 PM
    0 responses
    96 views
    0 likes
    Last Post CarlTrading  
    Started by Hwop38, 05-04-2026, 07:02 PM
    0 responses
    276 views
    0 likes
    Last Post Hwop38
    by Hwop38
     
    Working...
    X