information about positions during backtesting

yomm0401's avatar

yomm0401 since: 11 Apr 2020;

  22 Nov 2021, 11:07
information about positions during backtesting

How can I get information about my positions during backtesting?
It is not possible in the following way.

var positions = Positions.FindAll("", symbolname);

best regards.

amusleh's avatar

amusleh since: 01 Mar 2021;

  23 Nov 2021, 09:53


All the positions your cBot opens during back test and live is in Positions collection.

You don't have to use the FindAll method with empty label parameter, if you want to filter the current symbol positions you can do it by using Linq Where:

var positions = Positions.Where(position => position.SymbolName.Equals(SymbolName, StringComparison.OrdinalIgnoreCase));

If you have provided a label for your positions then use FindAll method.

Community Developer | Spotware | Telegram: @algodeveloper