English

## Martingail Expert

 9 sky6nove 2014.12.31 02:47   I would put, linear Martingale 1, 2, 3, 4.could help me in this code I determine a price, and this price is as start and stop it have to do to stop the manual or TP or TrailingStop order.Can anyone help me how to do this?  ```//+------------------------------------------------------------------+ //|                                                      ProjectName | //|                                      Copyright 2012, CompanyName | //|                                       http://www.companyname.net | //+------------------------------------------------------------------+ extern double TakeProfit=10000; extern double timeframe=0; //0=atual / 1=1M / 60=1H / 240=4H / 1440=1D / 10080=1Semana / 43200=1MES extern double Lots=0.01; extern double TrailingStop=0; extern double Stop_loss_buy=0; extern double Stop_loss_sell=0; extern double Price_buy1=0; extern double Price_sell1=0; extern double Price_buy2=0; //--- string lastSignalUsed="No signal"; //+------------------------------------------------------------------+ //|                                                                  | //+------------------------------------------------------------------+ int start()   {       double Price1,Price2;    int cnt,ticket,total;       Price1=iMA(NULL,timeframe,1,0,MODE_SMA,0,1);         //PREÇO atual    Price2=iMA(NULL,timeframe,1,0,MODE_SMA,0,2);         //PREÇO anterior       total=OrdersTotal();    if(total<1)      {       if(AccountFreeMargin()<(1*Lots))         {          Print("Account Free Margin = ",AccountFreeMargin());          return(0);         }       if(                   (Price1>Price_buy1 && Price20)            {             if(OrderSelect(ticket,SELECT_BY_TICKET,MODE_TRADES))                {                Print("BUY : ",OrderOpenPrice());                lastSignalUsed="Buy";                }            }          else Print("BUY Error: ",GetLastError());          return(0);         }       if(                                   (Price1Price_sell1)                                                 )         {          ticket=OrderSend(Symbol(),OP_SELL,Lots,Bid,3,Stop_loss_sell,Bid-TakeProfit*Point,"EA SKY TRADE",123456,0,Red);          if(ticket>0)            {             if(OrderSelect(ticket,SELECT_BY_TICKET,MODE_TRADES))                {                Print("SELL : ",OrderOpenPrice());                lastSignalUsed="Sell";                }            }          else Print("SELL  Error: ",GetLastError());          return(0);         }       return(0);      }    for(cnt=0;cntPrice_sell1)                                                                                )               {                if(!OrderClose(OrderTicket(),OrderLots(),Bid,3,Red))                  {                   Print("OrderClose() failed with error :  "+GetLastError());                   return(0);                  }               }             if(TrailingStop>0)               {                if(Bid-OrderOpenPrice()>Point*TrailingStop)                  {                   if(OrderStopLoss()Price_buy1 && Price20)               {                if((OrderOpenPrice()-Ask)>(Point*TrailingStop))                  {                   if((OrderStopLoss()>(Ask+Point*TrailingStop)) || (OrderStopLoss()==0))                     {                      if(!OrderModify(OrderTicket(),OrderOpenPrice(),Ask+Point*TrailingStop,OrderTakeProfit(),0,Gray))                        {                         Print("OrderModify() failed with error :  "+GetLastError());                         return(0);                          }                        }                     }                  }               }            }          }    return(0);   } //+------------------------------------------------------------------+ ``` Attached files:   manual_sr.zip  (245.12 KB)