Hi,
I need your help for a part of my code. I want to open a new Long trade with 0.02lots once if the price falls about 50 pips, So I need to put ExistPositions0.02lots() FALSE first and put it TRUE when the new order with 0.02lots is opened.
How can I change this ExistPositions0.02lots() ?
bool ExistPositions0.02lots(){
for (int i=0; i<OrdersTotal(); i++) {
if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES)) {
if (OrderSymbol()==Symbol() && OrderLots()==0.02) {
return(True);
}
}
}
return(False);
}
void DoublePositionBuy(int Perte1){
if (ExistPositions() && !ExistPositions0.02lots()){
for (int i=0; i<OrdersTotal(); i++) {
if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES)) {
if (OrderSymbol()==Symbol()) {
if (OrderType()==OP_BUY) {
if (OrderOpenPrice() - Ask > Point * Perte1){
OpenBuyDouble();
}
}
}
}
}
}
}
THANKS A LOT.
Goodgame42
I need your help for a part of my code. I want to open a new Long trade with 0.02lots once if the price falls about 50 pips, So I need to put ExistPositions0.02lots() FALSE first and put it TRUE when the new order with 0.02lots is opened.
How can I change this ExistPositions0.02lots() ?
bool ExistPositions0.02lots(){
for (int i=0; i<OrdersTotal(); i++) {
if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES)) {
if (OrderSymbol()==Symbol() && OrderLots()==0.02) {
return(True);
}
}
}
return(False);
}
void DoublePositionBuy(int Perte1){
if (ExistPositions() && !ExistPositions0.02lots()){
for (int i=0; i<OrdersTotal(); i++) {
if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES)) {
if (OrderSymbol()==Symbol()) {
if (OrderType()==OP_BUY) {
if (OrderOpenPrice() - Ask > Point * Perte1){
OpenBuyDouble();
}
}
}
}
}
}
}
THANKS A LOT.
Goodgame42
Trade Safe !