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 sam028 with 1 posts (0 thanks)
    3. looks_3 Quick Summary with 1 posts (0 thanks)
    4. looks_4 zweistein with 1 posts (0 thanks)
    1. trending_up 3,466 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?
Bitcoin’s 2022 low, 2025 high and 2026 low so far arou …
Cryptocurrency
requesting .nrd replay files from 2026 spy and qqq
The Elite Circle
What we know about Binances $6.3bn hack - BBC News
Cryptocurrency
[WTS] ATAS Lifetime ULTRA license – EU buyers only – …
Platforms and Indicators
AI for Traders — Agents, Memory, Tools & Real-Worl …
Elite Quantitative GenAI/LLM
 
  #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 Administrator
 
Posts: 3,779 since Jun 2009
Thanks Given: 3,840
Thanks Received: 4,709

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


Success requires no deodorant! (Sun Tzu)
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