Any way to find the root cause for the hang issue?
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
Performance/Hang Issues
Collapse
X
-
Hello ark321,
Thanks for your post.
If you are hearing order confirmation sounds, it is likely that your condition to place the order is stuck evaluating to true and the exit order is happening right away, causing an endless entry/exit loop.
Could you confirm if your strategy is encountering an endless loop?
Or, are you hearing the order confirmation sounds occasionally and the strategy is working as expected but the platform is frozen?
To see if the strategy is encountering an endless entry/exit loop, you could change the exit method as a test by removing the exit so that the strategy does not exit the position. Or, you could move the exit farther away from the entry order to ensure it does not get filled immediately after entering a position.
Note that you could also consider including BarsSinceEntryExecution or BarsSinceExitExecution to have the strategy wait a certain number of bars before entering/exiting a position.
See the help guide documentation below.
BarsSInceEntryExecution: https://ninjatrader.com/support/help...yexecution.htm
BarsSinceExitExecution: https://ninjatrader.com/support/help...texecution.htm
I look forward to further assisting.
Brandon H.NinjaTrader Customer Service
-
Hello ark321,
Thanks for your note.
Please test running the SampleMACrossOver strategy which comes default with NinjaTrader to see if the same behavior occurs.
If you do not see the same behavior when testing the SampleMACrossOver strategy, this likely means there is something in your code that is causing the behavior you are reporting.
To isolate where the issue in your script is coming from, debugging steps would need to be taken.
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).
Below is a link to a forum post that demonstrates how to use prints to understand behavior.
https://ninjatrader.com/support/foru...121#post791121
Please let me know if I may further assistBrandon H.NinjaTrader Customer Service
Comment
-
Hello ark321,
Thanks for your note.
If you do not see the same behavior occur when testing the SampleMACrossOver strategy that comes default with NinjaTrader, there is likely some code in your script that is causing the freezing issue to occur.
When working with any issue, it is important to take steps to isolate the issue so that the exact line causing the behavior can be found. This is a process of elimination and a process of debugging by adding prints.
First, it is great to create a copy of the script so that the original work is kept safe. Below is a link to a video that demonstrates making a copy of script.
https://www.youtube.com/watch?v=BA0W...utu.be&t=8m15s
Once the copy is created, the copy can be modified in any way without losing the original work.
The next step is to start commenting out code.
It's helpful to think about when the error is occurring to target areas, and comment code from everywhere else quickly. If at any point after removing some code, the error stops, add the last removed item back.
If the error is occurring while the script is loading, the issue is likely somewhere in OnStateChange(). In this situation its best to remove any logic in OnBarUpdate, remove any custom methods and classes, and remove as many properties as possible, while still being able to reproduce the error.
If the error is occurring when saving a template, the issue is likely with a private or public variable declaration. First, remove all logic leaving the variable declarations behind. (Empty State.Configure, State.Dataloaded, State.Historical, OnBarUpdate, OnMarketData, and remove any custom methods.) Then start removing the variables one by one and testing until the error stops. When the error stops add the last removed item back. Ensure that this item is private or property serialized or using the Browsable(false) attribute. (More about the Browsable attribute below)
If the error only occurs while the strategy is trading, this is likely a run time method. For this its best to use prints to understand the behavior.
Let us know if we may assist further.Brandon H.NinjaTrader Customer Service
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by StockTrader88, 03-06-2021, 08:58 AM
|
45 responses
3,991 views
3 likes
|
Last Post Today, 09:51 AM | ||
Started by TAJTrades, Today, 09:46 AM
|
0 responses
7 views
0 likes
|
Last Post
by TAJTrades
Today, 09:46 AM
|
||
Started by rhyminkevin, Yesterday, 04:58 PM
|
5 responses
62 views
0 likes
|
Last Post
by dp8282
Today, 09:36 AM
|
||
Started by realblubb, Today, 09:28 AM
|
0 responses
8 views
0 likes
|
Last Post
by realblubb
Today, 09:28 AM
|
||
Started by AaronKoRn, Yesterday, 09:49 PM
|
1 response
19 views
0 likes
|
Last Post
by Rikazkhan007
Today, 09:24 AM
|
Comment