Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Define a new series for bars!

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

    Define a new series for bars!

    Hello,
    I wanted to attribute a new series to the bars. Which acts almost like a bool flag.

    If condition 1 is met, I will assign the value of 1 to the series, and if condition 2 is met, I will assign the value -1 to the series, and if none of them are met, I will set the value of the series to 0.

    And in my strategy when bars are loaded. I want that series to be calculated for historical bars. To continue to use it.

    For example, suppose each bar has 5 parameters: open, high, low, close, and volume, and we want to add a sixth parameter called the bool flag to it.

    Do you have an idea?

    #2
    Hello alichi50,

    Thanks for the post.

    What you are describing can be achieved by using a Series<int> or Series<double> in your strategy. To modify the actual bar series to include a new value would require making a BarsType and a custom method to retrieve that value. Your strategy is already configured to parse the existing bars and has the ability to make new series which match the amount of bars on the chart so that is a more appropriate place to do this type of series.

    There is a general example of making a series in the following page:
    https://ninjatrader.com/support/help...t8/seriest.htm

    There is a sample of using a bool series here, bool series does not have to be used you can change the type to int or double as well. This is just a working example and can also be used in a strategy: https://ninjatrader.com/support/help...alues_that.htm

    I look forward to being of further assistance.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by CarlTrading, 03-31-2026, 09:41 PM
    1 response
    45 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 04-01-2026, 02:41 AM
    0 responses
    21 views
    0 likes
    Last Post CarlTrading  
    Started by CaptainJack, 03-31-2026, 11:44 PM
    0 responses
    31 views
    1 like
    Last Post CaptainJack  
    Started by CarlTrading, 03-30-2026, 11:51 AM
    0 responses
    50 views
    0 likes
    Last Post CarlTrading  
    Started by CarlTrading, 03-30-2026, 11:48 AM
    0 responses
    42 views
    0 likes
    Last Post CarlTrading  
    Working...
    X