Just starting to code in MQL5, I tried to make very simple martingale EA which will double the lot size if we lose and stop after we win. When I tested this on strategy tester, its always written failed instant buy if I input Buy in the position input variable ( extern variable ), but it works if I choose sell. and its weird if I change the code in line 108, 109..
Just starting to code in MQL5, I tried to make very simple martingale EA which will double the lot size if we lose and stop after we win. When I tested this on strategy tester, its always written failed instant buy if I input Buy in the position input variable ( extern variable ), but it works if I choose sell. and its weird if I change the code in line 108, 109..
From..
takeProfit = NormalizeDouble( tick.ask + _takeProfit * Point() * 10, _Digits ) ;
stopLoss = NormalizeDouble( tick.ask - _stopLoss * Point() * 10, _Digits ) ;
To:
takeProfit = NormalizeDouble( tick.bid+ _takeProfit * Point() * 10, _Digits ) ;
stopLoss = NormalizeDouble( tick.bid- _stopLoss * Point() * 10, _Digits ) ;
It'll work although it seems not connected.
Here's the code: