Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

SetTrailingStop and ExitShort/LongLimit

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

    SetTrailingStop and ExitShort/LongLimit

    Hey guys,

    I am having a helluva time trying to set SetTrailingStop() and ExitShort/LongLimit() at the same time.

    The error I'm getting is the one where it tells you your Exit() method has been ignored and I need to see internal order handling rules.

    Here is the code in OnExecutionUpdate():

    Code:
        SetTrailStop(sell, CalculationMode.Ticks, TrailStopValue, false);
        if (TargetTicks > 0)
        {
            double limitPrice = execution.Order.AverageFillPrice - TargetTicks * TickSize;
            ExitShortLimit(0, true, Qty, limitPrice, "Profit target", sell);    
        }
    Just because I like trying different things until something works, I switched it around and got the same error, only it complained the Set() method was ignored as opposed to the Exit() method being ignored.

    I'm thinking that should work. Am I wrong? Are the two not compatible? I searched the forum and didn't see anyone else having this issue...

    #2
    Hello traderpards,

    Thanks for the note.

    Please review the internal order handling rules here:



    This is what you are running into specifically:

    Methods that generate orders to exit a position will be ignored if:
    ...
    • A position is open and an order submitted by a set method (SetStopLoss() for example) is active
    You would need to use the Unmanaged approach to ignore whatever errors are being thrown by the managed approach. Using the Unmanaged approach will also mean that you need to handle all possible errors with your code.

    More on the Unmanaged approach here:


    Please let me know if I may be of any further assistance.

    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