Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

BarsSinceExit stops all trades ?

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

    BarsSinceExit stops all trades ?

    Greetings,

    I modified the sample multiframe strategy to include both BarsSinceEntry and BarsSinceExit. My own strategy stopped taking trades when I added BarsSinceExit(0, "",0) >= 2 as a condition of taking a trade: I dont see anything in the help about use of BarsSinceExit vis a vi the very first trade not yet having been taken ... so I am curious if that is a factor. All this is on historical backtesting in strategy analyzer

    I tried the BarsSinceExit on the sample MACDcrossover and it works ... I modified the sample MultiTimeFrame strategy and it wont take trades ... attached. NT7R1

    Your assist is appreciated!
    Jon
    Attached Files
    Last edited by Trader.Jon; 01-13-2011, 07:12 PM.

    #2
    Hi Jon, please add some prints to see if your entry conditions trigger at all - I would guess they are 'too hard' to produce any trades in this example.

    Comment


      #3
      Bertrand,

      I concur that the code is very restrictive. Perhaps something more 'productive' should be provided as an example code with NT7R3 release ?!

      I revisited the example provided with NT7R1, 'samplemultitimeframe' and found a time span in $EURUSD with 3 range bars that produced trades (long). When I slightly modified the code to include the BarsSinceExit(0, "", 0) >= 2 there are no trades taken. This corresponds to my own strategy's behaviour. I dont know what else I can do to provide a simpler multitimeframe example.

      Screens of SA outputs and full code attached. [[Uses $EURUSD, October 2010, 3 range, 24/7, no exit at close ]]

      Wouldnt the strategy take at least the very first trade? After all, there can be no 'barssinceexit' to stop the very first trade ??!!

      Puzzled,
      Jon
      Attached Files
      Last edited by Trader.Jon; 01-14-2011, 11:10 AM.

      Comment


        #4
        Hi Jon,

        Yes, using BarsSinceExit() will require that a trade has been made. If you use it as condition for all your entries, then you've prevented any entries from happening.

        You can code sequences using bools or work off the return value of -1, when there has been no previous exit.



        if (BarsSinceExit() >= 2 || BarsSinceExit() == -1)
        Last edited by NinjaTrader_RyanM1; 01-14-2011, 03:12 PM.
        Ryan M.NinjaTrader Customer Service

        Comment


          #5
          Ryan,

          Thanks much! I will give that a try.

          May I suggest an update to include that information to the help url you posted? I located that page previous to posting and it gave me no clue .... I do admit to being code challenged!

          Jon

          Comment


            #6
            Sure, I'll forward your request. The link does include that a value of -1 will be returned when no previous exit can be found. I can see how it would be useful to see this in an example.
            Ryan M.NinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by NullPointStrategies, Today, 05:17 AM
            0 responses
            49 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
            67 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