RaptorUK:
You don't need Magic Numbers when you can tell Orders apart by existing information, i.e. OrderSymbol(), Ordertype(), OrderOpenPricce(), OrderStopLoss(), OrderTakeProfit(), etc. If you have 2 EAs running on the same Symbol but different TimeFrames then you need magic Numbers . . . or 2 different EAs
Ofcours but if that also not programmed correctly inside the EA ...... and the person ask some help with magicnumber then it will be the easiest if he understand this logic first before explaining when it is not needed.....
The way for looking to open trades is now programmed this way
Pending_BUY = 0;
Pending_SELL = 0;
BUY = 0;
SELL = 0;
for(b=OrdersTotal()-1;b>=0;b--)
{
if(OrderSelect(b,SELECT_BY_POS,MODE_TRADES)==true)
{
if (OrderType() == OP_BUYSTOP)
Pending_BUY++;
if (OrderType() == OP_SELLSTOP)
Pending_SELL++;
if (OrderType() == OP_BUY)
BUY++;
if (OrderType() == OP_SELL)
SELL++;
}
}
and that will not be enough identifieing trades correctly
Ofcours but if that also not programmed correctly inside the EA ...... and the person ask some help with magicnumber then it will be the easiest if he understand this logic first before explaining when it is not needed.....
I agree with your previous post, we were writing our posts at the same time . . . I hadn't seen yours when I added mine. I think we are essentially saying the same thing.
deVries:
and that will not be enough identifieing trades correctly
It is selecting ALL orders, not just orders by the EA
for(int iPos = OrdersTotal()-1; iPos >= 0 ; iPos--) if (
OrderSelect(iPos, SELECT_BY_POS) // Only my orders w/
&& OrderMagicNumber() == Magic.Number // my magic number
&& OrderSymbol() == chart.symbol // and my pair.
){
jssinvest: Can you explain what is incorrect because this looks logic to me.
Like WHRoeder wrote it is selecting with the old method ALL orders
If you have your EA trade on EURUSD 1H chart and it has no trades opened and the same time you have a open trade for example sell GBPUSD then your EA is counting in the old way SELL It doesn't recognize in the old way that it is not of its own.....
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
You don't need Magic Numbers when you can tell Orders apart by existing information, i.e. OrderSymbol(), Ordertype(), OrderOpenPricce(), OrderStopLoss(), OrderTakeProfit(), etc. If you have 2 EAs running on the same Symbol but different TimeFrames then you need magic Numbers . . . or 2 different EAs
Ofcours but if that also not programmed correctly inside the EA ...... and the person ask some help with magicnumber then it will be the easiest if he understand this logic first before explaining when it is not needed.....
The way for looking to open trades is now programmed this way
and that will not be enough identifieing trades correctlyOfcours but if that also not programmed correctly inside the EA ...... and the person ask some help with magicnumber then it will be the easiest if he understand this logic first before explaining when it is not needed.....
and that will not be enough identifieing trades correctly
Can you explain what is incorrect because this looks logic to me.
Like WHRoeder wrote it is selecting with the old method ALL orders
If you have your EA trade on EURUSD 1H chart and it has no trades opened and the same time you have a open trade for example sell GBPUSD then your EA is counting in the old way SELL It doesn't recognize in the old way that it is not of its own.....