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 CaptainJack, 05-29-2026, 05:09 AM
    0 responses
    163 views
    0 likes
    Last Post CaptainJack  
    Started by CaptainJack, 05-29-2026, 12:02 AM
    0 responses
    81 views
    0 likes
    Last Post CaptainJack  
    Started by charlesugo_1, 05-26-2026, 05:03 PM
    0 responses
    125 views
    0 likes
    Last Post charlesugo_1  
    Started by DannyP96, 05-18-2026, 02:38 PM
    1 response
    206 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 05-11-2026, 05:56 AM
    0 responses
    184 views
    0 likes
    Last Post CarlTrading  
    Working...
    X