Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Multiple Exits

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

    Multiple Exits

    I know this has been covered before. I have one version of my system which at a short entry condition will execute 2 different named entries, and these entries are handled separately with their own exit criteria which is great.

    But, I want to have the strategy stop entering when the 2nd position is still on. What happens is when my primary condition is first met, there are two position entries. 1 position exits very quickly, and the other has a wide trailing stop. What I would like is to program some way to NOT re-enter the 2nd position while the first is still on. I would like to do this within the strategy instead of using the max entries in trade direction field when running the strategy.


    I know other ways to handle this such as setting number of entries in one direction etc. Can I use "user values" to indicate whether a position is still on or not? I would like to do this because I can then get fancy about having the closed position perhaps reenter after all. For instance, I could change that user value with some condition and let the first position reenter after all.

    I hope I am clear. I really just want to learn some different ways of coding these multiple entries and exits.

    Thanks! Hard to believe I only downloaded this program about 2 and a half weeks ago.

    #2
    Hi sauer11155,

    Your idea on using a variable is a way to proceed. Another way would to just check Position.MarketPosition. In your trade conditions just add:
    Code:
    if (Position.MarketPosition == MarketPosition.Flat)
         // then trade
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      Thanks Josh. I had tried using some way to find out if the current open P/L is profitable or not as one way to determine whether or not to do any additional trades, but it seems this is real time and not a backtestable indication?

      I didn't know about the market position condition, are all of these in the help file? Which I should read....

      Comment


        #4
        Checking PnL is backtestable. Please see this reference sample demonstrating some PnL checks: http://www.ninjatrader-support.com/v...ead.php?t=4084

        In regards to MarketPosition. It is available in the Help Guide along with all the available properties and methods exposed in NinjaTrader. Please see here: http://www.ninjatrader-support.com/H...tPosition.html
        Josh P.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        587 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        341 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        103 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        555 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        552 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X