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 AaronKoRn, Today, 09:49 PM
    0 responses
    11 views
    0 likes
    Last Post AaronKoRn  
    Started by carnitron, Today, 08:42 PM
    0 responses
    10 views
    0 likes
    Last Post carnitron  
    Started by strategist007, Today, 07:51 PM
    0 responses
    11 views
    0 likes
    Last Post strategist007  
    Started by StockTrader88, 03-06-2021, 08:58 AM
    44 responses
    3,980 views
    3 likes
    Last Post jhudas88  
    Started by rbeckmann05, Today, 06:48 PM
    0 responses
    9 views
    0 likes
    Last Post rbeckmann05  
    Working...
    X