Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Trouble Setting Trail Stop

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

    Trouble Setting Trail Stop

    I have a strategy where:
    - I EnterLong/EnterShort using quantity and a signal name (which I call "signalName"). signalName is a global variable.

    - In OnOrderUpdate (where OrderState == OrderState.Filled and order.Name equals signalName), I call a function to set a trail stop

    - In this function, I attempt to set a trail stop using the format: SetTrailStop(signalName, CalculationMode.Price, target, true)


    Unfortunately, the trail stop doesn't get set. I never see an order generated for it.

    If I SetTrailStop without the signal name (for example, with CalculationMode.Ticks and a value), it works.

    Am I doing something wrong? Is SetTrailStop position level -- e.g., can I set it at an order level? I don't get an error message -- it just fails quietly. Thanks in advance.

    #2
    Hello micprice,

    Thank you for your post.

    You should be able to call SetTrailStop() in OnOrderUpdate() when the order is filled.

    Would you mind if we reviewed the full strategy? Or a version that results in the same behavior?

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Mindset, 04-21-2026, 06:46 AM
    0 responses
    102 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by M4ndoo, 04-20-2026, 05:21 PM
    0 responses
    144 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by M4ndoo, 04-19-2026, 05:54 PM
    0 responses
    71 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by cmoran13, 04-16-2026, 01:02 PM
    0 responses
    125 views
    0 likes
    Last Post cmoran13  
    Started by PaulMohn, 04-10-2026, 11:11 AM
    0 responses
    79 views
    0 likes
    Last Post PaulMohn  
    Working...
    X