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 RookieTrader, Today, 09:37 AM
    1 response
    7 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by alifarahani, Today, 09:40 AM
    0 responses
    3 views
    0 likes
    Last Post alifarahani  
    Started by Gerik, Today, 09:40 AM
    0 responses
    1 view
    0 likes
    Last Post Gerik
    by Gerik
     
    Started by KennyK, 05-29-2017, 02:02 AM
    3 responses
    1,283 views
    0 likes
    Last Post NinjaTrader_Clayton  
    Started by AttiM, 02-14-2024, 05:20 PM
    11 responses
    184 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Working...
    X