I want to create my own class, and instantiate it in a Indicator or Strategy, but have private variables in it. I can't seem to do that in an AddOn.
Here is what I want to do..
Here is the class I want to create
namespace NinjaTrader.NinjaScript
{
public static class TestMe
{
private NinjaScript ns; // ns container to print
private NinjaScriptBase nsb; // nsb container
private int TestInt;
public static void TestInit (this NinjaScript tns, NinjaScriptBase tnsb, int SetTestInt)
{
ns = tns;
nsb = tnsb;
TestInt = SetTestInt;
}
public static void TestMeDraw1(this NinjaScript ns, NinjaScriptBase nsb, double TickSize, double y)
{
DrawingTools.Draw.Dot(nsb, "testDot", true, 0, TickSize + y, Brushes.Red);
}
public static void TestMeDraw2(double TickSize, double y)
{
DrawingTools.Draw.Dot(tnsb, "testDot", true, 0, TickSize + y, Brushes.Red);
}
}
}
Then create and run it from an Indicator/Strategy.
TestMe.TestInit (this, this);
TestMe.TestMeDraw1(this, this, TickSize, High[0]);
// new code that I want to run - ns and nsb are then set for this indicator from the TestInit
TestMe.TestMeDraw(TickSize, High[0]);
I would then put a bunch of code in that class.
How do I do this, and where do I put the code? I tried in a AddOn, and I get errors saying it all has to be static....
Thanks
Comment