Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Open a position after Nth bar

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

    Open a position after Nth bar

    Hello
    I am struggling set a strategy to open a position Nth bar after the conditions are met in Strategy builder. Can someone please provide me with step by step building the strategy for a simple MA crossover? Appreciate your helo

    #2
    Hello al.kooh,

    Welcome to the NinjaTrader forums!

    To count or do any math in the Strategy Builder it is necessary to use a Series with an offset. The offset is where arithmetic can be performed.

    Below is a link to an example of counting bars in the Strategy Builder.
    with regard to the attached image: Line A is an indicator Line B is the m period MAX of line A Line C is an average of this indicator A Line D is another average of this indicator A is it possible, possibly using the strategy builder, but without adding a temporary variable, to set on the condition: line C crosses below line D


    As well as a link to a video on using the offset with Series.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_ChelseaB View Post
      Hello al.kooh,

      Welcome to the NinjaTrader forums!

      To count or do any math in the Strategy Builder it is necessary to use a Series with an offset. The offset is where arithmetic can be performed.

      Below is a link to an example of counting bars in the Strategy Builder.
      https://ninjatrader.com/support/foru...on#post1078538

      As well as a link to a video on using the offset with Series.
      https://drive.google.com/file/d/1lwj...usp=drive_link
      Thanks for the response. It was complicated and a separate strategy. Not sure how to use it in my strategy. Is there any crossover/under strategy procedure for Nth bar after the conditions are met available?
      Last edited by al.kooh; 06-21-2023, 09:16 PM.

      Comment


        #4
        Hello al.kooh,

        Add a series. On each new bar set the series value to the previous bar's value with an offset of adding 1. This will count the number of bars.

        In a different condition trigger the action when the series value is N. Then set the series value to 1 to reset it.
        Chelsea B.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by CaptainJack, 05-29-2026, 05:09 AM
        0 responses
        267 views
        0 likes
        Last Post CaptainJack  
        Started by CaptainJack, 05-29-2026, 12:02 AM
        0 responses
        169 views
        0 likes
        Last Post CaptainJack  
        Started by charlesugo_1, 05-26-2026, 05:03 PM
        0 responses
        171 views
        1 like
        Last Post charlesugo_1  
        Started by DannyP96, 05-18-2026, 02:38 PM
        1 response
        260 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by CarlTrading, 05-11-2026, 05:56 AM
        0 responses
        210 views
        0 likes
        Last Post CarlTrading  
        Working...
        X