Set Process Priority To High, Giving It Preference Over Other Applications That Are Running.

Running NinjaTrader at High Priority instead of Normal Priority will result in faster order submission and faster chart updates. See section Window 10 Process Priority And Application Performance below for the explanation. NT may have to do a lot of processing before this Indicator changes NT's Process Priority to High. I submitted suggestion feature tracking ID SFT-5285 that would allow NT to set it Process Priority to High at startup. This would allow NT to have a faster startup time and processing, eliminating the need for this Indicator. You can vote for feature tracking ID SFT-5285 and read about my suggestion at New NT General Option To Specify Its Process Priority - NinjaTrader Support Forum.

All the applications running on your computer equally share your computer's resources. The NinjaTrader application runs at Normal Priority with all the other applications. Especially during fast markets, when other applications are running on your computer, NT is not processing incoming data as quickly as your computer would allow and possibly losing trade data from your market data service. By default, this Indicator sets NinjaTrader's Process Priority to High, giving it preference over other applications that are running.

This Indicator allows you to set NT's Process Priority to one of four values: High, Above Normal, Normal, or BelowNormal. You may want to use High during your trading day and Normal at other times. You could also set it to BelowNormal to do backtesting in the background while you use your computer for other tasks. Remember to set it back before the trading day starts. There is a priority higher than High, but it should never be used for an application. Real-time priority is the highest priority. It’s a higher priority than mouse input, keyboard input, and the disk cache.

"Windows shares the processor time between all running processes based upon their priority level in a round-robin fashion. If a process has a higher priority, it gets more processor time compared to a process having a lower priority. . . . The changes you make to the priority level of the current instance of an application or process are only temporary and not set permanently. Once you close the application or restart the PC, Windows will automatically set the priority back to default for the process or application."

Adding this Indicator to one chart in your Workspace will set NinjaTrader's Process Priority until you exit NT or you change it. The Indicator will check before setting the Priority and do nothing if Priority is already set to the Priority specified in its parameter. Only add this Indicator to one chart in a Workspace. Otherwise, if on two or more charts with different Priority then NT's Priority will toggle OnBarUpdate.

Indicator: SetNinjaTradersPriorityHigh

Parameters:

Select Priority - Select High, Above Normal, Normal, or BelowNormal for NinjaTrader's Process Priority. The Default is High.
NT's priority will be checked OnStateChange State.Configure and OnBarUpdate.

Hide Indicator Name - Prevent display of Indicator's name at top of chart if true. Default is false. See screenshot.

Show NT Priority - Display NT's Priority at top of chart. Default is true. See screenshot.

To have nothing displayed at top of chart set Hide Indicator Name parameter to true and Show NT Priority to false. See screenshot.

Debug message to Output Window - If true then debugging Output messages printed.
Debugging messages only written to Output Window when NT's Priority is changed.

Window 10 Process Priority And Application Performance.

The definitive source on Window 10 process priority and application performance is https://docs.microsoft.com/en-us/win...ectedfrom=MSDN . It begins: "Threads are scheduled to run based on their scheduling priority. Each thread is assigned a scheduling priority. The priority levels range from zero (lowest priority) to 31 (highest priority). Only the zero-page thread can have a priority of zero. (The zero-page thread is a system thread responsible for zeroing any free pages when there are no other threads that need to run.)

The system treats all threads with the same priority as equal. The system assigns time slices in a round-robin fashion to all threads with the highest priority. If none of these threads are ready to run, the system assigns time slices in a round-robin fashion to all threads with the next highest priority. If a higher-priority thread becomes available to run, the system ceases to execute the lower-priority thread (without allowing it to finish using its time slice) and assigns a full time slice to the higher-priority thread." my emphasis.

Running NT at a higher than normal priority means that it will get preference for not only to the CPU but also preference over other applications for receiving and sending data over the Internet and I/O to NT files. "If a higher-priority thread becomes available to run, the system ceases to execute the lower-priority thread (without allowing it to finish using its time slice) and assigns a full time slice to the higher-priority thread."

Therefore, running NT at a higher than normal priority can allow NT to submit orders faster and update charts faster and than NT could if running at a normal priority with other applications. The degree of the performance improvement will depend on the CPU load, Internet I/O, and disk I/O done by Windows 10 and other applications running with NT.

Change Log:

Updated: Jul 26, 2021 - Text only no need to reinstall indicator.
Updated: Jun 30, 2021 - Priority checked OnStateChange State.Configure and OnBarUpdate. Debugging messages only written to Output Window when Priority is changed. More information added to debugging messages.
Updated: Oct 21, 2015 - New Priority value of BelowNormal. New pram Show NT Priority. Priority now also checked/set in State.Terminated.
Updated: Oct 16, 2015 - Priority changed only when required.
Updated: Oct 16, 2015 File & Text ‐ Converted from NT 7. New parameter Debug message to Output Window.
Create Date: Oct 16, 2015

Created By James.R.Walker (Jim W.)
NinjaTrader Version 8
File Size 2.5 KB
Create Date 10/16/2015
# of Downloads 714

Importing to NinjaTrader 8 is Easy!

To import your 3rd party app or add-on to NinjaTrader, simply follow these 3 steps:

  1. Download the app or add-on file to your desktop
  2. From the NinjaTrader Control Center window, select the menu Tools > Import > NinjaScript Add-On…
  3. Select the downloaded file from your desktop

Questions?

Visit the NinjaScript File Sharing discussion in the NinjaTrader user forum to interact with fellow traders and the NinjaTrader support team.