Here is another version. Don't forget to share your demo detailed statement here when you have finished a test : Expert advisors demo statements - Trading System Forex
The code has been optimized. All explanation are available when you open it in Metaeditor. The martingale should be stopped when MinProfit>0.