Mr. Khan your logic is OK but think twice it again, when you add or change these setting in Distance step between trades or step martingale as you said {Any new trade under martingale should open on only new candle, not on same candle and distance between each positions pips should be adjustable in the settings.} then it will not close all trades in profit in total. Because when for example you add minimum distance between trades 30pips and you set to profit in 10 pips. then the 3rd position will be close in the profit of 4 USD but the above two trades 1 and 2 will be in loss of more than 4 USD. Instead, I would suggest if he can add averaging the TPs function upon each new position.