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

Handling Stop Loss Orders

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

    Handling Stop Loss Orders

    I've been struggling with order handling for a strategy that I'm working on.

    The problem arises when I scale out of a position (ex. long two contracts and then I cover one contract) and the associated stop loss order. I was under the assumption that if you place a stop loss order with the same entry signal (fromEntrySignal) then when a position is adjusted the stop order is automatically adjusted but it doesn't seem to be working that way.

    Here's an example:

    1) I go long 2 contracts: EnterLong(2, _lastSignal);
    2) Immediately following the "EnterLong" line of code, I place a stop loss: SetStopLoss(_lastSignal, CalculationMode.Ticks, 4, true);
    3) After x ticks in profit, I cover 1 contract: ExitLong(1, "Trim" + CurrentBar, _lastSignal);

    The problem I'm having is that the original stop loss order still reflects 2 contracts, so when it gets hit, I then get placed into a short position because the stop loss order was not adjusted to 1 contract.

    Is there a way to cancel a pending stop loss order? Or a way to adjust it?

    Any help would be greatly appreciated.

    #2
    troy_xp, the best would be to scale in with your entries (2 separate orders) to scale out later - http://www.ninjatrader-support2.com/...ead.php?t=3751
    BertrandNinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Mathias79, Today, 03:44 PM
    0 responses
    7 views
    0 likes
    Last Post Mathias79  
    Started by Austiner87, Today, 03:42 PM
    0 responses
    7 views
    0 likes
    Last Post Austiner87  
    Started by lorem, 04-25-2024, 09:18 AM
    19 responses
    81 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by joselube001, 05-10-2024, 12:17 PM
    6 responses
    29 views
    0 likes
    Last Post joselube001  
    Started by bigc0220, 09-18-2018, 09:16 AM
    6 responses
    2,587 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Working...
    X