...actually this is a question that's been concerning to me for a while now, are there cases when verifying OrderSelect() (i.e. to resolve the Warning) is actually a bad idea and I'd be better off just leaving
instead of using
i would use something like this :
if(!OrderSelect(glbOrderTicket,SELECT_BY_TICKET, MODE_TRADES))break; if(OrderSymbol() != Symbol() && OrderMagicNumber() != MagicNumber)continue; if(OrderSymbol() == Symbol() && OrderMagicNumber() == MagicNumber) { ... }
i would use something like this :
if(OrderSymbol() != Symbol() && OrderMagicNumber() != MagicNumber) continue;
In my opinion, this algo actually only slows down program execution, because even without that command, the pointer will always continue until eof.
In my opinion, this algo actually only slows down program execution, because even without that command, the pointer will always continue until eof.
the point using it is to keep track of it's own orders and not be in conflict with any other advisers open orders
in other words, if I'm using something like this
if(glbOrderType == OP_BUYLIMIT){ if(OrderSelect(glbOrderTicket, SELECT_BY_TICKET, MODE_TRADES) == true) if(entry != OrderOpenPrice()) if(OrderModify(glbOrderTicket,entry,stop,take,0,clrNONE) == false) Print("Err (",GetLastError(), ") Modify Sell Price= ",entry," SL= ",stop," TP= ",take);}
it's actually slower, but same result as this?
if(glbOrderType == OP_BUYLIMIT){ OrderSelect(glbOrderTicket, SELECT_BY_TICKET, MODE_TRADES); if(entry != OrderOpenPrice()) if(OrderModify(glbOrderTicket,entry,stop,take,0,clrNONE) == false) Print("Err (",GetLastError(), ") Modify Sell Price= ",entry," SL= ",stop," TP= ",take);}of course...only one Expert active at a time per currency, per account, per broker, per machine(platform, computer, tablet, mobile) so, no running multiple charts with same currency and different EAs
in other words, if I'm using something like this
it's actually slower, but same result as this?
of course...only one Expert active at a time per currency, per account, per broker, per machine(platform, computer, tablet, mobile) so, no running multiple charts with same currency and different EAsthe second one will give you a compile warning to check return value of OrderSelect. If one of your examples are slower or faster i can't tell
if(glbOrderType == OP_BUYLIMIT){ OrderSelect(glbOrderTicket, SELECT_BY_TICKET, MODE_TRADES); <----This will need a return function if(entry != OrderOpenPrice()) if(OrderModify(glbOrderTicket,entry,stop,take,0,clrNONE) == false) Print("Err (",GetLastError(), ") Modify Sell Price= ",entry," SL= ",stop," TP= ",take);} //rewritten bool retval=false; if(glbOrderType == OP_BUYLIMIT){ retval=OrderSelect(glbOrderTicket, SELECT_BY_TICKET, MODE_TRADES); if(entry != OrderOpenPrice()) if(OrderModify(glbOrderTicket,entry,stop,take,0,clrNONE) == false) Print("Err (",GetLastError(), ") Modify Sell Price= ",entry," SL= ",stop," TP= ",take);}
and i use to code this like the example:
if(OrderModify(glbOrderTicket,entry,stop,take,0,clrNONE) == false) <-----your code if(!OrderModify(glbOrderTicket,entry,stop,take,0,clrNONE)) <----- my example
same thing here
if(OrderSelect(glbOrderTicket, SELECT_BY_TICKET, MODE_TRADES) == true)<---- your code if(!OrderSelect(glbOrderTicket, SELECT_BY_TICKET, MODE_TRADES))break; <----- my example
same thing here
Thank you, that was educational indeed, I appreciate it
you're welcome 😉
the point using it is to keep track of it's own orders and not be in conflict with any other advisers open orders
You have kept track with this code.
if(OrderSymbol() == Symbol() && OrderMagicNumber() == MagicNumber)
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
OrderSelect(glbOrderTicket,SELECT_BY_TICKET, MODE_TRADES);
instead of using