4.7.2OnAccountMetrics handler

Instead of using the main OnMessage handler, you can also track changes in the account metrics such as balance and floating P/L by using an OnAccountMetrics handler. If defined, this is called by the framework each time that any of the metrics changes:

Framework.OnAccountMetrics = function(accountMetrics) {

// Receives the same accountMetrics object as in OnMessage

if (accountMetrics.equity != null) {

// Equity is changing, and therefore specified

} else {

// Equity is unchanged, and therefore not specified

}

};

The parameter to the OnAccountMetrics handler is the same value inside an ACCOUNT_METRICS message.