Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Backtest - Managed Approach: ExitShortLimit not triggered - get Exit on Close instead

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

    Backtest - Managed Approach: ExitShortLimit not triggered - get Exit on Close instead

    My strategy opens a position with:

    EnterShortLimit(GetCurrentAsk(), "SHORT");

    I then have this code to set the exit point:

    protected override void OnPositionUpdate(Position position, double averagePrice, int quantity, MarketPosition marketPosition) {
    //Log("=== TYPE ===:" + position.MarketPosition, NinjaTrader.Cbi.LogLevel.Warning);
    if (marketPosition == MarketPosition.Short) {
    Log("ExitShortLimit:" + EMA(barsEMA)[0], NinjaTrader.Cbi.LogLevel.Warning);
    ExitShortLimit(EMA(barsEMA)[0], "SHORT");
    } else if (marketPosition == MarketPosition.Long) {
    Log("ExitLongLimit:" + EMA(barsEMA)[0], NinjaTrader.Cbi.LogLevel.Warning);
    ExitLongLimit(EMA(barsEMA)[0], "LONG");
    }
    }

    In the backtest I see the orders correctly, but it did not trigger. I eventually closed the position with "Exit on Session Close" a few days later. See pic attached.

    Why did the ExitShortLimit(EMA(barsEMA)[0], "SHORT"); not happen?

    Thanks.
    Attached Files

    #2
    Hello jamesmjones00123,

    Thanks for writing in to our Support Forums.

    I see that the order was placed, but I cannot confirm that the market conditions were true to have the the order filled.

    Please verify that the market price has crossed the EMA limit price. Please provide me a screenshot where the order should have triggered.

    To send a screenshot with Windows 7 or newer we recommend using Window's Snipping Tool.

    Click here for instructions

    Alternatively to send a screenshot press Alt + PRINT SCREEN to take a screenshot of the selected window. Then go to Start--> Accessories--> Paint, and press CTRL + V to paste the image. Lastly, save as a jpeg file and send the file as an attachment.

    Click here for detailed instruction


    There are times where the price can be hit, but it will not fill a limit order. In these circumstances you will be better served to use market orders instead of limit orders. For example, does your strategy exit at that price when using ExitShort()?

    Our Brokerage Support team has further information on order types listed on their website: http://www.ninjatraderbrokerage.com/...er_limit_order

    I look forward to assisting you further.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by NullPointStrategies, Today, 05:17 AM
    0 responses
    51 views
    0 likes
    Last Post NullPointStrategies  
    Started by argusthome, 03-08-2026, 10:06 AM
    0 responses
    127 views
    0 likes
    Last Post argusthome  
    Started by NabilKhattabi, 03-06-2026, 11:18 AM
    0 responses
    69 views
    0 likes
    Last Post NabilKhattabi  
    Started by Deep42, 03-06-2026, 12:28 AM
    0 responses
    42 views
    0 likes
    Last Post Deep42
    by Deep42
     
    Started by TheRealMorford, 03-05-2026, 06:15 PM
    0 responses
    46 views
    0 likes
    Last Post TheRealMorford  
    Working...
    X