Download MetaTrader 5

MartenGale Format

To add comments, please log in or register
cape1354
188
cape1354  

I'm trying to build a Martin Gail based on these codes.


Do you know the location of the writing on the style of writing this type of Martin Gail code?


Let me have your answer.



if(NewBar() )   


  {    
   //if(total<1)               
     {
      //BUY
      if(//conditional expression )
         {
         ticket=OrderSend(NULL,OP_BUY,Lots,Ask,3,0,0,"ma sample",MagicNo,0,Green);
         if(ticket>0) 
           {
            if(OrderSelect(ticket,SELECT_BY_TICKET,MODE_TRADES)) 
            Print("BUY order opened : ",OrderOpenPrice());
            Print("Buy SR : ",Success_Rate);
           }
         else
         Print("Error opening BUY order : ",GetLastError()); 
         }
      
   
     // SELL 
     
         {
           if(//conditional expression ) 
           {
         
            ticket=OrderSend(NULL,OP_SELL,Lots,Bid,3,0,0,"ma sample",MagicNo,0,Red);
            if(ticket>0)
              {
               if(OrderSelect(ticket,SELECT_BY_TICKET,MODE_TRADES)) 
               Print("SELL order opened : ",OrderOpenPrice());
               Print("SELL SR : ",Success_Rate);
              }
            else Print("Error opening SELL order : ",GetLastError()); 
            return(0); 
           }
     
         }   
    }

}
//}
   
  
//+------------------------------------------------------------------+







//+------------------------------------------------------------------+
//|  tp/sl                                                    |
//+------------------------------------------------------------------+
         
for(cnt=0;cnt<total;cnt++)
 {
   if(OrderSelect(cnt,SELECT_BY_POS,MODE_TRADES)==true)

   {
    if(OrderMagicNumber()==MagicNo && OrderSymbol() == Symbol())
    
      {
         if(OrderType() == OP_BUY)
            {if(OrderStopLoss()==0 && OrderTakeProfit() == 0)
              
              {ticketM = OrderModify(OrderTicket(),OrderOpenPrice(),Ask,0,Blue);
              
              return(0);
              }
            }
          if(OrderType() == OP_SELL)
            {if(OrderStopLoss()==0 && OrderTakeProfit() == 0)
             
              {ticketM = OrderModify(OrderTicket(),OrderOpenPrice(),Bid,0,Blue);
             
              return(0);
              }
            }
       }
   }
 return(0);
 } 
Carl Schreiber
Moderator
7944
Carl Schreiber  
What if you first search (google or the lens in the upper right corner) for a: "Martingale EA mt4"?
To add comments, please log in or register