I use the following code to close the order:
for cnt=1 to TotalTrades {
if OrderValue(cnt,VAL_SYMBOL)=Symbol then {
CloseOrder(OrderValue(cnt,VAL_TICKET),Lots,close_sellPrice,4,Yellow );
}
}
I am using the following logic in my EA's code to close all the open orders:
CurrentTrades = 0;
for cnt = 1 to TotalTrades
{
if OrderValue(cnt,VAL_SYMBOL) = Symbol then
{
CurrentTrades = CurrentTrades + 1;
}
}
for cnt = 1 to TotalTrades
{
if CurrentTrades <> 0 and OrderValue(cnt,VAL_SYMBOL) = Symbol then
{
.
.
CloseOrder(...........);
Exit;
}
.
.
.
}
With the above logic, you are tagging a flag (CurrentTrades) to each symbol. So far I haven't seen any problem. Hope it helps.
///Frank
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Does any body else have the same problem? Can we apply more than one system at same time on Meta trader? Any advices will be highly appreciated.
The system log shows:
06:30:39 Expert 'USDCHF': close #343496 1.00 lots at 1.2149 [slippage 4]
06:30:39 Expert 'USDCHF': ZZM-->Exiting rule 2, close buy order1.2149
06:30:39 '69722': close order #343496 at price 1.2149
06:30:40 Expert 'EURUSD': ZZM-->Exiting rule 2, close sell order1.2716
06:30:40 '69722': order #343496 closed
I use the following code to close the order:
for cnt=1 to TotalTrades {
if OrderValue(cnt,VAL_SYMBOL)=Symbol then {
CloseOrder(OrderValue(cnt,VAL_TICKET),Lots,close_sellPrice,4,Yellow );
}
}