Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Stop/Limit targets being cancelled in multi TF

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

    Stop/Limit targets being cancelled in multi TF

    Hi

    I am backtesting a strategy that has been working fine in single timeframe. It uses managed orders and it resubmits the order on each OnBarUpdate () if not executed in the prior bar. There is a profit and stop target set. This is all on a 1m TF (BarsInProgress=0). By adding another longer timeframe (30m BarsInProgress=1) I have the situation where the longer timeframe OnBarUpdate () has no order (lets say it does nothing) to place so rather than doing nothing it deletes off the orders placed by the lower TF OnBarUpdate(). How is this solved? This is on Ninja 7.0.0.14.

    Thanks
    Rob

    Trace below...

    220/04/2010 10:30:00 Entered internal SetStopTarget() method: Type=Target FromEntrySignal='' Mode=Ticks Value=45.7183977323827 Currency=0 Simulated=False
    20/04/2010 10:30:00 Entered internal SetStopTarget() method: Type=Stop FromEntrySignal='' Mode=Ticks Value=137.155193197148 Currency=0 Simulated=False
    20/04/2010 10:30:00 Entered internal PlaceOrder() method at 20/04/2010 10:30:00: Action=SellShort OrderType=Limit Quantity=291,640 LimitPrice=2.7038'8 StopPrice=0 SignalName='Short1' FromEntrySignal=''
    20/04/2010 10:30:00 Cancelled expired order: BarsInProgress=1: Order='NT-00000/Backtest' Name='Short1' State=Working Instrument='$EURUSD' Action=SellShort Limit price=2.70388 Stop price=0 Quantity=291,640 Strategy='Foo' Type=Limit Tif=Gtc Oco='' Filled=0 Fill price=0 Token='fe2aa412296c451dba71e05fd3869022' Gtd='01/12/2099 00:00:00'

    #2
    Welcome to our forums and thanks for reporting in, this bug will be fixed with our next beta update round 15.

    Comment


      #3
      ok, thanks. you are aware this also happens in v 6.5? I.e. it's not a new bug in v7 - unless my code is wrong!

      Here is an example in NT6.5 - 1min TF sets an order up, it's executed and profit/target OCO put in place. At 15:30 the 1m does an update to the targets which is ignored as they are already in place. Immediately afterwards the 30m OnBarUpdate () comes along and deletes them off....

      Regards
      Rob

      22/04/2010 15:00:00 Entered internal SetStopTarget() method: Type=Stop FromEntrySignal='Short1' Mode=Ticks Value=446.957744629758 Currency=0 Simulated=False
      Enter: 1.342 Target: 1.34040313615619 Stop:1.34679059153142
      22/04/2010 15:01:00 Entered internal SetStopTarget() method: Type=Target FromEntrySignal='Short1' Mode=Ticks Value=159.6863843807 Currency=0 Simulated=False
      22/04/2010 15:01:00 Entered internal SetStopTarget() method: Type=Stop FromEntrySignal='Short1' Mode=Ticks Value=479.059153142099 Currency=0 Simulated=False
      22/04/2010 15:30:00 Entered internal SetStopTarget() method: Type=Stop FromEntrySignal='Short1' Mode=Ticks Value=479.059153142099 Currency=0 Simulated=False
      22/04/2010 15:30:00 Entered internal PlaceOrder() method at 22/04/2010 15:30:00: Action=SellShort OrderType=Limit Quantity=83,496 LimitPrice=1.3420 StopPrice=0 SignalName='Short1' FromEntrySignal=''
      22/04/2010 15:30:00 Ignore order amendment: Action=SellShort OrderType=Limit Quantity=83496 LimitPrice=1.3420 StopPrice=0 SignalName=Short1' FromEntrySignal='' Reason='Order already has this stop price/limit price/quantity'
      Enter: 1.342 Target: 1.34027303161765 Stop:1.34718090514704
      22/04/2010 15:30:00 Cancelled expired order: BarsInProgress=1: Order='NT-00359/Back101' Name='Short1' State=Working Instrument='$EURUSD' Action=SellShort Limit price=1.342 Stop price=0 Quantity=83,496 Strategy='Foo' Type=Limit Tif=Gtc Oco='' Filled=0 Fill price=0 Token='7997f8eb6af14a149e42f49f0fadc588' Gtd='01/12/2099 00:00:00'

      Comment


        #4
        Hi Rob, thanks to clarify - the fixed bug I'm referring to relates to using SetStopLoss and SetProfitTarget in a MultiSeries context. If you see regular Enter and Exit methods orders expire on the next OnBarUpdate() this is expected and was the same in 6.5, if you did not set them to liveUntilCancelled.

        Comment


          #5
          Thanks, yes, the error in handling of SetProfit and SetStopLoss in a multi TF strategy is the problem I have. Glad to hear it's going to be fixed!

          Comment

          Latest Posts

          Collapse

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