Hi all, i need add this money management function to my EA.
Money management:
double lots;
datetime lastClose;
for(int pos=0; pos < OrdersHistoryTotal(); pos++) if (
OrderSelect(pos, SELECT_BY_POS, MODE_HISTORY) // Only orders w/
&& OrderCloseTime() > lastClose // not yet processed,
&& OrderMagicNumber() == magic.number // my magic number
&& OrderSymbol() == Symbol() // and my pair.
&& OrderType() <= OP_SELL // Avoid cr/bal forum.mql4.com/32363#325360
){
lastClose = OrderCloseTime();
if (OrderProfit() < 0) lots=0.1 else lots=1.0;
}
EA attached..........
Money management:
double lots;
datetime lastClose;
for(int pos=0; pos < OrdersHistoryTotal(); pos++) if (
OrderSelect(pos, SELECT_BY_POS, MODE_HISTORY) // Only orders w/
&& OrderCloseTime() > lastClose // not yet processed,
&& OrderMagicNumber() == magic.number // my magic number
&& OrderSymbol() == Symbol() // and my pair.
&& OrderType() <= OP_SELL // Avoid cr/bal forum.mql4.com/32363#325360
){
lastClose = OrderCloseTime();
if (OrderProfit() < 0) lots=0.1 else lots=1.0;
}
EA attached..........
Attached File(s)
MGH_EA.mq4
9 KB
|
371 downloads