Hi all;

I'm trying to add a martingale block of code the macd sample ea (the one that comes with mt4) but then it doesn't work. The code that I done is ;

extern int multiplier = 2;
extern int maxorder = 4;
extern double baselots = 0.1;
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
int start()

{

int cnt, ticket, total;
double pt,lots;

if (Digits ==3||Digits==5)pt=10*Point;
else pt=Point;

double getlots()
{
if(OrderSelect(OrdersHistoryTotal()-1,SELECT_BY_POS,MODE_HISTORY))
{
if(OrderProfit() < 0) lots=OrderLots()* multiplier;
else lots= baselots;
}
if(lots > maxorder) lots = maxorder;
}
return(lots);
}

if(Bars<100)
{
Print("bars less than 100");
return(0);
}

Is possible for any of you give a help here?

Best regards