Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

first bar of the chart

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

    first bar of the chart

    hello

    is there a method to say on first closed bar of the chart (so entire timeframe not just today) a strategy should trigger something?

    Regards
    tradereight

    #2
    Hi tradereight, you can use CurrentBar for this - the left most bar on the chart will be number 0 - http://www.ninjatrader-support.com/H...urrentBar.html

    Comment


      #3
      backtest

      the current bar method does not seam to works for backtest

      if i make a simple strategy to enter short at the first bar

      if (CurrentBar == 0) {
      EnterShort(DefaultQuantity, "short");}

      there are no historical trades.

      the reason why i want to do is: i want to use the barssinceexit function so my strategy does not make so many trades (but barssinceexit obviously requires a first "fake" trade, otherwise no position will ever be opened)


      Originally posted by NinjaTrader_Bertrand View Post
      Hi tradereight, you can use CurrentBar for this - the left most bar on the chart will be number 0 - http://www.ninjatrader-support.com/H...urrentBar.html

      Comment


        #4
        It works on my end here - what is your 'Min bars required' setting? If you set this to the default of 20, the first real bar the strategy uses will be CurrentBar == 20;

        Comment


          #5
          now it works

          oh i forgot that, thx now it works!!

          Originally posted by NinjaTrader_Bertrand View Post
          It works on my end here - what is your 'Min bars required' setting? If you set this to the default of 20, the first real bar the strategy uses will be CurrentBar == 20;

          Comment


            #6
            Good to hear!

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by charlesugo_1, 05-26-2026, 05:03 PM
            0 responses
            55 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