Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Stop Loss and Profit Target Cancelling at End of Day

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

    Stop Loss and Profit Target Cancelling at End of Day

    I have a strategy set to run on daily bars. We are using Kinetic historical bars combined with a continuum live feed. The strategy is defaulted to DAY orders as the entry stops I want to cancel at the end of each trading day if not executed. The entry orders are working as they should.

    If our entry is executed a stop loss and take profit OCO pair are submitted by the strategy. These are both calculated on each bar update. This part is working for the execution bar but then at the open of the next bar the newly calculated stop loss and take profit are not being submitted. If I disable and re-enable the strategy the stop loss and target are submitted at the correct levels.

    I want these stop loss and take profit orders to be dynamically re-calculated and re-submitted (modified) on each bar update (new daily bar).

    I have not tested the system with GTC as the TIF, perhaps this would transfer from the entry order to the stop loss and take profit exit orders? However if this did prevent the current issue is there a way to then cancel the entry order at the end of each bar/day?

    Any advice would be much appreciated.

    Andy

    #2
    Hello AndyVevo,

    Thank you for your post.

    You can cancel your entry order using CancelOrder(): http://ninjatrader.com/support/helpG...ancelorder.htm

    For the Stop Loss and Profit Target not re-submitting at newly calculated price levels on the new bar, I would ask if you are using SetStopLoss and SetProfitTarget or are you using ExitLongStop/ExitShortStop and ExitLongLimit/ExitShortLimit?
    When you re-calculate the values, how and where are you re-submitting the orders?

    Comment


      #3
      Hi Patrick,

      Thanks for your reply.

      In OnBarUpdate():

      I initially calculate the stoploss (LongTS) and take profit (LongProfit) levels then still under OnBarUpdate() I later use this code to enter the stops:

      SetStopLoss("Long Entry", CalculationMode.Price, LongTS[0], false);
      SetProfitTarget("Long Entry", CalculationMode.Price, LongProfit[0]);

      The strategy is defaulted to DAY orders, including the entry orders (e.g. "Long Entry")

      When we have a live position on the exchange the stop loss and profit are entered correctly for the entry bar. However at the end of this daily bar the stops are cancelled and new stop loss and take profit not entered at the start of the next daily bar, while we still have a live position. Not ideal obviously!

      If I then disable and re-enable the strategy the position is picked up and the stop loss and take profit are entered at the new correct levels.

      Am I correct in my understanding that the only way to have the strategy enter exit orders on every new daily bar is to change the entry TIF to GTC?

      If so I assume I would need to either use the CancelOrder() for our entry orders. Or I could move to ExitLongStop/ExitShortStop and ExitLongLimit/ExitShortLimit orders where I could specify them as GTC?

      Either is possible but I want to confirm that the TIF of the entry order (currently set to DAY) is the reason SetStopLoss and SetTakeProfit are not being re-entered after the entry bar.

      I have mostly been testing the strategy on minute bars and the stop loss and take profit have always been entered on every new bar so the only reason I can see for the difference in my SIM/testing and live account is the move to daily bars and the TIF of my stops being limited to DAY.

      Just trying to understand why we are not seeing the exits re-entered after the entry bar/day so I can come up with a solution.

      Thanks again for your help.

      Comment


        #4
        Hello AndyVevo,

        Thank you for your response.

        You would use TIF set to GTC for the strategy.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by cmtjoancolmenero, Yesterday, 03:58 PM
        11 responses
        39 views
        0 likes
        Last Post cmtjoancolmenero  
        Started by FrazMann, Today, 11:21 AM
        0 responses
        3 views
        0 likes
        Last Post FrazMann  
        Started by geddyisodin, Yesterday, 05:20 AM
        8 responses
        52 views
        0 likes
        Last Post NinjaTrader_Gaby  
        Started by DayTradingDEMON, Today, 09:28 AM
        4 responses
        26 views
        0 likes
        Last Post DayTradingDEMON  
        Started by George21, Today, 10:07 AM
        1 response
        22 views
        0 likes
        Last Post NinjaTrader_ChristopherJ  
        Working...
        X