Close all open trades at once - page 2

 
RaptorUK:
Exactly what I was saying above . .

Yes, it is. Mostly we agree with each other,the problem is we don't know if someone else is understanding us...
 
deVries:

Yes, it is. Mostly we agree with each other,the problem is we don't know if someone else is understanding us...
Yep, I did wonder if the language barrier got in the way ;-)
 
if(OrderSymbol()==Symbol() &&OrderMagicNumber()==Magic) why this operator?
 
MohammedSafar:
if(OrderSymbol()==Symbol() &&OrderMagicNumber()==Magic) why this operator?
Why not ? maybe you would like to rephrase your question so we understand it ?
 
MohammedSafar:
if(OrderSymbol()==Symbol() &&OrderMagicNumber()==Magic) why this operator?

The EA must be able to isolate its trades from all others - Same or other EAs on the same or other charts.

The magic number is sufficient if all EAs on all charts are using a unique one.

If you add the EA to another pair and forget to change the magic number, they'll interfere with each other. Adding the symbol over comes the human's forgetfulness.

If you add the EA to the same pair but different timeframe then again you have the same problem. I have the EA use a range of numbers to over come this.

 


the sum of profits and sum of losses by sell or Buy position will be calculated on the above code separately :

Buyprofit will sums all profit and losses when the OrderType()==OP_BUY and the Sellprofit will sums all profit and losses when theOrderType()==OP_SELL.Beats By Dre

so if the Totalprofit=Buyprofit+Sellprofit is greater than 0 then the sum of profits and losses is more than 0.

if you take look at the above code you see that i made two closing conditions and by each one Totalprofit>0 is needed.

Yep, OK, I see what you mean about Totalprofit . . . I just don't get the logic of doing this as you go through the loop, order by order . . . if the first order you see is in profit then you close it ? this doesn't make sense in light of what you said . . . . " I want to code an Ea that could close all open trades at once "
 
Because you can only close one ticket at a time
 
It's a SPAM BOT . . . just ignore it and it will FOAD
Reason: