results (int Mode, int Num): var

Sums up the results of the most recent trades by different criteria. 

Parameters:

Mode

Type of the result sum, a combination of:
0
     - sum up profits
+1   - return number of trades
+2
   - sum up entry/exit price differences
+3   - return average entry price
+8   - consider only open trades
+16 - consider only closed trades
+32 - consider only trades of current asset / algo combination
+64 - consider only winning trades
+128 - consider only losing trades
+256 - consider only long trades
+512 - consider only short trades

Num Number of trades to consider. Enter a large number for all trades.

Remarks:

Examples:

var NumWins = results(1+64,30);	// Number of winning and won trades
var NumLosses = results(1+128,30);	// Number of losing and lost trades
var Wins = results(2+64,30)/PIP;	// Total win in pips
var Losses = results(2+128,30)/PIP;	// Total loss in pips
var AvgProfit = ifelse(NumWins+NumLosses > 0,
  (Wins-Losses)/(NumWins+NumLosses),0.); // Average profit per trade
var WinRate = ifelse(NumWins+NumLosses > 0,
  NumWins/(NumWins+NumLosses);	// Win rate of last 30 trades
 

See also:

Trade statistics, for(trades), strategy statistics

► latest version online