Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Error when Executing Trades

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

    Error when Executing Trades

    I'm attempting to run NinjaTrader_Jim 's Gap Reversal Strategy, available here: https://ninjatraderecosystem.com/use...al-strategy-2/
    And whenever it is about to execute a trade in real time market conditions, it always gives the error: "Sell Stop or Sell Stop Limit Orders can't be placed above the market" and cancels the trade and strategy. Is there anything I can do to fix this?

    #2
    Hello akm39,

    Thank you for your post.

    On what instrument and interval are you running the strategy? How many days of data are you loading on the chart?

    What are the settings you're using for the Strategy? If you can provide a screenshot, that would be helpful.

    Is this occurring when the entry orders are placed or after they are filled, when the stop is placed? I note the entry conditions in the strategy place stop market orders fairly close to the current price so if you're using this on a volatile instrument it's very possible the price could move so the stop market is on the wrong side of the market and would get rejected. Let's look at that code:

    // Entry Conditions
    if (draw && Position.MarketPosition == MarketPosition.Flat)
    {
    if (IsTradeLong && pdClose > gapLevel && Close[0] <= gapLevel + 0.5)
    {
    EnterLongStopMarket(gapLevel + 0.5, "Gap Reverse Long Entry");
    SetTrailStop(CalculationMode.Ticks, Stop);
    }
    else if (IsTradeShort && pdClose < gapLevel && Close[0] >= gapLevel - 0.5)
    {
    EnterShortStopMarket(gapLevel - 0.5, "Gap Reverse Short Entry");
    SetTrailStop(CalculationMode.Ticks, Stop);
    }
    }

    So, looking at that , if you change 0.5 to something larger, that could distance the entry order further away from the current price and reduce the chances of it ending up on the wrong side of the market by the time it reaches your broker.

    Please let us know if we may be of further assistance to you.

    Comment


      #3
      Hi NinjaTrader_Kate, I'm currently using it on SPY, with the chart as it follows below:

      I think you might be entirely right about the needing to be changed to a different number, but the issue is, I'm submitting the orders in a SIM-101 account, so practically there shouldn't be that much slippage. It seems to work properly now though, thank you!
      Click image for larger version

Name:	image_2022-01-18_111130.png
Views:	142
Size:	36.8 KB
ID:	1186187

      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
      129 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