Here you have my custom martingale bot doing exactly that. I hope it helps:

https://fxdreema.com/shared/6o0uTdg3e