CloaseAllTrade MT5 post dated:August 2019

 
Good Day to All. I try to use metaeditor 5. And i try to create EA. please any help from experience coder how to code to "close all trade" in the trade tab window. I try this code " trade.PositionClose(_SYMBOLS) " put at VOID OnTick() but nothing happens or not working. 

<Trade\Trade.mqh>
//--- object of class CTrade 
CTrade trade; 

Void ontick() 
trade.PositionClose(_SYMBOLS) 

//I AM beginner of mql5 (myself study based on here in forum)

 
Hello please look for code examples in codebase here:  https://www.mql5.com/en/search#!keyword=close%20all&module=mql5_module_codebase
Search - MQL5.community
Search - MQL5.community
  • www.mql5.com
Searching is based on morphology and is insensitive to case. All letters, no matter of their case, will be processed as lowercase. By default, our search engine shows pages, that...
 
Marco vd Heijden:
Hello please look for code examples in codebase here:   https://www.mql5.com/en/search#!keyword=close%20all&module=mql5_module_codebase
ok. i try. many thanks.
 
There is one here for MT5:  https://www.mql5.com/en/code/22827
Close all positions
Close all positions
  • www.mql5.com
Closing positions when reaching the Close all if Profit level. The overall profit on all positions is considered regardless of the symbol or magic number. A profit is calculated only when a new bar appears.
 

anybody help to CLOSE ALL TRADE at trade tab using mt5 EA.


int i=PositionsTotal()-1;

                  while (i>=0)

                  {if (trade.PositionClose(PositionGetSymbol(i))) i--;}


this code are not working/nothing happens even there is no error after compiled.


any source code suggestion please...

 
MikelDavao:

Use SRC button, please.


 
Miguel Angel Vico Alba:

Use SRC button, please.

I am using mt5 EA. my problem is the source code NOT functional (source code/idea credit to mql5 forum) or NOTHING happens to close my trade.  now i use SRC button(Sorry i am biggener). i am beginner also in Forex trading and I try to make own EA because in my 3days trade I am loss 35 usd in EURUSD currency.

 //-----------------------bof AUTO CLOSED ALL TRANSACTION------------------------------------
void CloseEverything()
{
  // CTrade c_trade;
   for(int i=PositionsTotal()-1;i>=0;i--)
   {
      {
      int ticket=PositionGetTicket(i);
	//Attached
      PlaySound("ok.wav");
   }
   }

 }  
 //-----------------------eof AUTO CLOSED ALL TRANSACTION------------------------------------


//toolbars error Description
code generated          1       1
0 error(s), 81 warning(s), 1925 msec elapsed            1       82

noted-------------as far as my research I found this below. dated 2019-08-21 12:33 PM +gmt



    

ERR_TRADE_DISABLED

4752

Trading by Expert Advisors prohibited

Any Advice how to make auto trading. purpose "Close All Trade"
 

MikelDavao:

ERR_TRADE_DISABLED

4752

Trading by Expert Advisors prohibited


Click the AutoTrading button.


 
to all moderator who attend my needs. I am very thankful to all you. I am very happy today 2019-08-21 7:43 PM +8 GMT. I am very proud that I have now my own Auto Trading. This is what I need today to "CLOSE" all trade when profit reach from minimum of 0.01 until max(when trading sending a reversal signal). This is a FIRST step of my Auto trading... Happy coding to all. GOOD LUCK to FOREX TRADING
 
Michael Quinatadcan Macasil Macasil #:
to all moderator who attend my needs. I am very thankful to all you. I am very happy today 2019-08-21 7:43 PM +8 GMT. I am very proud that I have now my own Auto Trading. This is what I need today to "CLOSE" all trade when profit reach from minimum of 0.01 until max(when trading sending a reversal signal). This is a FIRST step of my Auto trading... Happy coding to all. GOOD LUCK to FOREX TRADING

hello

I can close all position however if I just want to close sell position only it can not work well even complie ok. Can you have any suggestion

Reason: