I think you need to do it in a custom way, using some Variable. So, before the Buy block you can have a block to check the profit of the last trade (whether it was profitable or not), then set the value of some Variable depending on that, and then in the Buy block to use that value for the risk % option.
Now the Martingale option looks at the actual lot size of the last trade and multiplies that lot size to 2 (by default) on loss. It doesn't care what the balance it, it looks at the lot size.