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.
|