My hardware specification: Intel i5 2410M 2.3Ghz and can be overclocked to 2.9Ghz with 8G ddr3 ram running under Windows 7.
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Performance issue
Collapse
X
-
Performance issue
I have created a strategy with a custom indicator which required the option "Calculate on Bar Close" set to false. The strategy and NT runs smoothly in the beginning. However, after 2-3 hrs of operation, NT will freeze. I have tried running the strategy using market replay and live simulation, and both encounter the same issue. CPU consumption will max to 100% in the case just mentioned. Note that there are no error message in the log.
My hardware specification: Intel i5 2410M 2.3Ghz and can be overclocked to 2.9Ghz with 8G ddr3 ram running under Windows 7.Tags: None
-
Radical, thank you for your reminder
Actually the indicator and strategy is based on tick data of certain length and calculate like the vwap. I notice the problem seems relating to the complex calculation because for each incoming tick the indicator will be re-calculated and once the data accumulates to a certain interval...the performance gradually decline and eventually freeze. When i set the "Calculation on bar close to false" this problem will not surface.
Comment
-
taihung82, you would only see issue with this specific strategy / indicator being run for a prolonged amount of time, correct? Have you tested your setup for example as well with the NT default SampleMACrossOver strategy?
It sounds like you would need to inspect your custom indicator being called with COBC = false to see where areas of efficiency improvement in it's code could be applied to facilitate it's resource use over time.
Comment
-
Hi, Bertrand
Thank you for your suggestion. I am checking the code and trying to identify the deficiency. In the mean time, i also added a SetStopLoss in the OnBarUpdate section. However, although the initial stop is in place correctly, it does not update once further condition is met. Please see below code for detail. As mentioned previously, CalculateOnBarClose is set to false.
if (Position.MarketPosition == MarketPosition.Long)
{
SetStopLoss(CalculationMode.Ticks, 10);
if (Close [0] >= Position.AvgPrice + 15 * TickSize)
SetStopLoss(CalculationMode.Ticks, Position.AvgPrice + 3 * TickSize);
}
else if (Position.MarketPosition == MarketPosition.Short)
{
SetStopLoss(CalculationMode.Ticks, 10);
if (Close [0] <= Position.AvgPrice + (- 15) * TickSize)
SetStopLoss(CalculationMode.Ticks, Position.AvgPrice + (-3) * TickSize);
}
Comment
-
Try to put your static initial stop part in the strategies Initialize() - SetStopLoss(CalculationMode.Ticks, 10);
And then have only the dynamic / updating part in the OnBarUpdate().
What happens likely with your code is you always reset the stoploss to the static 10 tick one in the next coming OnBarUpdate() as the commands are simply processed sequentially.
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by Geovanny Suaza, 02-11-2026, 06:32 PM
|
0 responses
647 views
0 likes
|
Last Post
|
||
|
Started by Geovanny Suaza, 02-11-2026, 05:51 PM
|
0 responses
368 views
1 like
|
Last Post
|
||
|
Started by Mindset, 02-09-2026, 11:44 AM
|
0 responses
108 views
0 likes
|
Last Post
by Mindset
02-09-2026, 11:44 AM
|
||
|
Started by Geovanny Suaza, 02-02-2026, 12:30 PM
|
0 responses
571 views
1 like
|
Last Post
|
||
|
Started by RFrosty, 01-28-2026, 06:49 PM
|
0 responses
573 views
1 like
|
Last Post
by RFrosty
01-28-2026, 06:49 PM
|

Comment