Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

why isn't the EnterShortStopMarket or Long working?

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

    why isn't the EnterShortStopMarket or Long working?

    I'm calling this method and I keep getting the "Sell stop or sell stop limit orders can't be placed above the market..." error

    Code:
    if(Open[0] >= Close[1] && Close[0] < Open[1] && Open[1] < Close[1])
    {
    Print("Buying Short");
    stopOrder = EnterShortStopMarket(High[0]);
    Print("Stop Order: " + stopOrder.ToString());
    ordersEntered = true;
    return;
    }

    #2
    Hello brettcomardelle93,

    A sell stop market order must be below the bid, just like when placing manual orders.

    Are you certain that High[0] is less than GetCurrentBid()?

    Are you using prints to make sure that High[0] is less than GetCurrentBid()?
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      To be clear, the EnterShortStopMarket() should short at the market price and then set a stop at the price provided, right?
      If it isn't, and I have to place something lower than the High[0], than this isn't doing what I need it to do.

      I am wanting to buy at the close[0] and set a stop at the High[0] if the close is less than the high.
      In the case of a short on a red candle, it should be true. The High[0] would be higher than the Close[0]

      I just need a sliver of code that shows how to do this. On bar close, buy at the close[0] (or market if I can't use limit) and also set the loss to be equal to the High of that bar (if short).

      Comment


        #4
        Hello brettcomardelle93,

        A stop market order is placed above the ask for a buy and below the bid for a sell and fills at the current market price when touched.

        If you want a sell order below the bid, this will need to be a limit order or market-if-touched order (which is a simulated order).

        Try placing these orders manually on the SuperDOM or ChartTrader to understand how to place orders.
        https://ninjatrader.com/support/foru...546#post562546

        An entry sell limit order can be placed above the bid with EnterShortLimit(). Below is a link to the help guide.
        https://ninjatrader.com/support/help...shortlimit.htm


        Where you have mentioned:
        "I am wanting to buy at the close[0] and set a stop at the High[0] if the close is less than the high."

        This will not be possible. Targets which are limit orders are placed above the entry for a long position, stop losses which are stop orders are placed below the entry.

        A long exit limit order can be placed with ExitLongLimit().
        https://ninjatrader.com/support/help...tlonglimit.htm
        Last edited by NinjaTrader_ChelseaB; 08-26-2020, 03:51 PM.
        Chelsea B.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Mindset, 04-21-2026, 06:46 AM
        0 responses
        90 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by M4ndoo, 04-20-2026, 05:21 PM
        0 responses
        137 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
        120 views
        0 likes
        Last Post cmoran13  
        Started by PaulMohn, 04-10-2026, 11:11 AM
        0 responses
        71 views
        0 likes
        Last Post PaulMohn  
        Working...
        X