RealTest User Guide
RealTest User Guide

 

 

Navigation: Realtest Script Language > Syntax Element Categories >

Trade Statistics Functions

 

 

 

 

These functions can be used in Results and/or Strategy formulas to drill down into the list of trades from the current test and calculate a few basic statistics about them.

Unlike the Indicator and Multi-Bar functions, the optional Count argument in these functions is a count of closed trades, not a count of bars or dates.

If the optional third argument Symbol is specified, Count applies to closed trades for that symbol.

Here are some example use cases:

Most often the items that you'll want to reference within these formulas will be Trade Record Values.

When called from a Strategy Element formula, Bar Data Values can also be referenced.

When called from a Results Section formula, only the Trade Record Values are available.

If you need to reference a trade-specific data value such as an ATR indicator, you can calculate it during the test using EntryTradeValue or ExitTradeValue and then access it for the formulas below using T.ValueIn or T.ValueOut.

The following trade statistics functions are provided:

TradeStatAvg - the average of trade record values for the most recent N trades or for all trades

TradeStatMax - the largest  of trade record values for the most recent N trades or for all trades

TradeStatMin - the smallest  of trade record values for the most recent N trades or for all trades

TradeStatStdDev - the standard deviation of trade record values for the most recent N trades or for all trades

TradeStatSum - the sum of trade record values for the most recent N trades or for all trades

 

 

 

 

Copyright © 2020-2024 Systematic Solutions, LLC