Help for newbie..

 

I have any question about one Ea Martingale..


i want limit my Profit and Losses too..


See my idea.


bool UseEquityTarget=false;
extern int EquityTarget=35000;
bool UseEquityLoss=false;
extern int EquityLoss=20000;


int start() {
if AccountEquity() >= EquityTarget

for (int l_ord_total_0 = OrdersTotal(); l_ord_total_0 >= 0; l_ord_total_0--) {
OrderSelect(l_ord_total_0, SELECT_BY_POS, MODE_TRADES);
if (OrderSymbol() == Symbol() || BrokerMode == 3 && OrderMagicNumber() == Magic) {
if (OrderType() == OP_BUY || OrderType() == OP_SELL) OrderClose(OrderTicket(), OrderLots(), OrderClosePrice(), 5, CLR_NONE);
if (OrderType() != OP_BUY && OrderType() != OP_SELL) OrderDelete(OrderTicket());
}
}

if AccountEquity() >= EquityLoss

for (int l_ord_total_0 = OrdersTotal(); l_ord_total_0 >= 0; l_ord_total_0--) {
OrderSelect(l_ord_total_0, SELECT_BY_POS, MODE_TRADES);
if (OrderSymbol() == Symbol() || BrokerMode == 3 && OrderMagicNumber() == Magic) {
if (OrderType() == OP_BUY || OrderType() == OP_SELL) OrderClose(OrderTicket(), OrderLots(), OrderClosePrice(), 5, CLR_NONE);
if (OrderType() != OP_BUY && OrderType() != OP_SELL) OrderDelete(OrderTicket());
}
}
return (0);



is correct ?

 

You can combine these two conditon together, like:

int start() {
if (AccountEquity() >= EquityTarget||AccountEquity() <= EquityLoss)

for (int l_ord_total_0 = OrdersTotal(); l_ord_total_0 >= 0; l_ord_total_0--) {
OrderSelect(l_ord_total_0, SELECT_BY_POS, MODE_TRADES);
if (OrderSymbol() == Symbol() || BrokerMode == 3 && OrderMagicNumber() == Magic) {
if (OrderType() == OP_BUY || OrderType() == OP_SELL) OrderClose(OrderTicket(), OrderLots(), OrderClosePrice(), 5, CLR_NONE);
if (OrderType() != OP_BUY && OrderType() != OP_SELL) OrderDelete(OrderTicket());
}
}
return (0);


}

in your strategy, the balance is either 35000 (may more) or 20000(or less) and stop there. so what is next ? that is just gambling.

 
caijs:

You can combine these two conditon together, like:

int start() {
if (AccountEquity() >= EquityTarget||AccountEquity() <= EquityLoss)

for (int l_ord_total_0 = OrdersTotal(); l_ord_total_0 >= 0; l_ord_total_0--) {
OrderSelect(l_ord_total_0, SELECT_BY_POS, MODE_TRADES);
if (OrderSymbol() == Symbol() || BrokerMode == 3 && OrderMagicNumber() == Magic) {
if (OrderType() == OP_BUY || OrderType() == OP_SELL) OrderClose(OrderTicket(), OrderLots(), OrderClosePrice(), 5, CLR_NONE);
if (OrderType() != OP_BUY && OrderType() != OP_SELL) OrderDelete(OrderTicket());
}
}
return (0);


}

in your strategy, the balance is either 35000 (may more) or 20000(or less) and stop there. so what is next ? that is just gambling.

Hello, when i put your code the EA dont Job, why ?

Reason: