Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How to set a stop loss

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

    How to set a stop loss

    I create an order like this in a method:

    ExitShortStopMarket(0,
    true,
    OrderQuantity,
    adjustedStopPrice,
    signalName,
    order.FromEntrySignal);​

    In the OnOrderUpdate() method, I check for the fill status and attempt to create a stop loss order.

    The code below executes, but no stop loss ever shows up. The order object is passed into the OnOrderUpdate() method as a parameter.

    ExitShortStopMarket(0,
    true,
    OrderQuantity,
    adjustedStopPrice,
    signalName,
    order.FromEntrySignal);

    What am I missing?​

    #2
    Hello sultanofsuede,

    Thank you for your post.

    I recommend taking a look at this example script which demonstrates using OnOrderUpdate and OnExecutionUpdate to submit protective orders, compare this to your own script to see where the issue may be occurring:



    Please let us know if you need further guidance.

    Comment


      #3
      Hi thx for the reply!

      I found the docs for OnExecutionUpdate and moved the logic for stop loss/target profit creation to there. My stuff works now.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Mindset, 04-21-2026, 06:46 AM
      0 responses
      90 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by M4ndoo, 04-20-2026, 05:21 PM
      0 responses
      135 views
      0 likes
      Last Post M4ndoo
      by M4ndoo
       
      Started by M4ndoo, 04-19-2026, 05:54 PM
      0 responses
      68 views
      0 likes
      Last Post M4ndoo
      by M4ndoo
       
      Started by cmoran13, 04-16-2026, 01:02 PM
      0 responses
      120 views
      0 likes
      Last Post cmoran13  
      Started by PaulMohn, 04-10-2026, 11:11 AM
      0 responses
      69 views
      0 likes
      Last Post PaulMohn  
      Working...
      X