• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Exit On Close vs. Strategy Position

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

    Exit On Close vs. Strategy Position

    Hello,

    Hopefully one could help me with the following problem I am stuck with:

    When trading different strategies on the same underlying (E-Mini) I want to close all open positions a few seconds before market closes. So I enabled Exit On Close with the standard 30 seconds on all strategies and template session CME US Index Futures ETH.
    Now, every strategy has it's own label name for the entry and exit, so under the execution tab all trades are gathered and the different trades can be seen. I assume these names are also used by Ninjatrader to figure out which strategy holds what position, or better said, holds a position or not.
    It happens that one of the strategies holds a long position, where another is short. So NT has two open positions, a long and short on the same underlying. In my trading platform (IB's TWS) there are no running positions, which is correct while the long and short flattened each other with the last trade. When this situation still is when the Exit On Close is triggered, two things happen which I would like to alter:

    1. First of all NT initiate two orders for TWS; to close the long and the short. This while there are no physical open positions, but these only is the 'technical' individual state of the two strategies with both an open position. So two orders are executed while this is not neccesary. I only want to have NT set the positions of all strategies on zero again, when there are no running positions in TWS, which also can be seen under the positions tab in NT.

    2. When the Exit On Close orders are executed, these orders get the name 'Exit on close' labeled and NT probably no longer matches the correct open positions to each individual strategy. The Exit On Close did close two positions (not needed as stated under previous point) and thus closed the overall positions to zero, but the two strategies who needed to be closed still state to hold their position. It seems that the label name Exit On Close does not match the exit position name each strategy needs to calculate it's theoretical position, so these open positons stay unchanged while NT closed them with the forced Exit On Close. From this moment strategies need to be disabled manually to set them on zero position again, otherwise no new entries are triggered.

    Is there any way to work this out another way? TheToTime method is not an option, while the strategies trigger on the On Bar Update and not every day a new bar is triggered near the end of a session (2 renko strategy). Flatten everything under the Initialize isn't an option also, while this disables all strategies. I just need the name label Exit On Close to match the open strategies. Now the Exit On Close orders are unique orders not matching the one they are in fact closing.

    Kind regards,
    Francis

    #2
    Hello Francis,
    The strategy will close the positions as per the strategy position and not the Net position (total of all strategies + manually placed trades).

    Any system generated orders will be tagged the default name (like "Exit on close" or "Stop loss" etc).

    Unfortunately these are default behavior and to change this you have to custom code your own logic/exit codes.
    JoydeepNinjaTrader Customer Service

    Comment


      #3
      Hello Joydeep,

      Thanks for responding.

      So there is no way to match the Exit On Close orders with the strategies? This way the Exit On Close is a one time daily action, after which the strategies with open positions have to be resetted manually when using the Exit on Close feature. Is that what you say?

      When using the Exit On Close and Exit On Close Seconds code under Initialize in de strategy code, is this any different then setting the Exit On Close by the UI strategy settings? Is there a chance NT sees this Exit On Close as a part of that individual strategy, or is it the exact same exit as when using the UI?

      Comment


        #4
        Hello Francis,
        If you set Exit on close to true, then the exit orders will be sent by NinjaTrader as per the strategy position and there's no way to override it. However if you want to place the exit orders by further custom coding your strategy then you can check the net position of the instrument via unsupported NinjaScript codes.

        The functionality for Exit on close will be the same, whether set via the Strategy parameter box or via setting in in the Initialize section of the code. Exit on close will be as per strategy position only.
        JoydeepNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Johnny Santiago, Today, 07:06 AM
        0 responses
        3 views
        0 likes
        Last Post Johnny Santiago  
        Started by HiddenPhilosopher, Today, 04:37 AM
        1 response
        21 views
        0 likes
        Last Post NinjaTrader_ChristopherS  
        Started by aprendiz, Today, 06:44 AM
        1 response
        2 views
        0 likes
        Last Post NinjaTrader_Jim  
        Started by frankduc, Today, 06:35 AM
        1 response
        5 views
        0 likes
        Last Post NinjaTrader_Jim  
        Started by Trexxx, Today, 06:34 AM
        0 responses
        2 views
        0 likes
        Last Post Trexxx
        by Trexxx
         
        Working...
        X