Closing all opened orders script !HELP! - page 2

 
7bit:

#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
 
forexCoder:

Amm my include folder does not contain common_functions :( help? :P
I Googled it for you ;-) https://sites.google.com/site/prof7bit/common_functions
 
:p thanks :P
 
Ah it was 7bit's common functionj lol :P, k
 
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...

Thanks for your time,

Vatco

 

closes all orders irrespective of on which chart the script was opened

https://www.mql5.com/en/code/7607

 
Could u do me a favor, tell me what mt provider u use???
 

Thanks for the link sxTed I'll read it tonight and post if it solved my problems.

nicwaznego:
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.

 
i went through mql lib there might be quite interesting command if m suffix is an issue...
string StringSubstr( string text, int start, int length=0) 

//so lest substr 6th letter

StringSubstr(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... */
Reason: