Some context what I'm trying to do before the question. I want to run virtual strategy (can be Sim account or not existed account created in memory) which will produce virtual SystemPerformance which I can use in main Strategy which is running normally. I understand that I'm asking something advanced and it is fine with me if it will be something un-documented and can stop working with future releases.
My question what would be the right way to do that? And what the minimum required properties I have to assign. I'm attaching simple code to better illustrate what I would like to have:
namespace NinjaTrader.NinjaScript.Strategies
{
public class MainStrategy : Strategy
{
private SampleMACrossOver virtualStrategy;
protected override void OnStateChange()
{
if (State == State.SetDefaults)
{
Name = "MainStrategy";
Calculate = Calculate.OnBarClose;
}
else if (State == State.Configure)
{
virtualStrategy = new SampleMACrossOver();
}
}
protected override void OnBarUpdate()
{
virtualStrategy.Update(CurrentBar, BarsInProgress);
Print(virtualStrategy.SystemPerformance.AllTrades.TradesCount);
}
}
}
Looking forward for your advice.
Comment