Margin and exposure
Margin and exposure is an alert that checks every 5 minutes and fires only once.
account and history
1
alert "Margin and exposure"2
check: every 5m3
repeat: once4
expires: 30d5
6
when account.free_margin < 20% of account.equity or positions.len >= 8:7
notify "Free margin {account.free_margin:$0} with {positions.len} open positions"Sample data. Not a result. The real AlgoBarsX engine ran this exact script on made-up bars, and this replays what it drew and did. It shows no profit or loss, and it says nothing about how the script would do in a real market.
Replay of this script on 150 sample bars: 0 alerts sent.
What this script says
Margin and exposure is an alert that checks every 5 minutes and fires only once.
When free margin is below 20% of equity or the number of open positions is at or above 8, it sends the notification "Free margin {account.free_margin:$0} with {positions.len} open positions".