I was wondering if someone could help explain, point by point, how to calculate your safety buffer (both in $ terms and % terms) if you choose to margin lend at a lower rate than the max LVR.

For example:

My current portfolio is
ABC with a market value of $10,000 (LVR of 70%)
DEF with a market value of $10,000 (LVR of 50%)

The total market value of my portfolio is $20,000
The total security value of my portfolio is $12,000

I want to use the $12,000 to buy stock XYZ that has a max LVR of 70%.

My understanding is that if I borrow the full amount I'd be able to buy a total value of $40,000 of XYZ. Most lenders give a 5% buffer so that means my portfolio only has to fall 5% before I get a margin call.

What if I decided I only want to borrow 50% to buy XYZ. How much buffer would I have and how do I work it out?

Thanks in advance.