nicwaznego:
it mean.... no one can help you there must be something else messing up.... this code it to simple to fail.... ive tried again 10+ 50+ 90+ opened orders... random direction.... 4 demo brokers .... just keep shooting em down.
I've entered the exact same code:
int start(){
int GET_ME_THEM = OrdersTotal();
for(int YES=GET_ME_THEM-1;YES>=0;YES--){
OrderSelect(YES, SELECT_BY_POS);
int WHAT_2_KILL = OrderType(); double KILL_LONG; double KILL_SHORT;
switch(WHAT_2_KILL){
case OP_BUY
: KILL_LONG = OrderClose( OrderTicket(), OrderLots(), MarketInfo(OrderSymbol(), MODE_BID), 100, Blue ); break;
case OP_SELL
: KILL_SHORT = OrderClose( OrderTicket(), OrderLots(), MarketInfo(OrderSymbol(), MODE_ASK), 100, Blue );
}}
return(0);
}
saved it in experts -> scripts. Then when I open my MetaTrader4 platform, I click on Scripts -> then on the saved script twice and it doesn't clear nothing, nothing starts...
i went through mql lib there might be quite interesting command if m suffix is an issue...
stringStringSubstr( string text, int start, int length=0)
//so lest substr 6th letterStringSubstr(Symbol(),6)
//if u declare it..string suf_ix = StringSubstr(Symbol(),6);
///now its just a matter of making MarketInfo(OrderSymbol()
//thinking .... that... am... uuuummm....MarketInfo(OrderSymbol()+suf_ix
/* ok i have to admit it.... my mql skill is so lame.... any way there might be something,,,,
give me some time i believe i can do it... */
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.
#include the common_functions.mqh and then the entire problem will be reduced to a one-liner: closeOpenOrders(-1, -1);
Amm my include folder does not contain common_functions :( help? :P
Amm my include folder does not contain common_functions :( help? :P
it mean.... no one can help you there must be something else messing up.... this code it to simple to fail.... ive tried again 10+ 50+ 90+ opened orders... random direction.... 4 demo brokers .... just keep shooting em down.
I've entered the exact same code:
saved it in experts -> scripts. Then when I open my MetaTrader4 platform, I click on Scripts -> then on the saved script twice and it doesn't clear nothing, nothing starts...
Thanks for your time,
Vatco
closes all orders irrespective of on which chart the script was opened
https://www.mql5.com/en/code/7607
Thanks for the link sxTed I'll read it tonight and post if it solved my problems.
Could u do me a favor, tell me what mt provider u use???
Sorry about that nicewaznego, I removed it by mistake in a previous post.
I have MetaTrader-EXNESS
Version: 4.0 Build 402
(11 May 2011)
Thanks for your help!
have u got mini account with them????
am not sure but the problem might be in that suffix they use /if mini/ (symbol()+m).
any one can confirm this, am interested my self.