The async C# style of coding is not valid for use in NinjaScript, any sample you find that includes that type of use you can ignore. You should never use C# threading logic in NinjaScript because that will cause problems with how your script processes the code in those methods.
if (Bars.IsFirstBarOfSession)
priorTradesCumProfit = SystemPerformance.AllTrades.TradesPerformance.Curr ency.CumProfit;
Code:
protected override void OnBarUpdate()
{
// No point in trying to do historical trades without the signals
if (State == State.Historical)
return;
...
}
..which means my:
Code:
if (BarsInProgress == 0)
{
if (Bars.IsFirstBarOfSession)
{
pDaily = SystemPerformance.AllTrades.TradesPerformance.NetP rofit;
}
...
}
...will never be called unless it's running at 6pm ET. But I can make the same assignment at the start of my trading session, and then I need to save it somewhere, and read it back in if it exists.
So can you offer a link to how to do that correctly?

Comment