Download MetaTrader 5

SIMPLE STOP AND REVERSE MA BASED SYSTEM

To add comments, please log in or register
no_erocla
11
no_erocla  

Hi guys,

someone has got a very simple code base on stop and reverse ?

I've some problem to handle this.

Or there is a funcion "CloseAll" differed by magicnumber like in mql4 ?


Regards

No Erocla

Yohana Parmi
2320
Yohana Parmi  
no_erocla:

Hi guys,

someone has got a very simple code base on stop and reverse ?

I've some problem to handle this.

Or there is a funcion "CloseAll" differed by magicnumber like in mql4 ?


Regards

No Erocla

I don't know what's you mean :)

When your post there are some questions, please separate them with numbering.

Regards,

Yohana 

Dua Yong Rew
5447
Dua Yong Rew  
no_erocla:

Hi guys,

someone has got a very simple code base on stop and reverse ?

I've some problem to handle this.

Or there is a funcion "CloseAll" differed by magicnumber like in mql4 ?


Regards

No Erocla

just send order with double the lot size in the opposite direction
Doni Ibrahim
158
Doni Ibrahim  
no_erocla:

Hi guys,

someone has got a very simple code base on stop and reverse ?

I've some problem to handle this.

Or there is a funcion "CloseAll" differed by magicnumber like in mql4 ?


Regards

No Erocla

I don't know what that you mean but,
CloseAll for All Order Opened by one click is good idea
no_erocla
11
no_erocla  

Ok sorry, i show you the code for mt4:


int CloseAll()
   {
   int k;
   int result;
   int cnt;
   //total = OrdersTotal();  
   for(cnt = OrdersTotal()-1; cnt >= 0; cnt--)
      {
      OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);
      if (OrderSymbol()==Symbol() && OrderMagicNumber()==magicNum)
         {  
         if (OrderType()==OP_BUY)
            {
               for (k=0 ;k<3; k++)
                  {
                  result=OrderClose(OrderTicket(),OrderLots(),NormalizeDouble(Bid,Digits),3,Violet);
                  if (GetLastError()==0) break;
                  else
                     {                       
                     Sleep(5000);
                     RefreshRates();
                     continue;
                     }
                  }               
            }
         if (OrderType()==OP_SELL)
            {
            for (k=0 ;k<3; k++)
               {
               result=OrderClose(OrderTicket(),OrderLots(),NormalizeDouble(Ask,Digits),3,Violet);
               if (GetLastError()==0) break;
               else
                  {
                  Sleep(5000);
                  RefreshRates();
                  continue;
                  }
               }
            }
         }               
      }
   }


This function close all open orders by magicnumber.

There s something like this in mql5 too ?


Regards

No Erocla

To add comments, please log in or register