Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

condition based on entry order

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

    condition based on entry order

    Hi i have a strategy and I have this condition that if i have open long order and if certain price action develops i want to cancel the order. Entry order is Breakout Short.
    my question is is this the right way to specify position is short and order is from Breakout Short only?
    If


    if (Position.MarketPosition == MarketPosition.Short && Position.Account.Name == "Breakout Short"
    && ((Close[1] < Open[1] && Low[0] < Low[1] && Close[0] > Open[1])
    || (Close[0] > Open[0] && Close[1] > Open[1] && Close[3] > Open[3]) // 3 closes
    || (Close[0] > High[3])))
    {

    ExitShort(Position.Quantity);
    }​​

    #2
    Hello tkaboris,

    Thank you for your post.

    Checking if Position.MarketPosition == MarketPosition.Short will ensure you are currently in a short position before executing the ExitShort().

    Can you clarify what you are trying to do with Position.Account.Name == "Breakout Short"? If you only want the ExitShort() to affect your "BreakoutShort" entry order, you can specify the fromEntrySignal to be BreakoutShort. This ties the exit to the entry and exits the position quantity represented by the actual entry.

    ExitShort(int quantity, string signalName, string fromEntrySignal)



    Please let us know if you have any further questions.

    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