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
strategy won't place stops
Collapse
X
-
strategy won't place stops
Hi, can you please review and tell me why the strategy won't place stops (at all)?Tags: None
-
Hello trader3000a,
Thank you for your note.
While I do see stops being placed with the attached test script, I think you're pretty likely to run into issues here. You're setting the stop to the low of the previous bar. If the low of the prior bar is equal to the open of the next bar, and the price immediately continues to move down, you're going to get a rejected order as Stop Market orders cannot be placed above the current market price. If this occurs, the strategy will disable itself. This may be what's occurring when you're testing. Also, keep in mind that if you're running this On Bar Close, the stop order for the entry will not be placed until the close of the bar the entry was made on, as the position will not have had time to update, so if you're running this on a 60 minute chart, the stop wouldn't get placed until the 60 minute bar the order was placed on closes.
Do you see stops being placed when using the test reproduction below? If not, what instrument and bar type/interval are you testing with?
Thanks in advance; I look forward to assisting you further.Attached FilesKate W.NinjaTrader Customer Service
-
Hi Kate, I realize now that what I want to do is this:
1. We get a green candle with a higher low and a higher high than the prior red candle
2. Provided that price is above the high of that red candle, place a limit buy order at that red candle's high, and a stop loss at that red candle's low
I get buy orders filled, but no stops are generated. I can't get the strategy builder to place a stop. I tried asking it to wait until a 3rd bar's price is above the red candle's high to place the orders, but it still only places the buy order. Any losing trades hold until the end of session.
Is it because, in the strat builder, we can't place a stop unless we are filled first? And at that point, I can't figure out how to tell it to look back to that first red candle's low since the fill could be any number of candles later...Last edited by trader3000a; 09-24-2021, 07:28 AM.
Comment
-
Hello trader3000a,
Thank you for your reply.
Yes, exit orders would be ignored until the entry order has filled. This would apply to any strategy using the Managed Approach, not just Strategy Builder strategies.
You could save the low price of the bar to a variable called something like StopPrice when the entry order is placed. Then, when the position is long, submit the ExitLongStopMarket. I'd again caution you with this that if you have two bars, one red, one green where the low and high are above the prior low and high, but they don't have a very large range, and are followed by wider ranging bars, you could easily hit that same issue with the stop price being above the market by the time the order has filled. I've attached an example script that illustrates this approach, and if you run it for a bit you'll likely run into a rejection for that reason. I would suggest calculating the stop price as a number of ticks off the average entry price instead to avoid this scenario.
Please let us know if we may be of further assistance to you.Attached FilesKate W.NinjaTrader Customer Service
Comment
-
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by andrewtrades, Today, 04:57 PM
|
1 response
4 views
0 likes
|
Last Post Today, 05:02 PM | ||
Started by chbruno, Today, 04:10 PM
|
0 responses
3 views
0 likes
|
Last Post
by chbruno
Today, 04:10 PM
|
||
Started by josh18955, 03-25-2023, 11:16 AM
|
6 responses
436 views
0 likes
|
Last Post
by Delerium
Today, 03:42 PM
|
||
Started by FAQtrader, Today, 03:35 PM
|
0 responses
6 views
0 likes
|
Last Post
by FAQtrader
Today, 03:35 PM
|
||
Started by rocketman7, Today, 09:41 AM
|
5 responses
19 views
0 likes
|
Last Post Today, 03:33 PM |
Comment