Note that this martingale is not conventionnal. The lots size is increased when there is a loss, and decreased when the is a profit. While it should start again at initial lots when the last serie of consecutive loss finishes on a win.

If you have a function for a basic martingale, don't hesitate to post :

After extern parameters, add :

Code:

extern double Lots=0.01;//|----------------------lots
extern bool Martingale=false;//|-----------------martingale
extern double Multiplier=2.0;//|-----------------multiplier martingale
extern double MinProfit=50;//--------------------minimum profit to apply the martingale

After start(){, add :

Code:

if(Martingale)CalculateMartingale();Balance=AccountBalance();

At the end of the code, add :

Code:

void CalculateMartingale()
{
double InitalLots=0.01;
double MinLots=MarketInfo(Symbol(),MODE_MINLOT);
double MaxLots=MarketInfo(Symbol(),MODE_MAXLOT);
if(Balance!=0.0)
{
if(Balance>AccountBalance())Lots=Multiplier*Lots;
else if((Balance+MinProfit)<AccountBalance())Lots=InitalLots;
else if((Balance+MinProfit)>=AccountBalance())Lots=Lots;
if(Lots<MinLots)Lots=MinLots;
if(Lots>MaxLots)Lots=MaxLots;
}
return(0);
}