Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Entry signal on last bar.

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

    Entry signal on last bar.

    Hallo.
    I developed strategy for Forex. Strategy has exit on close = false and if the Friday's last bar closing price generate entry signal the order is placed Monady open price. In this case stoploss order is ignored.
    Code:
    14/3/2008 16:00:00 Entered internal PlaceOrder() method at 14/3/2008 16:00:00: Action=Buy OrderType=Market Quantity=25,000 LimitPrice=0 StopPrice=0 SignalName='MyEntryLong1' FromEntrySignal=''
    14/3/2008 16:00:00 Entered internal PlaceOrder() method at 14/3/2008 16:00:00: Action=Sell OrderType=Stop Quantity=25,000 LimitPrice=0 StopPrice=1.5676 SignalName='MyStopLong1' FromEntrySignal='MyEntryLong1'
    14/3/2008 16:00:00 Ignored PlaceOrder() method at 14/3/2008 16:00:00: Action=Sell OrderType=Stop Quantity=25,000 LimitPrice=0 StopPrice=1.5676 SignalName=MyStopLong1' FromEntrySignal='MyEntryLong1' Reason='Invalid order price, please see log tab'
    14/3/2008 16:00:00 Entered internal PlaceOrder() method at 14/3/2008 16:00:00: Action=Sell OrderType=Limit Quantity=25,000 LimitPrice=1.5933'5 StopPrice=0 SignalName='MyTargetLong1' FromEntrySignal='MyEntryLong1'
    Such situation happend to me during last ear back test 2 times. One time for long one time for short position. I use the same method and same code to place Limit order but only Stop is ignored.
    Where I can see the log tab?? and what could be the possible reason of this error??
    Rgds
    Czarek

    #2
    Czarek,

    The log tab is a tab in the Control Center. The error you are receiving is most likely due to an invalid price. You may be submitting a stop loss above the current traded market price. This is possible from gap ups and downs.
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      I use OnExecution method.
      Closing price -1.6573 - generate entry long signal
      Monday opening price 1.56795
      Stop price - 1.5676
      So the stop price is higher entry signal but lower the real entry price.
      OnExecution stop is placed after entry order execution. How too fix this problem?
      Czarek

      Comment


        #4
        Not sure I follow. You would only place your stop for your entry order after it has been executed.
        Josh P.NinjaTrader Customer Service

        Comment


          #5
          Do you think in my case the reason of ignore stop order is beacause of gap?
          Stop price is lower than entry execution price so stop should be placed without problem.

          Comment


            #6
            Czarek,

            You need to check TraceOrders logs along with your Control Center logs to figure out the exact reason. The gapping was only a suggestion as to a potential cause that happens to be one of the more common reasons when people run into these scenarios.
            Josh P.NinjaTrader Customer Service

            Comment


              #7
              Yes this is this problem.
              Log : 8/10/2008 12:32:43 Strategy A BuyToCover stop order placed at '14/1/2008 16:00:00' has been ignored since the stop price is less than or equal to the close price of the current bar. This is an invalid order and subsequent orders may also be ignored. Please fix your strategy.

              How to fix the strategy?
              Looks like now strategy do not allow to place Stop order over the entry signal, no matter the real execution price. Are the any way to change strategy to allow place stop order over the entry signal ( but of course lower the real entry price)??
              Czarek

              Comment


                #8
                Hi Czarek,

                I guess I still don't follow. What do you mean "over the entry signal"? You can only place stops as stated in the error, at price points less than or equal to the close price of the current bar.

                What that means for you is if your signal bar closes at 1000. You can only place stops below 1000 so let us say we place a stop at 950. When you come to your trade bar (the next bar) if that 950 is now an invalid price you will get the order rejected error. Reasons this price can be invalid could be if the trade bar's price is now 925.

                If you are using OnExecution() you should be fine for most cases. You send an entry. You get the entry's fill price. You place the stop according to the entry's fill price and NOT the entry's submit price. Depending on the way the current bar is building you may or may not receive the order rejection.

                You need to just fudge around with the stop loss to find a place where it will work for you. This is a problem of having not enough resolution in your backtesting bars. Aside from adding more granularity via multi-time frame strategy it is a limitation of backtesting in general.
                Josh P.NinjaTrader Customer Service

                Comment


                  #9
                  Sorry for my brockem english :-))
                  Situation is like that ( up side down your sample):
                  -Firday's last bar generate entry signal for long- closing price is 1000
                  -Order is not placed beacuse market is close.
                  -Monday Open price is 1200 and get poition one Long buying price 1200.
                  -Stop loss is 100 from entry price so strategy try to place stop loss with price 1100 and this order is ignored.
                  My question is: are the any way to programme strategy to do not ingnore such stop order??
                  In fact stop price is higher entry signal but lower entry price.
                  Czarek

                  Comment


                    #10
                    Czarek,

                    You are comparing it wrong. Remember this is backtesting and once you see a bar it is inoperable for trades.

                    This is what is really going on:
                    Friday: signal bar for trade. This bar is already closed so you can't trade on it therefore the trade is actually submitted at the next possible trading point (next bar's open).
                    Monday: entry is put in at 1200.
                    Monday: you now want to place ExitLongStop(), you calculate it to be 1100. Same reason why you couldn't trade on Friday applies here. This stop order is not submitted till the NEXT bar.
                    Monday #2: this is the bar where your ExitLongStop() can come into play. If the price on this bar is below 1100 then you will get the order ignored.

                    Now to sidestep this in backtesting you simply have to use the Set() methods or code with multi-time frames to add granularity. This is a limitation to backtesting in general and there is no other way about it.
                    Josh P.NinjaTrader Customer Service

                    Comment


                      #11
                      Josh.
                      Set() methods resolved problems.
                      Thank you.
                      Rgds
                      Czarek.

                      Comment

                      Latest Posts

                      Collapse

                      Topics Statistics Last Post
                      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                      0 responses
                      647 views
                      0 likes
                      Last Post Geovanny Suaza  
                      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                      0 responses
                      368 views
                      1 like
                      Last Post Geovanny Suaza  
                      Started by Mindset, 02-09-2026, 11:44 AM
                      0 responses
                      108 views
                      0 likes
                      Last Post Mindset
                      by Mindset
                       
                      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                      0 responses
                      571 views
                      1 like
                      Last Post Geovanny Suaza  
                      Started by RFrosty, 01-28-2026, 06:49 PM
                      0 responses
                      573 views
                      1 like
                      Last Post RFrosty
                      by RFrosty
                       
                      Working...
                      X