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
ExitShort not working in Strategy Analyzer
Collapse
X
-
ExitShort not working in Strategy Analyzer
I have long used Market Replay for testing but I'm trying to get the hang of Strategy Analyzer to speed up testing. My strategy uses ExitShort() and ExitLong() to get out of positions. This has always worked in Market Replay but in Strategy Analyzer, it will take the trade but then not close when it's supposed to. In other words, after S/A completes, I open the chart and I see the entry and the exit just gets passed by and doesn't close. What do I need to know to get this working?Tags: None
-
Hello reynoldsn,
Thanks for your post.
To understand exactly how the strategy logic is behaving, it is necessary to add debugging prints to the strategy (outside the conditions) that prints all the values being used in the condition to place the Exit orders along with the time of the bar.
Prints will appear in a New > NinjaScript Output window.
See the NinjaTrader Support articles linked below for more information about debugging with Print() and TraceOrders: https://support.ninjatrader.com/s/ar...nd-TraceOrders
For more information about comparing strategy results and intrabar granularity, see this NinjaTrader Support article: https://support.ninjatrader.com/s/ar...rategy-Results
If a large amount of data is being output, you could instead write information to a text file using a StreamWriter: https://ninjatrader.com/support/help...o_write_to.htmBrandon H.NinjaTrader Customer Service
- Likes 1
-
Hello reynoldsn,
Thanks for your notes.
I am happy to hear that you see the Strategy Analyzer processing trades when backtesting your custom NinjaScript strategy.
Computer memory is important for long resource-intensive tests that generate a large number of trades without your machine stalling. Computer processor speed is important to get optimization iterations done quickly and the number of CPU cores allows for more iterations to run simultaneously.
The amount of data you are testing over could affect the performance of a Backtest/Optimization and the number of iterations being processed affect the performance of the Optimization.
You could try reducing the amount of data you are testing over to improve the performance of Backtests in the Strategy Analyzer.
You can easily control the number of iterations involved in Optimizations to improve optimization speed/performance and you can also consider writing your strategies to use IsInstantiatedOnEachOptimizationIteration = false; (Which requires that we reset class level variables in State.DataLoaded.)
See the help guide documentation below for more information about running optimizations.
IsInstantiatedOnEachOptimizationIteration —
https://ninjatrader.com/support/helpGuides/nt8/isinstantiatedoneachoptimizationiteration.htm?zoom _highlightsub=IsInstantiated
Optimization Tips —
https://ninjatrader.com/support/helpGuides/nt8/index.html?optimize_a_strategy.htm#UnderstandingFa ctorsThatAffectOptimizationPerformance
Walk Forward Optimization — https://ninjatrader.com/support/help...e_a_strate.htm
Genetic Optimization — https://ninjatrader.com/support/helpGuides/nt8/genetic_algorithm.htmLast edited by NinjaTrader_BrandonH; 04-30-2024, 02:45 PM.Brandon H.NinjaTrader Customer Service
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by bortz, 11-06-2023, 08:04 AM
|
49 responses
1,769 views
0 likes
|
Last Post Today, 11:16 AM | ||
Started by Vietanhnguyen2hotmailcom, Today, 10:29 AM
|
3 responses
9 views
0 likes
|
Last Post Today, 11:05 AM | ||
Started by milfocs, Yesterday, 07:23 PM
|
3 responses
13 views
0 likes
|
Last Post Today, 10:43 AM | ||
Started by kenz987, Today, 10:20 AM
|
1 response
10 views
0 likes
|
Last Post Today, 10:31 AM | ||
Started by PaulMohn, 04-24-2024, 03:49 AM
|
2 responses
33 views
0 likes
|
Last Post
by PaulMohn
Today, 10:31 AM
|
Comment