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 CarlTrading, 03-31-2026, 09:41 PM
    1 response
    43 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 04-01-2026, 02:41 AM
    0 responses
    20 views
    0 likes
    Last Post CarlTrading  
    Started by CaptainJack, 03-31-2026, 11:44 PM
    0 responses
    29 views
    1 like
    Last Post CaptainJack  
    Started by CarlTrading, 03-30-2026, 11:51 AM
    0 responses
    46 views
    0 likes
    Last Post CarlTrading  
    Started by CarlTrading, 03-30-2026, 11:48 AM
    0 responses
    38 views
    0 likes
    Last Post CarlTrading  
    Working...
    X