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 CarlTrading, 03-31-2026, 09:41 PM
        1 response
        62 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by CarlTrading, 04-01-2026, 02:41 AM
        0 responses
        33 views
        0 likes
        Last Post CarlTrading  
        Started by CaptainJack, 03-31-2026, 11:44 PM
        0 responses
        44 views
        1 like
        Last Post CaptainJack  
        Started by CarlTrading, 03-30-2026, 11:51 AM
        0 responses
        58 views
        0 likes
        Last Post CarlTrading  
        Started by CarlTrading, 03-30-2026, 11:48 AM
        0 responses
        47 views
        0 likes
        Last Post CarlTrading  
        Working...
        X