Skip to content

Algorithm SDK

AVAILABLE_MARGIN

EQUITY minus USED_MARGIN, in your account currency. If it falls to zero, the broker may close your positions (a margin call).

declare const AVAILABLE_MARGIN: number;
function onIntervalClose() {
if (AVAILABLE_MARGIN > EQUITY * 0.5 && OPEN_POSITIONS_COUNT === 0) {
openPosition("BUY", { riskPercentage: 1, stopLossPips: 25 });
}
}