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 charlesugo_1, 05-26-2026, 05:03 PM
        0 responses
        59 views
        0 likes
        Last Post charlesugo_1  
        Started by DannyP96, 05-18-2026, 02:38 PM
        1 response
        143 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by CarlTrading, 05-11-2026, 05:56 AM
        0 responses
        161 views
        0 likes
        Last Post CarlTrading  
        Started by CarlTrading, 05-10-2026, 08:12 PM
        0 responses
        97 views
        0 likes
        Last Post CarlTrading  
        Started by Hwop38, 05-04-2026, 07:02 PM
        0 responses
        276 views
        0 likes
        Last Post Hwop38
        by Hwop38
         
        Working...
        X