Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

SetStopLoss in a fast market

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

    SetStopLoss in a fast market

    I was testing a strategy today on a live account mostly to see how it reacts under a large announcement in a very fast market.

    Here is entry code:

    EnterShortLimit(Instrument.MasterInstrument.Round2 TickSize(entry));
    SetProfitTarget(CalculationMode.Ticks, ProfitTarget);
    SetStopLoss(CalculationMode.Ticks, StopLoss);

    I got filled:

    1/27/2016 2:02:52 PM|1|32|Order='XXXXXXXXXX' Name='Buy' New state=Filled Instrument='YM 03-16' Action=Buy Limit price=16026 Stop price=0 Quantity=XX Type=Limit Filled=XX Fill price=16026 Error=NoError Native error=''

    1/27/2016 2:02:52 PM|1|64|Instrument='YM 03-16' Account='XXXXXXXXXXX' Avg price=16026 Quantity=XX Market position=Long Operation=Insert Currency=UsDollar

    But then my "SetStopLoss" got rejected immediately, because the market had moved below the intended price stop price before the order was sent through.

    1/27/2016 2:02:52 PM|1|32|Order='XXXXXXXXXXXX' Name='Stop loss' New state=Rejected Instrument='YM 03-16' Action=Sell Limit price=0 Stop price=16001 Quantity=XX Type=Stop Filled=0 Fill price=0 Error=OrderRejected Native error='Sell order stop price must be below last trade price ExchangeRejectCode = 2060[]'


    So, the question. Is there an order in which I can execute my "EnterShortLimit", "SetStopLoss" and "SetProfitTarget" to minimize this? The particular strategy I'm working on is meant to be turned off for news announcements like this, but I really wanted to see how it performed.

    Just to give the full picture, the market moved (YM-03-16) from 16063 -> 16000 in less than a second, and my strategy was right in the middle of that move.


    Cheers

    #2
    Hello,
    We would not be able to comment on what specific order of submitting these orders would be best.
    An option for you in these situations would be to implement custom logic for order rejection within RealtimeErrorHandling.
    For more information on RealtimeErrorHandling please see the following link: http://ninjatrader.com/support/helpG...orhandling.htm

    If we can be of any other assistance please let us know.
    Cody B.NinjaTrader Customer Service

    Comment


      #3
      Can you confirm if executing SetStopLoss before EnterShortLimit (in the above line of code) would put that live order in place before entering the position?

      Comment


        #4
        Hello,
        Placing SetStopLoss() before the EnterStopLimit order would not place the stop loss order before entering the position. SetStopLoss() is only executed when a position has been entered.
        When the SetStopLoss() method is called it sets the parameter for the stop order based off of the entry price of the entry order. For more information on this please see the following link on the SetStopLoss() method: http://ninjatrader.com/support/helpG...etstoploss.htm
        If we can be of any other assistance please let us know.
        Cody B.NinjaTrader Customer Service

        Comment


          #5
          What about this scenario:

          PHP Code:
          if (some condition) {
          ExitLongLimit(....);
          EnterLongLimit(....);

          In this scenario, what is the order that is sent to the exchange?

          Amed

          Comment


            #6
            Or should I just go the "unmanaged" approach if I want this type of type of control?

            Comment


              #7
              Hello,
              In this situation only the ExitLongLimit() order is submitted.
              You could accomplish both orders submitting to the account by using signal names for the orders and setting the EntryHandling to UniquieEntries.
              If we can be of any other assistance please let us know.
              Cody B.NinjaTrader Customer Service

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by bmartz, 03-12-2024, 06:12 AM
              5 responses
              33 views
              0 likes
              Last Post NinjaTrader_Zachary  
              Started by Aviram Y, Today, 05:29 AM
              4 responses
              13 views
              0 likes
              Last Post Aviram Y  
              Started by algospoke, 04-17-2024, 06:40 PM
              3 responses
              28 views
              0 likes
              Last Post NinjaTrader_Jesse  
              Started by gentlebenthebear, Today, 01:30 AM
              1 response
              8 views
              0 likes
              Last Post NinjaTrader_Jesse  
              Started by cls71, Today, 04:45 AM
              1 response
              8 views
              0 likes
              Last Post NinjaTrader_ChelseaB  
              Working...
              X