Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Order placed below the market

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

    Order placed below the market

    Good morning,

    I woul like to set a StopLoss 6 tick below my entry price.

    So I add to my strategy :

    Code:
    [FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2]
    SetStopLoss([/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800000][FONT=Courier New][SIZE=2][COLOR=#800000][FONT=Courier New][SIZE=2][COLOR=#800000]""[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2],CalculationMode.Ticks,[/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080]6[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2],[/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff]false[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2]);
    [/SIZE][/FONT][/SIZE][/FONT]
    But I have the following error : "Buy stop or buy stop limit orders can't be placed below the market. affected Order : BuyToCover 1 Stop @ 5986.5"

    How can I avoid this ? Because it happend after 9 trades.

    Regards,
    S

    #2
    SMuhr, are you adding this in the Initialize() of your strategy?
    BertrandNinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_Bertrand View Post
      SMuhr, are you adding this in the Initialize() of your strategy?
      Yes

      Thank you for your help

      Comment


        #4
        Ok, with which order type are you entering then? Do you check those off against the inside market before submitting them for execution?
        BertrandNinjaTrader Customer Service

        Comment


          #5
          I am enterring like this :

          Code:
          [FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2]
          EnterLong(2,[/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800000][FONT=Courier New][SIZE=2][COLOR=#800000][FONT=Courier New][SIZE=2][COLOR=#800000]""[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2]);[/SIZE][/FONT][/SIZE][/FONT]
          [FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2]EnterShort(2,[/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800000][FONT=Courier New][SIZE=2][COLOR=#800000][FONT=Courier New][SIZE=2][COLOR=#800000]""[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2]);
          [/SIZE][/FONT][/SIZE][/FONT][/SIZE][/FONT][/SIZE][/FONT]

          Comment


            #6
            SMuhr, thanks - do you change your StopPrice dynamically in the OnBarUpdate() part? Then you would need to reset the stop value when you're flat like in our PriceModification sample, otherwise you can submit at old stop price values which may have become invalid in the meantime...

            BertrandNinjaTrader Customer Service

            Comment


              #7
              Well done !

              Thx !

              Comment


                #8
                In fact, I still have the problem...
                It happens only once on 7 days... (FDAX 09-10 ---> around 2pm (GMT+1 Paris)

                Any idea why ?
                Thx

                Comment


                  #9
                  SMuhr, I would then suggest checking into with TraceOrders what is exactly happening at this time prompting for the error to show up - http://www.ninjatrader.com/support/f...ead.php?t=3627
                  BertrandNinjaTrader Customer Service

                  Comment


                    #10
                    Here is the output :

                    01/09/2010 14:15:00 Entered internal SetStopTarget() method: Type=Stop FromEntrySignal='' Mode=Ticks Value=3 Currency=0 Simulated=False
                    01/09/2010 14:15:00 Entered internal PlaceOrder() method at 01/09/2010 14:15:00: BarsInProgress=0 Action=SellShort OrderType=Market Quantity=5 LimitPrice=0 StopPrice=0 SignalName='Entry' FromEntrySignal=''
                    01/09/2010 14:15:00 Entered internal SetStopTarget() method: Type=Stop FromEntrySignal='' Mode=Ticks Value=3 Currency=0 Simulated=False
                    01/09/2010 14:15:00 Entered internal SetStopTarget() method: Type=Stop FromEntrySignal='' Mode=Ticks Value=3 Currency=0 Simulated=False
                    01/09/2010 14:15:00 Entered internal PlaceOrder() method at 01/09/2010 14:15:00: BarsInProgress=0 Action=SellShort OrderType=Market Quantity=5 LimitPrice=0 StopPrice=0 SignalName='Entry' FromEntrySignal=''
                    01/09/2010 14:15:00 Entered internal SetStopTarget() method: Type=Stop FromEntrySignal='' Mode=Ticks Value=3 Currency=0 Simulated=False
                    **NT** Strategy 'MarketdeltaUHF/7cb1c2a91f8148fd8697dd25aa708331' submitted an order that generated the following error 'OrderRejected'. Strategy has sent cancel requests, attempted to close the position and terminated itself.
                    01/09/2010 14:15:00 CancelAllOrders: BarsInProgress=0
                    01/09/2010 14:15:00 Entered internal PlaceOrder() method at 01/09/2010 14:15:00: BarsInProgress=0 Action=BuyToCover OrderType=Market Quantity=5 LimitPrice=0 StopPrice=0 SignalName='Close' FromEntrySignal=''
                    01/09/2010 14:15:00 Disable() called: strategy disabled
                    01/09/2010 14:15:00 CancelAllOrders: BarsInProgress=0
                    **NT** Disabling NinjaScript strategy 'MarketdeltaUHF/7cb1c2a91f8148fd8697dd25aa708331'
                    Do you have an idea?

                    Thanks

                    Comment


                      #11
                      SMuhr, the stop is probably just to close to the market (3 Ticks) - do you see the same error with a larger one?
                      BertrandNinjaTrader Customer Service

                      Comment


                        #12
                        It work if I use a stop loss of 15 tick....
                        Why ? It s to big

                        SOme time it work with 3

                        Comment


                          #13



                          The problem is that at 14:14:59 the price is 5997.5 and 1 sec after at 14:15:00 the price is at 5983.5.

                          That is why I have an error with the StopLoss.

                          Is there a work arround for this ?

                          regards,
                          S

                          Comment


                            #14
                            SMuhr,

                            Unfortunately there is no workaround as that is simply what the data is. Your data is spiking down and as such the stop loss you are trying to place becomes invalid and is rejected. The only "workaround" is to submit stop losses in your code that are far enough and early enough to not have this occur, but in reality the market can always spike large amounts to make your stop invalid.
                            Josh P.NinjaTrader Customer Service

                            Comment

                            Latest Posts

                            Collapse

                            Topics Statistics Last Post
                            Started by andrewtrades, Today, 04:57 PM
                            1 response
                            5 views
                            0 likes
                            Last Post NinjaTrader_Manfred  
                            Started by chbruno, Today, 04:10 PM
                            0 responses
                            3 views
                            0 likes
                            Last Post chbruno
                            by chbruno
                             
                            Started by josh18955, 03-25-2023, 11:16 AM
                            6 responses
                            436 views
                            0 likes
                            Last Post Delerium  
                            Started by FAQtrader, Today, 03:35 PM
                            0 responses
                            7 views
                            0 likes
                            Last Post FAQtrader  
                            Started by rocketman7, Today, 09:41 AM
                            5 responses
                            19 views
                            0 likes
                            Last Post NinjaTrader_Jesse  
                            Working...
                            X