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:	153
Size:	36.8 KB
ID:	1186187

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Mindset, 04-21-2026, 06:46 AM
      0 responses
      89 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by M4ndoo, 04-20-2026, 05:21 PM
      0 responses
      135 views
      0 likes
      Last Post M4ndoo
      by M4ndoo
       
      Started by M4ndoo, 04-19-2026, 05:54 PM
      0 responses
      68 views
      0 likes
      Last Post M4ndoo
      by M4ndoo
       
      Started by cmoran13, 04-16-2026, 01:02 PM
      0 responses
      119 views
      0 likes
      Last Post cmoran13  
      Started by PaulMohn, 04-10-2026, 11:11 AM
      0 responses
      69 views
      0 likes
      Last Post PaulMohn  
      Working...
      X