Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Break even after price advancement

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

    #16
    Hello,

    Thanks for your reply.

    Can you clarify how you are testing this (market replay, strategy backtest) and what your strategy settings are for exit on close and time in force?

    Comment


      #17
      Testing with market replay. Some days I have no position in the end of the day, so next session strategy entering long/short in the first few bars without problems. However when the position is closed on exit(standard 30 seconds before the close), the next day its limited by the rules: no entry for 10 bars after the last exit.

      P.S. I think I can use BarsSinceExit<Bars.BarsSinceSession ?

      Originally posted by NinjaTrader_Paul View Post
      Hello,

      Thanks for your reply.

      Can you clarify how you are testing this (market replay, strategy backtest) and what your strategy settings are for exit on close and time in force?
      Last edited by meowflying; 03-06-2015, 06:05 AM.

      Comment


        #18
        Hello,

        Thanks for your reply.

        Yes, you could use Bars.BarsSinceSession , continuing in your example:

        (BarsSinceExit("long") > 10 || BarsSinceExit("long") == -1) || Bars.BarsSinceSession < 10) && (BarsSinceExit("long1") > 10 || BarsSinceExit("long1") == -1 || Bars.BarsSinceSession < 10)

        Comment


          #19
          Originally posted by NinjaTrader_Paul View Post
          Hello,

          Thanks for your reply.

          Yes, you could use Bars.BarsSinceSession , continuing in your example:

          (BarsSinceExit("long") > 10 || BarsSinceExit("long") == -1) || Bars.BarsSinceSession < 10) && (BarsSinceExit("long1") > 10 || BarsSinceExit("long1") == -1 || Bars.BarsSinceSession < 10)
          Bars.BarsSinceSession < 10 Will work only for the initial entry within first bars of the session, but will prevent all further entries.

          I need some like that:

          (BarsSinceExit < Bars.BarsSinceSession)

          But it gives me error in compilation:

          Operator "<" cannot be applied to operands of type 'method group' and 'int'

          Comment


            #20
            Hello,

            Thanks for your reply.

            The statement:

            (BarsSinceExit("long") > 10 || BarsSinceExit("long") == -1) || Bars.BarsSinceSession < 10) says that if any of the 3 conditions are true to execute the code after the statement.

            BarsSinceExit("long") > 10 will be true after 10 bars after the last exit
            BarsSinceExit("long") == -1) will be true before there are any entries
            Bars.BarsSinceSession < 10 will be true for the first 9 bars of the new session

            The issue previously advised was that entry conditions in the first 10 bars of a new session were being ignored because of BarsSinceExit("long") > 10 so to get past that issue the OR code of || Bars.BarsSinceSession < 10 was added.

            Taking the case of an exit at the last bar of the session, the code BarsSinceExit("long") > 10 would prevent placing a new order for 10 bars, however as it is a new session on the next bar, the code || Bars.BarsSinceSession < 10 would permit the entry.

            Later after the first 10 bars, you are correct that || Bars.BarsSinceSession < 10 by itself would inhibit further orders however 10 bars after the first exit BarsSinceExit("long") > 10 would be true allowing the next order to occur.

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by charlesugo_1, 05-26-2026, 05:03 PM
            0 responses
            65 views
            0 likes
            Last Post charlesugo_1  
            Started by DannyP96, 05-18-2026, 02:38 PM
            1 response
            149 views
            0 likes
            Last Post NinjaTrader_ChelseaB  
            Started by CarlTrading, 05-11-2026, 05:56 AM
            0 responses
            162 views
            0 likes
            Last Post CarlTrading  
            Started by CarlTrading, 05-10-2026, 08:12 PM
            0 responses
            99 views
            0 likes
            Last Post CarlTrading  
            Started by Hwop38, 05-04-2026, 07:02 PM
            0 responses
            286 views
            0 likes
            Last Post Hwop38
            by Hwop38
             
            Working...
            X