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()?
    https://ninjatrader.com/support/foru...121#post791121
    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 RobotSyndicate, Today, 04:27 AM
        0 responses
        1 view
        0 likes
        Last Post RobotSyndicate  
        Started by Ray12345, Today, 04:10 AM
        0 responses
        2 views
        0 likes
        Last Post Ray12345  
        Started by Behungr101, Today, 02:16 AM
        1 response
        8 views
        0 likes
        Last Post NinjaTrader_Jason  
        Started by omermirza, Yesterday, 08:37 PM
        2 responses
        12 views
        0 likes
        Last Post NT-Roland  
        Started by aelagha, Today, 01:28 AM
        1 response
        12 views
        0 likes
        Last Post NinjaTrader_Jason  
        Working...
        X