I need to use account size function in my strategy when backtesting.
For example: Stop trading if account size < 95000.
I tried by this way:
1) I set the account size on initialize function:
protected override void Initialize()
{
...
AccountSize = 100000;
...
}
2) I give this instruction inside OnBarUpdate function:
protected override void OnBarUpdate()
{
if (AccountSize < 95000) return;
...
}
But it's not working. When the account size goes below 95000 the strategy keeps working.
Any help will be appreciated.
Thank You
Comment