I have custom methods in a strategy and want to use them also in other strategies. I don't want to duplicate all the code for every strategy.
For testing reasons I just tried to access a custom method DoPrint() in my MyMethods Strategy which only prints the actual Time.
Here is the code of my MyMethods Stragtegy:
namespace NinjaTrader.NinjaScript.Strategies
{
public class MyMethods : Strategy
{
public void DoPrint()
Print(String.Format("{0}", Time[0]));
}
}
namespace NinjaTrader.NinjaScript.Strategies
{
public class TestStrategy : Strategy
{
MyMethods mm = new MyMethods();
protected override void OnBarUpdate()
{
if (CurrentBar < 20)
return;
mm.DoPrint();
}
}
}
Thanks!

Comment