Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Unexpected order price from SetStopLoss()

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

    Unexpected order price from SetStopLoss()

    Hello NT-Support,

    My custom strategy returns the following two error messages:
    **NT** Strategy 'TestSimplifiedStrategy' submitted an order that generated the following error 'OrderRejected'. Strategy has sent cancel requests, attempted to close the position and terminated itself.
    and...
    Market Replay Connection, Sell stop or sell stop limit orders can't be placed above the market. affected Order: Sell 1 Stop @ 1146,25
    Apparently the SetStopLoss() method generates an invalid SellStop order. But I can't figure out why, although I have done all the trouble shooting I can think off. (To me it looks as if the SetStopLoss() method matches stop orders for long and short trades incorrectly.)
    Could you to take a look at my code? I have attached a simplified version with comments , print statements and TraceOrders = true.

    The error will occur if you run the strategy on a 5 min ES chart in a trending market with COBC = true.

    - COBC = true.
    - Managed approach
    - Entry Orders are live until cancelled
    - SetStopLoss() and SetProfitTarget() are set in the OnExecution method
    - Cancelled and rejected entry orders are reset in OnOrderUpdate()
    - Stop- and target prices are dynamically updated in OnBarUpdate()
    - Stop- and target prices are reset in OnPositionUpdate and OnOrderUpdate() when cancelled or rejected entry orders are reset

    Best regards,
    Posedon_sthlm
    Attached Files
    Last edited by poseidon_sthlm; 09-05-2014, 03:01 AM. Reason: Improved print statments i attached strategy.

    #2
    poseidon_sthlm, for the 1146.25 stop price - which order price would instead expect here according to your calcs? Could it simply be dynamically updating the values to close to the inside market to cause the rejection? Something that would likely even be more pronounced trying to trade this script live, as delays are not factored into replay.

    I also see your using mode .Price and then not updating / resetting the Set method to an initial tick offset when you're in flat state > this should be done.

    Comment


      #3
      Thanks! A reset of the Set methods to an initial tick offset when in flat state solved the issue. I now understand how the Set method works.

      /Poseidon_Sthlm

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      633 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      364 views
      1 like
      Last Post Geovanny Suaza  
      Started by Mindset, 02-09-2026, 11:44 AM
      0 responses
      105 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
      0 responses
      567 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      568 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X