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; }
Announcement
Collapse
Looking for a User App or Add-On built by the NinjaTrader community?
Visit NinjaTrader EcoSystem and our free User App Share!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less
Partner 728x90
Collapse
NinjaTrader
why isn't the EnterShortStopMarket or Long working?
Collapse
X
-
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: -
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
-
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
-
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.htmLast 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 Rapine Heihei, Today, 08:19 PM
|
1 response
6 views
0 likes
|
Last Post Today, 08:30 PM | ||
Started by Rapine Heihei, Today, 08:25 PM
|
0 responses
5 views
0 likes
|
Last Post Today, 08:25 PM | ||
Started by f.saeidi, Today, 08:01 PM
|
1 response
4 views
0 likes
|
Last Post Today, 08:17 PM | ||
Change colour of Stop market and limit orders to red and green via indicator script
by Rapine Heihei
Started by Rapine Heihei, Today, 07:51 PM
|
0 responses
6 views
0 likes
|
Last Post Today, 07:51 PM | ||
Started by frslvr, 04-11-2024, 07:26 AM
|
5 responses
98 views
1 like
|
Last Post
by caryc123
Today, 07:47 PM
|
Comment