mq4 大体是下面这种
Code:
extern double Lots=0.01;//|----------------------lotsextern bool Martingale=false;//|-----------------martingaleextern double Multiplier=2.0;//|-----------------multiplier martingaleextern 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);}
|