Spend limit on capital amount?

Quick question!
Is there any way to set a personal limit so as to not spend more than a specific percentage as a whole?
Like I would like to be able to not buy more if I’ve reached a margin of 10% etc.
I use MetaTrader 5.