SIMPLE STOP AND REVERSE MA BASED SYSTEM

 

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

 
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 

 
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
 
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
 

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

Reason: