Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Handling of Exit Long and Exit Short before EOD

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

    Handling of Exit Long and Exit Short before EOD

    In the condition builder I check for ToTime>21:45 and want as action to close my position. Can I give the ExitLong as well as the ExitShort command at the same time? What will be the result of the ExitShort command when you have a Long position or no position?
    Is there a smarter way to close your position indepent it is Long or Short?

    #2
    this is what I do:

    if (Position.MarketPosition != MarketPosition.Flat) {


    if (Position.MarketPosition == MarketPosition.Long) {
    //exit long code here
    }

    if (Position.MarketPosition == MarketPosition.Short) {
    //exit short code here
    }
    }

    Comment


      #3
      Yes, you can have both. One or both are ignored if a position does not exist to be closed.
      RayNinjaTrader Customer Service

      Comment


        #4
        The help for ExitShort says "This method is ignored if a short position does not exist", so it should be OK to just issue both the ExitShort and the ExitLong when you want to flatten your strategy.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        599 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        345 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
        558 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        558 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X