dbo.fn_TradeCount

Syntax:
dbo.fn_TradeCount(id_race, id_horse, id_strategy, status, pl)

Output:
(decimal) Returns the count of trades for a specific horse, race, strategy, status, p&l.

Input parameters:
id_race (integer)Id of the market. If zero, all trades from all races will be included.
id_horse (integer)Id of the runner. If zero, all trades from all horses will be included.
id_strategy (integer)Id of the strategy. If zero, all trades from all strategies will be included.
status (string)String containing one or more status codes.
Insert an empty string to count trades in all statuses.
Status codes of trades can be:
  • 'O' = open
  • 'C' = cancelled
  • 'F' = closed
  • 'S' = settled
pl (integer)Profit and loss status of the trades. Can be:
  • 0 = all
  • 1 = trades with positive profit
  • 2 = trades with negative profit

Example:

dbo.fn_TradeCount(0,0,@id_strategy,'FO',0)

returns the count of trades, in an open or closed status, for the current strategy, for all races and for all horses.