Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

How to set a stop loss order manually in a RELIABLE way?

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

    How to set a stop loss order manually in a RELIABLE way?

    Hello,

    I now try to set my stop orders manually. This has issues, though. As you may know, orders expire with the bar.

    Here is what happened. It is not funny...

    ...
    20/07/2009 16:08:26 Entered internal PlaceOrder() method at 20/07/2009 16:08:26: Action=Sell OrderType=Stop Quantity=0 LimitPrice=0 StopPrice=8757 SignalName='' FromEntrySignal='HA L1'
    20/07/2009 16:08:26 Entered internal PlaceOrder() method at 20/07/2009 16:08:26: Action=Sell OrderType=Stop Quantity=0 LimitPrice=0 StopPrice=8757 SignalName='' FromEntrySignal='HA L2'
    20/07/2009 16:08:26 Entered internal PlaceOrder() method at 20/07/2009 16:08:26: Action=Sell OrderType=Stop Quantity=0 LimitPrice=0 StopPrice=8757 SignalName='' FromEntrySignal='HA L3'
    ...
    20/07/2009 16:08:27 Entered internal PlaceOrder() method at 20/07/2009 16:08:27: Action=Sell OrderType=Stop Quantity=0 LimitPrice=0 StopPrice=8757 SignalName='' FromEntrySignal='HA L1'
    20/07/2009 16:08:27 Ignored PlaceOrder() method at 20/07/2009 16:08:27: Action=Sell OrderType=Stop Quantity=0 LimitPrice=0 StopPrice=8757 SignalName=Sell' FromEntrySignal='HA L1' Reason='Invalid order price, please see log tab'
    20/07/2009 16:08:27 Entered internal PlaceOrder() method at 20/07/2009 16:08:27: Action=Sell OrderType=Stop Quantity=0 LimitPrice=0 StopPrice=8757 SignalName='' FromEntrySignal='HA L2'
    20/07/2009 16:08:27 Ignored PlaceOrder() method at 20/07/2009 16:08:27: Action=Sell OrderType=Stop Quantity=0 LimitPrice=0 StopPrice=8757 SignalName=Sell' FromEntrySignal='HA L2' Reason='Invalid order price, please see log tab'
    20/07/2009 16:08:27 Entered internal PlaceOrder() method at 20/07/2009 16:08:27: Action=Sell OrderType=Stop Quantity=0 LimitPrice=0 StopPrice=8757 SignalName='' FromEntrySignal='HA L3'
    20/07/2009 16:08:27 Ignored PlaceOrder() method at 20/07/2009 16:08:27: Action=Sell OrderType=Stop Quantity=0 LimitPrice=0 StopPrice=8757 SignalName=Sell' FromEntrySignal='HA L3' Reason='Invalid order price, please see log tab'

    Basically at the end of the bar the price was very close to the stop, by the time i was moving the order, it was invalid.

    How am I supposed to deal with this? Should I now move into orders that are valid GTC? Will a signal stop order be cancelled if the entry signal position is closed (not documented)? Or should I have to close the stop orders manually?

    #2
    NetTecture, which error do you get exactly in the Log tab as this occurs? Most likely you submit the stop at an incorrect price and this is the reason why it gets 'ignored'.

    If you do not like orders to expire at the end of the bar (default), then please use the liveUntilCancelled option - http://www.ninjatrader-support.com/H...verview36.html
    BertrandNinjaTrader Customer Service

    Comment


      #3
      Well, this is not the issue.

      Problem is:

      * I set stop losses.
      * I sort of assume that when I do so every bar, that will be "valid".
      * Sadly, as the price seems to jump, this error occurs.

      This is sort of a non-nice thing to do (sorry). It means, basically, one has to work with GTC orders, as - the "submit stuff per bar" may not work.

      I would suggest adding a paramter that "fixes the order" (i.e. - if that is a stop submitted, the price went through, sell market).

      My order handling code gets more and more complicated for stuff like that Now I have to move all things to GTC orders, simply because I loose stop orders between bars

      Slowly getting through, though

      Comment


        #4
        I'm not sure what you mean by 'loosing' stop orders, this would most likely depend on the conditions have in place to move the stops, printing out the actual stop value may help to debug this.

        You also should reset your stop losses once flat to some default value as in this sample - http://www.ninjatrader-support2.com/...ead.php?t=3222
        BertrandNinjaTrader Customer Service

        Comment


          #5
          Well, as I said - and it is in the shown logs.

          The problem basically is...

          * Bar closes. Stop is pretty much "at the bar" (1 tick away).
          * By the time my order gets entered, the price has moved - ergo the short is invalid.

          As I dont get any feedback from the method, I am stuck with the price going down and down below my stop level.

          I move my code now to GTC stops...
          ...SADLY this makes the whole API more complicated.

          Why?

          Because non-gtc I can just way "signal name".

          With GTC I have to give MY signal name, the amount to be closed. This is a lot more info

          One overload with just a "gtc boolean" vaiable would be nice.

          Comment


            #6
            Thanks for the suggestion NetTecture, have you tried selecting the GTC tif setting when starting up your strategy? - http://www.ninjatrader-support.com/H...romAChart.html
            BertrandNinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by lollers, Yesterday, 03:26 AM
            1 response
            46 views
            0 likes
            Last Post lollers
            by lollers
             
            Started by Salahinho99, 05-05-2024, 04:13 AM
            7 responses
            58 views
            0 likes
            Last Post Salahinho99  
            Started by knighty6508, 05-10-2024, 01:20 AM
            4 responses
            27 views
            0 likes
            Last Post knighty6508  
            Started by OllieFeraher, 05-09-2024, 11:14 AM
            6 responses
            19 views
            0 likes
            Last Post OllieFeraher  
            Started by PaulMohn, 05-02-2024, 06:59 PM
            2 responses
            44 views
            0 likes
            Last Post PaulMohn  
            Working...
            X