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 NullPointStrategies, Today, 05:17 AM
    0 responses
    50 views
    0 likes
    Last Post NullPointStrategies  
    Started by argusthome, 03-08-2026, 10:06 AM
    0 responses
    126 views
    0 likes
    Last Post argusthome  
    Started by NabilKhattabi, 03-06-2026, 11:18 AM
    0 responses
    69 views
    0 likes
    Last Post NabilKhattabi  
    Started by Deep42, 03-06-2026, 12:28 AM
    0 responses
    42 views
    0 likes
    Last Post Deep42
    by Deep42
     
    Started by TheRealMorford, 03-05-2026, 06:15 PM
    0 responses
    46 views
    0 likes
    Last Post TheRealMorford  
    Working...
    X