Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

marking stop loss orders

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

    marking stop loss orders

    I want to block my strategy to generate a new order in case it was stoped.
    I ve created an variable wasStoped = true, which is set up true on onExecution method, when name of execution == Stop loss. Aparently, the wasStoped scheme is working well, however as the new order generator is already activated (the strategy is short, and there is a new position short ready to go, not generated due to EntriesPerDirection = 1), the strategy opens another unwanted position even with wasStoped == true.

    Is a more secure way to avoid open the same position when stoped?

    #2
    Hello dafonseca,

    If you want to ensure that you are flat before placing a new order use:

    if (Position.MarketPosition == MarketPosition.Flat)
    {
    // enter order here
    }

    If you are wanting to ensure that a stop loss was filled before allowing the order, use a bool (which I think this is what you have done) and set this to true after the order fills in OnExecution. Reset this back to false after the next order is made.
    Chelsea B.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    633 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    364 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    105 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    567 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    568 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X