Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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.
    Gaby V.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Graci117, Today, 09:02 PM
    1 response
    5 views
    0 likes
    Last Post NinjaTrader_Manfred  
    Started by ETFVoyageur, Today, 07:55 PM
    0 responses
    7 views
    0 likes
    Last Post ETFVoyageur  
    Started by janio973, Today, 07:24 PM
    1 response
    7 views
    0 likes
    Last Post NinjaTrader_Manfred  
    Started by aligator, 01-06-2022, 12:14 PM
    4 responses
    246 views
    0 likes
    Last Post john_44573  
    Started by reynoldsn, Today, 05:56 PM
    0 responses
    14 views
    0 likes
    Last Post reynoldsn  
    Working...
    X