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
I am trading LIVE. Do you trade LIVE? Could it be broblem? Thanks for help in advance...
It was Alpari demo account.
You mean that you tried to use it with real account?
Should work as well.
It was Alpari demo account.
You mean that you tried to use it with real account?
Should work as well.Yes, I ve tried to use it with real account on live but there was an error msg...
Quite confuse but thanks for your help anyway...
I tried it, but ERROR : 4109
Tools->Options->ExpertAdvisors-> V Enable ExpertAdvisors(...and Scripts)
Tools->Options->ExpertAdvisors-> V Enable ExpertAdvisors(...and Scripts)
Thank you so much... it is working now !!!
CloseOnTime EA from Kimiv.
Tools->Options->ExpertAdvisors-> V Enable ExpertAdvisors(...and Scripts)
I'm still getting the same error. What do you mean by "V"?
thanks
I have the same problem.
Order ...... failed to close .Error:4109
Close all opened orders
I have a question about how to close all opened trades. That include trades wich were opened manually.
Here is the code:
if(BalanceEquityProtectionLevel > 0 && AccountEquity() <= AccountBalance ()* BalanceEquityProtectionLevel)
{
AllowTrading = false;
Print("Min. Equity Level Reached - Trading Halted For ",Symbol());
// Alert("Min. Equity Level Reached - Trading Halted For ",Symbol());
for(cnt=OrdersTotal();cnt>=0;cnt--)
{
OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);
mode=OrderType();
if (mode==OP_BUY) { OrderClose(OrderTicket(),OrderLots(),OrderClosePrice(),slippage,Blue); }
if (mode==OP_SELL) { OrderClose(OrderTicket(),OrderLots(),OrderClosePrice(),slippage,Red); }
// }
}
}
The problem is that, If I have opened a few pairs it's not always true that all trades will be closed too. Further more, it happend that EA continue to open another trade despite the parameter allowtrading == false.
I was debugging this thing and noticed that for some reason this code block was not executed for all pairs. Why, I don't know. Does somebody know answer to that?
This block should close all opened orders and prevent further trading.Maybe I could resolve this issue with writting parameter false to a file or something? The problem in this situation is also with pairs that have no opened orders.
Thanks..
Dejan
Here's my code that i wrote long time ago, it will close all running positions.
#include
#include
int start()
{
double sA;
int cnt, totalOrders;
totalOrders = OrdersTotal();
if (totalOrders>0)
{
for (cnt=0;cnt<totalOrders;cnt++)
{
OrderSelect(0, SELECT_BY_POS);
if (OrderType() == OP_BUY) sA = MarketInfo(OrderSymbol(),MODE_BID);
else sA = MarketInfo(OrderSymbol(),MODE_ASK);
OrderClose(OrderTicket(),OrderLots(),sA,3,CLR_NONE);
}
}
return(0);
}
Your code is very similar than mine. The results are the same. I attached a picture, to make some things more clearly.
EA does close all trades for pair GBPUSD (picture). As you can see, after this another trade is opened. (1 means allowtrade is true, 0 allowtrade is false).