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 SalmaTrader, 07-07-2026, 10:26 PM
            0 responses
            47 views
            0 likes
            Last Post SalmaTrader  
            Started by CarlTrading, 07-05-2026, 01:16 PM
            0 responses
            22 views
            0 likes
            Last Post CarlTrading  
            Started by CaptainJack, 06-17-2026, 10:32 AM
            0 responses
            15 views
            0 likes
            Last Post CaptainJack  
            Started by kinfxhk, 06-17-2026, 04:15 AM
            0 responses
            21 views
            0 likes
            Last Post kinfxhk
            by kinfxhk
             
            Started by kinfxhk, 06-17-2026, 04:06 AM
            0 responses
            23 views
            0 likes
            Last Post kinfxhk
            by kinfxhk
             
            Working...
            X