You MUST count down when closing/deleting or in the presence of multiple order on other charts. Count Down ALWAYS.
Always test return codes, if the order select fails so does your code.
What is the meaning of 3. On a 4 digit broker it's 3 pips (3 points,) on a 5 digit broker it's 0.3 pips (3 points)
for(iPos = OrdersTotal()-1; iPos >= 0 ; iPos--) if (
OrderSelect(iPos, SELECT_BY_POS) // Only my orders w/
&& OrderMagicNumber() == magic.number // my magic number
&& OrderSymbol() == Symbol() // and my pair.
){
if (!OrderClose(OrderTicket(),OrderLots(),OrderClosePrice(),3*pips2dbl,Yellow))
Alert("OrderClose failed: ", GetLastError());
if(OrdersTotal()<1)
{
This makes the EA incompatable with every other including manual trading.
int count=0;
for(iPos = OrdersTotal()-1; iPos >= 0 ; iPos--) if (
OrderSelect(iPos, SELECT_BY_POS) // Only my orders w/
&& OrderMagicNumber() == magic.number // my magic number
&& OrderSymbol() == Symbol() // and my pair.
){ count++; }
if(count<1)
{
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.
How can i change the attached EA so it works with my 3 digit broker on USDJPY? Currently it is set up for 5 digits
Always test return codes, if the order select fails so does your code.
What is the meaning of 3. On a 4 digit broker it's 3 pips (3 points,) on a 5 digit broker it's 0.3 pips (3 points)