You can do that already, like this:

if(Equity - MarginVal < 1000) printf("\nMargin dangerously low!");

For being safer, it makes sense to contact your broker and request to switch your account to higher leverage. FXCM accepts 1:200 on request when you don't live in the US.