NexusFi: Find Your Edge


Home Menu

 





How to start background process in NT 8 when Control Panel start?


Discussion in NinjaTrader

Updated
      Top Posters
    1. looks_one vantojo with 3 posts (0 thanks)
    2. looks_two Quick Summary with 1 posts (0 thanks)
    3. looks_3 zweistein with 1 posts (0 thanks)
    4. looks_4 sam028 with 1 posts (0 thanks)
    1. trending_up 3,051 views
    2. thumb_up 0 thanks given
    3. group 4 followers
    1. forum 4 posts
    2. attach_file 0 attachments




 
Search this Thread
  #1 (permalink)
 vantojo 
Vilcabamba, Ecuador
 
Experience: Intermediate
Platform: Ninja
Trading: NQ, UB
Posts: 204 since Jul 2012

Hello,

Does anyone have code samples of how to write a NT 8 AddOn that will start with Ninjatrader Control Panel?

I now have background processes running OK in NT7. But never really liked the restrictions placed by the NT 7 architecture for such processing requirements.

One process is is for internal/external messaging via MSMQ and XMPP servers the other is a one time (load internal static lists from SQL). Neither connects to a data stream from the broker.

If someone has a code sample I can study it will save me hours of wading through documentation looking for the answer.

Many Thanks!


Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Third Circuit Backs Kalshi in Landmark Ruling -- Predict …
Prediction Markets & Event Contracts
Cboe Launches BITVX Bitcoin Volatility Index and Unveils …
Prediction Markets & Event Contracts
TradingView Opens Volume Footprint Data to Pine Script - …
TradingView
BofA Projects $1.1 Trillion in Sports Event Contracts -- …
Prediction Markets & Event Contracts
Q1 2026 Shatters All Derivatives Volume Records -- CME H …
Traders Hideout
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Sober Journey With S&P
21 thanks
2026 Jlab journal
10 thanks
Trying to learn Volume and price action correlation
8 thanks
Algo automated / semi-automated trading anyone?
6 thanks
Lady Vols Primer: Trading Volatility Journal
5 thanks
  #3 (permalink)
 vantojo 
Vilcabamba, Ecuador
 
Experience: Intermediate
Platform: Ninja
Trading: NQ, UB
Posts: 204 since Jul 2012


at first look it seems this may work...

probably OnWindowsCreated() in an AddOn to hook the Control Panel startup .... ??

will post if I get it working


Started this thread Reply With Quote
  #4 (permalink)
 
sam028's Avatar
 sam028 
Site Moderator
 
Posts: 3,756 since Jun 2009
Thanks Given: 3,825
Thanks Received: 4,632

Why not save a workspace with this AddOn then use this workspace by default?


Success requires no deodorant! (Sun Tzu)
Follow me on X Reply With Quote
  #5 (permalink)
 vantojo 
Vilcabamba, Ecuador
 
Experience: Intermediate
Platform: Ninja
Trading: NQ, UB
Posts: 204 since Jul 2012

Ok, with some hacking I have it working...it is simple once I could get myself out of the way.... :-)

The task at hand was to load SQL database parameters into public static variables during startup. These then configure my strategies and indicators. In NT7 I had to kludge this, but in NT8 it actually feels like the architecture can accommodate this easily.

I moved the public static variables into a non-ninja namespace/class in CS file in AddOns. The Ninja editor will open it and make changes, save it back just like it was an AddOn.

And, then it is relatively simple....in an AddOn...to load data from SQL tables during the Ninja startup

protected override void OnStateChange()
{
if (State == State.SetDefaults)
{
}
else if (State == State.Configure)
{
t1 = new Thread (new ThreadStart (LoadSQLData));
t1.Start();
}
}

I started another thread so that the startup process was not encumbered waiting for the database login, access, etc.


Started this thread Reply With Quote




Last Updated on November 24, 2017


© 2026 NexusFi®, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Downloads - Top
no new posts