Thank you all for your help!
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
The First Exit Will Sometimes Get Me All Out
Collapse
X
-
The First Exit Will Sometimes Get Me All Out
Hi, I have a strat going that once i enable it, it will get me in, get a first off, and then get me out of the remaining position. The bot works as it should for like 2 or 3 trades and then randomly during another trade, it goes to get my half my position off and instead it gets me all out. Additionally, it will sometimes get my first off properly and then when it goes to get my 2nd off it will properly get me out but then also put me into a trade with half my normal position in the opposite direction. It's very strange, I wonder if there's a setting I'm not clicking? I was thinking it might be something like the first order not getting filled right away, so it puts in another order, and both get filled? I'm not sure if this is actually the problem just an idea.
Thank you all for your help!Tags: None
-
Hello MikePari,
Thanks for your post.
Debugging steps would need to be taken to determine how the strategy is behaving and placing orders.
To understand why the script is behaving as it is, such as placing orders or not placing orders when expected, it is necessary to add prints to the script that print the values used for the logic of the script to understand how the script is evaluating.
In the strategy add prints (outside of any conditions) that print the values of every variable used in every condition that places an order along with the time of that bar.
Prints will appear in the NinjaScript Output window (New > NinjaScript Output window).
Also, enable TraceOrders which will let us know if any orders are being ignored and not being submitted when the condition to place the orders is evaluating as true.
Below is a link to a forum post that demonstrates how to use prints to understand behavior.
https://ninjatrader.com/support/foru...121#post791121
Let me know if I may assist further.<span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by ntbone, Today, 01:50 AM
|
7 responses
27 views
0 likes
|
Last Post
![]()
by bltdavid
Today, 11:46 AM
|
||
Started by nicbizz, Yesterday, 02:14 AM
|
2 responses
18 views
0 likes
|
Last Post
![]()
by rayko
Today, 10:51 AM
|
||
Started by Babbou72, 02-15-2025, 08:37 PM
|
29 responses
137 views
0 likes
|
Last Post
![]()
by Babbou72
Today, 10:41 AM
|
||
Started by stevepmay, Today, 09:00 AM
|
2 responses
11 views
0 likes
|
Last Post
![]()
by stevepmay
Today, 10:27 AM
|
||
Started by Powerbucker, Today, 09:12 AM
|
2 responses
14 views
0 likes
|
Last Post
![]()
by Powerbucker
Today, 09:30 AM
|
Comment