Thank you
and yes I forgot about return :D
but about the other problem , is the error " return value of OrderClose should be cheked" in codes below has same problem ?
void AllOrdersClose ()
{
for(int i=OrdersTotal()-1 ; i>=0 ; i-- )
{
while(OrderSelect(i,SELECT_BY_POS,MODE_TRADES)==true)
{
OrderClose(OrderTicket(),OrderLots(),MarketInfo(Symbol(),MODE_ASK),Slippage,Green);
OrderClose(OrderTicket(),OrderLots(),MarketInfo(Symbol(),MODE_BID),Slippage,Green);
}
}
}
Sorry for bad english
Thank you
and yes I forgot about return :D
but about the other problem , is the error " return value of OrderClose should be cheked" in codes below has same problem ?
void AllOrdersClose ()
{
for(int i=OrdersTotal()-1 ; i>=0 ; i-- )
{
while(OrderSelect(i,SELECT_BY_POS,MODE_TRADES)==true)
{
OrderClose(OrderTicket(),OrderLots(),MarketInfo(Symbol(),MODE_ASK),Slippage,Green);
OrderClose(OrderTicket(),OrderLots(),MarketInfo(Symbol(),MODE_BID),Slippage,Green);
}
}
}
Sorry for bad english
Don't you like to verify that the order was indeed closed, and take additional action if it did not succeed?
OrderClose()
Returns a value, and the compiler is telling you hey you didn't check the return value.
bool result=OrderClose() { if(result==true) { Print("Ok"); } else if(result==false) { Print(OrderClose Error!"); } }
Returns a value, and the compiler is telling you hey you didn't check the return value.
Thank you
So OrderClose not only close position ,but it also returns a Boolean value that it should be used for checking . right?
I don't know if my English is understandable or not but I hope it is :)
Thank you
So OrderClose not only close position ,but it also returns a Boolean value that it should be used for checking . right?
I don't know if my English is understandable or not but I hope it is :)
Put the cursor on the function in meta editor and press F1.
This will open up the reference library and show you exactly what it returns.
OrderClose
Closes opened order.
bool OrderClose( |
Parameters
ticket
[in] Unique number of the order ticket.
lots
[in] Number of lots.
price
[in] Closing price.
slippage
[in] Value of the maximum price slippage in points.
arrow_color
[in] Color of the closing arrow on the chart. If the parameter is missing or has CLR_NONE value closing arrow will not be drawn on the chart.
Returned value
Returns true if successful, otherwise false. To get additional error information, one has to call the GetLastError() function.
Put the cursor on the function in meta editor and press F1.
This will open up the reference library and show you exactly what it returns.
OrderClose
Closes opened order.
|
hi
I'm new in programming.
can you please help me to find out what's the problem with this part of my EA ?
I've got this Error : 'totallots'- some operator expected
double TotalLots ()
{
double totalots=0;
for(int i=0; i<OrdersTotal(); i++)
{
OrderSelect(i, SELECT_BY_POS, MODE_TRADES)
totalots+=OrderLots();
}
return(0);
}
Some expected operator is semicolon after OrderSelect
OrderSelect(i,SELECT_BY_POS,MODE_TRADES);
Some expected operator is semicolon after OrderSelect
OrderSelect(i,SELECT_BY_POS,MODE_TRADES);
thank you so much Slawa
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
hi
I'm new in programming.
can you please help me to find out what's the problem with this part of my EA ?
I've got this Error : 'totallots'- some operator expected
double TotalLots ()
{
double totalots=0;
for(int i=0; i<OrdersTotal(); i++)
{
OrderSelect(i, SELECT_BY_POS, MODE_TRADES)
totalots+=OrderLots();
}
return(0);
}