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 NullPointStrategies, Today, 05:17 AM
      0 responses
      20 views
      0 likes
      Last Post NullPointStrategies  
      Started by argusthome, 03-08-2026, 10:06 AM
      0 responses
      119 views
      0 likes
      Last Post argusthome  
      Started by NabilKhattabi, 03-06-2026, 11:18 AM
      0 responses
      63 views
      0 likes
      Last Post NabilKhattabi  
      Started by Deep42, 03-06-2026, 12:28 AM
      0 responses
      41 views
      0 likes
      Last Post Deep42
      by Deep42
       
      Started by TheRealMorford, 03-05-2026, 06:15 PM
      0 responses
      45 views
      0 likes
      Last Post TheRealMorford  
      Working...
      X