"Cold Blood Index"

The Cold Blood Index (CBI) can determine whether a strategy is becoming unprofitable due to a permanent market change. For this purpose, drawdowns are daily compared with the profit-loss curve from the last backtest. The probability of encountering such a drawdown is calculated based on the algorithm published on Financial Hacker, and displayed in the trade log and on the status page. A drawdown of low probability indicates a deviation from the backtest due to a biased test or a market change. This information can be used for deciding whether it's better to stop trading the system, or to continue it in cold blood.

The probability is calculated with the following function:

verify (var* Data, int Length, var Depth, int Width, int Horizon): var

Returns the probability in percent (0..100) of encountering a drawdown of the given Depth and Width within a given time Horizon. For this, the drawdown is compared with the Data array that contains a profit/loss curve from a backtest or a previous trading session.

Returns:

Probablilty in percent (0..100).

Parameters:

Data Data array with profit/loss values, f.i. from the _pnl.dbl curve stored in a backtest.
Length Length of the data array, positive for an array in time descending order and negative for ascending order.
Depth Drawdown depth, the difference of an equity or balance peak with the subsequent equity or balance valley. Must be based on the same scale as the values in the Data series.
Width Drawdown duration, the time distance between the peak and the subsequent valley, in the same units as the points in the Data array, usually bar periods or days.
Horizon Live trading time in in the same units as the points in the Data array, usually bar periods or days. Must be equal or above Width and smaller than Length.

 

DDScale

Drawdown scale for the automatic CBI calculation in [Trade] mode (default = 1 = no scaling). The drawdown depth is divided by this scale factor for calculating the CBI.

Type:

var
 

Remarks:

Examples:

//scale drawdowns for CBI according to invested capital
var Invest = slider(1,5000,0,10000,"Investment","Invested capital");
static var InitialInvest = 0;
if(is(INITRUN)) InitialInvest = Invest; // store the initial investment that was also used in the backtest 
if(InitalInvest > 0) DDScale = Invest/InitialInvest;
//Check the Cold Blood Index at a Z12 Drawdown of $800 in 
//$500 in the last 60 of 100 trading days
void main()
{
  var* PnLs = file_content("Data\\Z12_pnl.dbl");
  int Length =  file_length("Data\\Z12_pnl.dbl")/sizeof(var);
  var P = verify(PnLs,-Length,500,60,100);
  printf("\nP = %.0f%%",P);
}

See also:

Trading, Cold Blood Index

 

► latest version online