I so far have not succeeded, you have been able to do it?
Here I'm going to give you an hint by providing the formula, so you can discover by yourself the martingale method used.
Pips difference / ( (Lotsize Position 2 / Lotsize Position 1) - 1 )
This formula provides (pips) where you have to set stopLoss from last opened trade to get zero risk. (minus a couple of pips to cover spread or commissions)
Does it help?