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 Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    647 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    369 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    108 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    572 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    573 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X