Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

BarsSinceExit

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

    BarsSinceExit

    I am building my first strategy and I am trying to have the strategy wait one bar until it tries to enter again. I do not want the strategy to enter on the same bar that it has exited from.

    As far as I understand I would use the BarsSinceExit to do this but when I place this into my strategy it makes no trade at all. I suspect that there is a conflict that when the strategy first starts up it obviously has not made any entries and as a result BarsSinceExit will prevent it from every entering a trade. How do I fix this?

    Thanks, Steven

    #2
    BarsSinceExit()

    Steven,

    I am happy to assist you.

    Are you checking for BarsSinceExit() == -1; ?

    From the help guide example : http://www.ninjatrader.com/support/h...ssinceexit.htm

    Here is an example of using BarsSinceExit();

    Code:
     if ((BarsSinceExit() > 10 || BarsSinceExit() == -1) && CrossAbove(SMA(10), SMA(20), 1))
             EnterLong();
    The "||" is an OR symbol.

    Please let me know if I may assist further.
    Adam P.NinjaTrader Customer Service

    Comment


      #3
      I am using BarsSinceExit () > 1.

      If I understand correctly BarsSinceExit() is set to -1 when the strategy first runs and then changes value to '0' when an exit occurs and will then change from 0 to x after the first exit of the strategy. Is this correct?

      If so how do I put in the OR statement you have suggested in the strategy builder. When I open and look at the code it will not let me make any changes. Is there a trick to entering an OR statement.

      Thanks, Steven

      Comment


        #4
        Steven,

        I am happy to assist you.

        Yes, BarsSinceEntry() is initially set to -1. You can either hit the "unlock code" option and input this manually, or you can create a new "Conditions and Actions" set that has the same behavior as the one with "BarsSinceExit()>1", except that it is now "BarsSinceExit()==-1". Note that unlocking the code is irreversible and you will be unable to use the Strategy Wizard with it again.

        Each "Conditions and Actions" set is considered an "or" whereas any conditions put into each individual set is an "and".

        Please let me know if I may assist further.
        Adam P.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by FrancisMorro, Today, 03:24 AM
        0 responses
        1 view
        0 likes
        Last Post FrancisMorro  
        Started by Segwin, 05-07-2018, 02:15 PM
        10 responses
        1,770 views
        0 likes
        Last Post Leafcutter  
        Started by Rapine Heihei, 04-23-2024, 07:51 PM
        2 responses
        31 views
        0 likes
        Last Post Max238
        by Max238
         
        Started by Shansen, 08-30-2019, 10:18 PM
        24 responses
        944 views
        0 likes
        Last Post spwizard  
        Started by Max238, Today, 01:28 AM
        0 responses
        11 views
        0 likes
        Last Post Max238
        by Max238
         
        Working...
        X