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 2,286 views
    2. thumb_up 0 thanks given
    3. group 4 followers
    1. forum 4 posts
    2. attach_file 0 attachments




 
Search this Thread

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

  #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?
Pivot Indicator like the old SwingTemp by Big Mike
NinjaTrader
Trade idea based off three indicators.
Traders Hideout
Better Renko Gaps
The Elite Circle
MC PL editor upgrade
MultiCharts
Exit Strategy
NinjaTrader
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Just another trading journal: PA, Wyckoff & Trends
26 thanks
Diary of a simple price action trader
26 thanks
Tao te Trade: way of the WLD
23 thanks
My NQ Trading Journal
16 thanks
HumbleTraders next chapter
9 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,765 since Jun 2009
Thanks Given: 3,825
Thanks Received: 4,629

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

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


© 2024 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 - Privacy Policy - Downloads - Top
no new posts