Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Simultaneous entry and exit stopping strategy

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

    Simultaneous entry and exit stopping strategy

    I have a situation where an entry occurs at the same time another exit occurs and this seems to be causing a conflict which stops the strategy from taking any more trades. Pictures included.

    logic for my exits and entries is as follows:

    when Position.Quantity = 3000 and (condition) exit long 2000

    when Position.Quantity = 9000 and (condition) exit long 6000

    I want to force them to occur consecutively not at the same time. It seems that when the first condition is met and exits 2000 first when in fact I want it to exit the 6000 first. By exiting backwards the exit condition defined by position.quantity is not ever met since it's looking for a value of 9000.

    Any ideas on how to work around this?
    Attached Files

    #2
    Hello ShruggedAtlas,

    Thanks for the post.

    It is hard to say exactly what could be wrong without code snippets, but you might need to set up some boolean flags to be used in concert with your entry/exit conditions. You would set the flag to inhibit the larger position from exiting before the smaller one.

    If you still experience the issue after setting this up please post some code snippets from OnBarUpate and I will take a look.
    Chris L.NinjaTrader Customer Service

    Comment


      #3
      That may very well be that I would need to get down to the code but I'm not sure why I can't do this using just the strategy builder wizard. I've included a couple of pictures to show more clearly what I want to happen.

      after LE3 exits, LE2 should exit but it doesn't exit until after L3 enters and exits two more time. I don't understand why it isn't exiting after the first time.


      OK I THINK I GOT IT

      Changing cross.above to greater fixes the problem
      Attached Files
      Last edited by ShruggedAtlas; 05-25-2018, 11:08 AM.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by elirion, Today, 01:36 AM
      2 responses
      12 views
      0 likes
      Last Post elirion
      by elirion
       
      Started by DJ888, 04-16-2024, 06:09 PM
      5 responses
      14 views
      0 likes
      Last Post NinjaTrader_Erick  
      Started by samish18, Yesterday, 08:31 AM
      4 responses
      14 views
      0 likes
      Last Post elirion
      by elirion
       
      Started by funk10101, Yesterday, 09:43 PM
      1 response
      14 views
      0 likes
      Last Post NinjaTrader_Gaby  
      Started by TheWhiteDragon, 01-21-2019, 12:44 PM
      5 responses
      551 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Working...
      X