Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

SetStopLoss and SetProfitTargets in OnExecutionUpdate

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

    SetStopLoss and SetProfitTargets in OnExecutionUpdate

    I am entering a a Position in OnBarUpdate then waiting for the Entry confirmation in OnExecutionUpdate to enter the stop loss and profit target based on the entry orders fill price. I am using SetStopLoss to set the stop and SetProfitTarget for the profit. Then in OnbarUpdate I am checking the price to determine if I move the Stop to Breakeven. The very first trade works fine (print everything to Output Window). The second trade has some lingering orders when I print from OnOrderUpdate. These orders are still in OnOrderUpdate State.Working after OnPositionUpdate is showing MarketPosition.Flat. The chart text and lines are showing all the correct trades, the rogue working orders ever get filled.

    Can I use SetStopLoss and SetProfitTarget in OnExectionUpdate? Can you toss a hint at other potential causes I should look for?

    #2
    Hello TAJTrades,

    Thanks for the post.

    It is possible to call SetStopLoss and SetProfitTarget in OnExectionUpdate, but I would recommend following this reference sample that uses OnOrderUpdate() and OnExecution() to enter protective orders.



    Please let me know if I can assist further.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by CarlTrading, 05-11-2026, 05:56 AM
    0 responses
    63 views
    0 likes
    Last Post CarlTrading  
    Started by CarlTrading, 05-10-2026, 08:12 PM
    0 responses
    35 views
    0 likes
    Last Post CarlTrading  
    Started by Hwop38, 05-04-2026, 07:02 PM
    0 responses
    198 views
    0 likes
    Last Post Hwop38
    by Hwop38
     
    Started by CaptainJack, 04-24-2026, 11:07 PM
    0 responses
    364 views
    0 likes
    Last Post CaptainJack  
    Started by Mindset, 04-21-2026, 06:46 AM
    0 responses
    283 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Working...
    X