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"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".