Nice code !

 
I would like to change this EA. The system should open a new position of 0,01 lot only if it reaches TP trading profit of 10 pips.

Now the system recognizes the small profit position as the basis for opening a 0.01 lot (and that is the beginning of the cycle)

A system starts from 0.01 flight and increases 0.03, 0.07 ................. and as it finally reaches open position TP 10pips it should open, new order 0 , 01lot.
 

My question is who can change it?


This is code :


//|                        Copyright 2016, MetaQuotes Software Corp. |

//|                                             https://www.mql5.com |

//+------------------------------------------------------------------+

#property copyright "Copyright 2016, MetaQuotes Software Corp."

#property link      "https://www.mql5.com"

#property version   "1.00"

#property strict

input string FirstSessionStart    = "23:10:32";

input string FirstSessionEnd      = "23:30:06";

input string SecondSessionStart   = "23:40:27";

input string SecondSessionEnd     = "00:40:45";

input string ThirdSessionStart    = "05:10:13";

input string ThirdSessionEnd      = "05:40:14";

input string FourthSessionStart   = "06:10:25";

input string FourthSessionEnd     = "06:40:16";

input string FifthSessionStart    = "07:10:30";

input string FifthSessionEnd      = "07:40:54";

input string SixthSessionStart    = "08:10:13";

input string SixthSessionEnd      = "08:40:14";

input string SeventhSessionStart   = "09:10:25";

input string SeventhSessionEnd     = "09:40:16";

input string EightSessionStart    = "10:10:30";

input string EightSessionEnd      = "10:40:54";

input string Symbol1 = "EURUSD";

input ENUM_ORDER_TYPE Order1 = OP_BUY;

input string Symbol2 = "GBPUSD";

input ENUM_ORDER_TYPE Order2 = OP_BUY;

input string Symbol3 = "USDJPY";

input ENUM_ORDER_TYPE Order3 = OP_BUY;

input string Symbol4 = "EURUSD";

input ENUM_ORDER_TYPE Order4 = OP_BUY;

input string Symbol5 = "EURUSD";

input ENUM_ORDER_TYPE Order5 = OP_BUY;

input string Symbol6 = "USDJPY";

input ENUM_ORDER_TYPE Order6 = OP_SELL;

input string Symbol7 = "EURUSD";

input ENUM_ORDER_TYPE Order7 = OP_SELL;

input string Symbol8 = "EURUSD";

input ENUM_ORDER_TYPE Order8 = OP_SELL;

input double LotSize = 0.01;

input double LotSize2 = 0.03;

input double LotSize3 = 0.07;

input double LotSize4 = 0.15;

input double LotSize5 = 0.3;

input double LotSize6 = 0.62;

input double LotSize7 = 1.24;

input double LotSize8 = 2.50;

input double LotSize9 = 5.01;

input double LotSize10 = 10.03;

input double LotSize11 = 20;

input double LotSize12 = 40;

input double LotSize13 = 80;

input double StopLoss = 300;

input double TakeProfit = 300;

input int MagicNumber = 637373;

int session1trade, session2trade, session3trade, session4trade, session5trade, firsttrade, LastClosedTime,

   session6trade, session7trade, session8trade; 

//+------------------------------------------------------------------+

//| Expert initialization function                                   |

//+------------------------------------------------------------------+

int OnInit()

  {

//---

   firsttrade=1;

   session1trade=1;

   session2trade=1;

   session3trade=1;

   session4trade=1;

   session5trade=1;

   session6trade=1;

   session7trade=1;

   session8trade=1;

   LastClosedTime=(int)TimeCurrent();

//---

   return(INIT_SUCCEEDED);

  }

//+------------------------------------------------------------------+

//| Expert deinitialization function                                 |

//+------------------------------------------------------------------+

void OnDeinit(const int reason)

  {

//---   

  }

//+------------------------------------------------------------------+

//| Expert tick function                                             |

//+------------------------------------------------------------------+

void OnTick()

  {

//---

   LastTrades();

   Comment(session2trade," ", OpenOrdersThisPair(Symbol2)," ", typer);

   if(!WorkingHour(FirstSessionStart,FirstSessionEnd) &&

      !WorkingHour(SecondSessionStart,SecondSessionEnd) &&

      !WorkingHour(ThirdSessionStart,ThirdSessionEnd) &&

      !WorkingHour(FourthSessionStart,FourthSessionEnd) &&

      !WorkingHour(FifthSessionStart,FifthSessionEnd)  &&

      !WorkingHour(SixthSessionStart,SixthSessionEnd) &&

      !WorkingHour(SeventhSessionStart,SeventhSessionEnd) &&

      !WorkingHour(EightSessionStart,EightSessionEnd)){CLOSEALL(0);CLOSEALL(1);session1trade=1;

                               session2trade=1;session3trade=1;session4trade=1;session5trade=1;}
   
   if(WorkingHour(FirstSessionStart,FirstSessionEnd) && OpenOrdersThisPair(Symbol1)==0 && session1trade==1){

      if(typer==OP_SELL||firsttrade==1){

         if(OrderEntry(Order1,Symbol1)){

         session1trade=0;

         }

      }      

      if(typer==OP_BUY){

         if(OrderEntry(Order1,Symbol1)){

         session1trade=0;

         }
      }      
   }   

   if(WorkingHour(SecondSessionStart,SecondSessionEnd) && OpenOrdersThisPair(Symbol2)==0 && session2trade==1){

      if(typer==OP_SELL||firsttrade==1){

         if(OrderEntry(Order2,Symbol2)){

         session2trade=0;

         }
      }      

      if(typer==OP_BUY){

         if(OrderEntry(Order2,Symbol2)){

         session2trade=0;

         }
      }      
   }   

   if(WorkingHour(ThirdSessionStart,ThirdSessionEnd) && OpenOrdersThisPair(Symbol3)==0 && session3trade==1){

      if(typer==OP_SELL||firsttrade==1){

         if(OrderEntry(Order3,Symbol3)){

         session3trade=0;

         }
      }
      
      if(typer==OP_BUY){

         if(OrderEntry(Order3,Symbol3)){

         session3trade=0;

         }
      }      
   }   

   if(WorkingHour(FourthSessionStart,FourthSessionEnd) && OpenOrdersThisPair(Symbol4)==0 && session4trade==1){

      if(typer==OP_SELL||firsttrade==1){

         if(OrderEntry(Order4,Symbol4)){

         session4trade=0;

         }
      }
      
      if(typer==OP_BUY){

         if(OrderEntry(Order4,Symbol4)){

         session4trade=0;

         }
      }      
   }   

   if(WorkingHour(FifthSessionStart,FifthSessionEnd) && OpenOrdersThisPair(Symbol5)==0 && session5trade==1){

      if(typer==OP_SELL||firsttrade==1){

         if(OrderEntry(Order5,Symbol5)){

         session5trade=0;

         }
      }      

      if(typer==OP_BUY){

         if(OrderEntry(Order5,Symbol5)){

         session5trade=0;

         }
      }      
   }
   
   if(WorkingHour(SixthSessionStart,SixthSessionEnd) && OpenOrdersThisPair(Symbol6)==0 && session6trade==1){

      if(typer==OP_SELL||firsttrade==1){

         if(OrderEntry(Order6,Symbol6)){

         session6trade=0;

         }
      }
      
      if(typer==OP_BUY){

         if(OrderEntry(Order6,Symbol6)){

         session6trade=0;

         }
      }      
   }
   
   if(WorkingHour(SeventhSessionStart,SeventhSessionEnd) && OpenOrdersThisPair(Symbol7)==0 && session7trade==1){

      if(typer==OP_SELL||firsttrade==1){

         if(OrderEntry(Order7,Symbol7)){

         session7trade=0;

         }
      }
      
      if(typer==OP_BUY){

         if(OrderEntry(Order7,Symbol7)){

         session7trade=0;

         }
      }      
   }
   
   if(WorkingHour(EightSessionStart,EightSessionEnd) && OpenOrdersThisPair(Symbol8)==0 && session8trade==1){

      if(typer==OP_SELL||firsttrade==1){

         if(OrderEntry(Order8,Symbol8)){

         session8trade=0;

         }
      }
      
      if(typer==OP_BUY){

         if(OrderEntry(Order8,Symbol8)){

         session8trade=0;

         }
      }      
   }   
  }

//+------------------------------------------------------------------+


//+------------------------------------------------------------------+

//|                                                                  |

//+------------------------------------------------------------------+

bool WorkingHour(string StartHour, string EndHour)

{
   datetime gi_time_01 = StringToTime(TimeToString(TimeCurrent(), TIME_DATE) + " " + StartHour);

   datetime gi_time_02 = StringToTime(TimeToString(TimeCurrent(), TIME_DATE) + " " + StartHour);

   datetime datetime_0 = TimeCurrent();
   
   if( gi_time_01 < gi_time_02+300 && gi_time_01 <= datetime_0 && datetime_0 <= gi_time_02+300 ) return (true);

   if( gi_time_01 > gi_time_02+300 && (datetime_0 >= gi_time_01 || datetime_0 <= gi_time_02+300) ) return (true);
   
   return (false);

}

//+------------------------------------------------------------------+

//+ Order Entry                                                      |

//+------------------------------------------------------------------+

double bsl, btp, ssl, stp;

bool OrderEntry(int direction, string symbol)

{   
   double tp = 0,sl = 0;

   int buyticket=0,sellticket=0;
   
   LastTrades();   

   double flot = LotSize;
   
   if(lastprofit<0 && lastvolume==LotSize){flot=LotSize2;}

   if(lastprofit<0 && lastvolume==LotSize2){flot=LotSize3;}

   if(lastprofit<0 && lastvolume==LotSize3){flot=LotSize4;}

   if(lastprofit<0 && lastvolume==LotSize4){flot=LotSize5;}

   if(lastprofit<0 && lastvolume==LotSize5){flot=LotSize6;}

   if(lastprofit<0 && lastvolume==LotSize6){flot=LotSize7;}

   if(lastprofit<0 && lastvolume==LotSize7){flot=LotSize8;}

   if(lastprofit<0 && lastvolume==LotSize8){flot=LotSize9;}

   if(lastprofit<0 && lastvolume==LotSize9){flot=LotSize10;}

   if(lastprofit<0 && lastvolume==LotSize10){flot=LotSize11;}

   if(lastprofit<0 && lastvolume==LotSize11){flot=LotSize12;}

   if(lastprofit<0 && lastvolume==LotSize12){flot=LotSize13;}
   
   //if(trade==1){

   if(OpenOrdersThisPair(symbol)==0){

   if(direction==0)

   {

   RefreshRates();

   if(StopLoss>0){bsl=SymbolInfoDouble(symbol,SYMBOL_ASK)-(StopLoss*SymbolInfoDouble(symbol,SYMBOL_POINT));}else{bsl=0;}

   if(TakeProfit>0){btp=SymbolInfoDouble(symbol,SYMBOL_ASK)+(TakeProfit*SymbolInfoDouble(symbol,SYMBOL_POINT));}else{btp=0;}
   
      if(OrderSend(symbol,OP_BUY,flot,SymbolInfoDouble(symbol,SYMBOL_ASK),10,bsl,btp,"Gabien EA",MagicNumber,0,Green)){

      firsttrade=0;

      return(true);

      }

      //trade=0;
      
   }   

   if(direction==1)

   {

   RefreshRates();

   if(StopLoss>0){ssl=SymbolInfoDouble(symbol,SYMBOL_BID)+(StopLoss*SymbolInfoDouble(symbol,SYMBOL_POINT));}else{ssl=0;}

   if(TakeProfit>0){stp=SymbolInfoDouble(symbol,SYMBOL_BID)-(TakeProfit*SymbolInfoDouble(symbol,SYMBOL_POINT));}else{stp=0;}   

      if(OrderSend(symbol,OP_SELL,flot,SymbolInfoDouble(symbol,SYMBOL_BID),10,ssl,stp,"Gabien EA",MagicNumber,0,Red)){

      firsttrade=0;

      return(true);

      }

      //trade=0;

      }      
    }

 return(false);

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

//insuring its a new candle function

//+------------------------------------------------------------------+

bool IsNewCandle()

{
   static int BarsOnChart=0;

if (Bars == BarsOnChart)

return (false);

BarsOnChart = Bars;

return(true);

}

void CLOSEALL(int type)

{  for(int x=OrdersTotal()-1;x>=0;x--)

  {if(!OrderSelect(x,SELECT_BY_POS,MODE_TRADES))continue;

   if(OrderMagicNumber()!=MagicNumber)continue;

   if(OrderType()>1)if(OrderDelete(OrderTicket(),clrNONE))continue;

   if(OrderType()==0&&type==0)if(OrderClose(OrderTicket(),OrderLots(),OrderClosePrice(),10,clrNONE))continue;

   if(OrderType()==1&&type==1)if(OrderClose(OrderTicket(),OrderLots(),OrderClosePrice(),10,clrNONE))continue; 

  }
}

//+-------------------------------

//+ Check Open Orders

//+-------------------------------

int OpenOrdersThisPair(string pair)

{
  int total=0;

   for(int i=OrdersTotal()-1; i >= 0; i--)

  {
      if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES)){

         if(OrderMagicNumber()==MagicNumber) total++;

         }
  }
  return (total);
}
int typer=4;

double lastvolume, lastprofit;

void LastTrades(){

  int CurClosedTime=0;

  //typer = 4;
    
   for(int i = (OrdersHistoryTotal()); i >= 0; i --){

      if(OrderSelect(i, SELECT_BY_POS, MODE_HISTORY)){
      
         CurClosedTime=(int)OrderCloseTime();

            if(OrderMagicNumber()==MagicNumber && CurClosedTime>LastClosedTime){

                       LastClosedTime=(int)OrderCloseTime();

               typer = OrderType(); 

               lastvolume= OrderLots();

               lastprofit = OrderProfit();            
            }
      }
   }
}


Automated Trading and Strategy Testing
Automated Trading and Strategy Testing
  • www.mql5.com
Choose a suitable trading strategy and subscribe to it with a few clicks. All Signals are provided with detailed statistics and informative charts. Become a trading signal provider and sell subscriptions to thousands of traders around the world. With the Signals service, your successful strategy can generate income with a small start-up budget...
 

You can consider  Freelance section.  Regards.

Freelance service at MQL5.com
Freelance service at MQL5.com
  • www.mql5.com
Im good in trading. Personal traders do a great trading. Looking for Development of a trading robot in MQL5/MQL4Develop a trading strategy and order a robot that can automatically trade in the forex and exchange markets (currencies, stocks, futures and CFDs) in accordance with your strategy projection of price from known points on the...
 
GABIEN: My question is who can change it?
  1. When you post code please use the SRC button! Please edit your post.
               General rules and best pratices of the Forum. - General - MQL5 programming forum

  2. You have only four choices: We're not going to code it for you (although it could happen if you are lucky or the problem is interesting.) We are willing to help you when you post your attempt (using SRC) and the nature of your problem.
              No free help
              urgent help.
 

Who can help change this code  !

 
GABIEN:

Who can help change this code  !

 
Sergey Golubev:

Who can help change this code 

 

Here they can help you https://www.mql5.com/en/job


Freelance service at MQL5.com
Freelance service at MQL5.com
  • www.mql5.com
I need a high low indicator that show the high low of bigger charts for Metatrader 5  Example  1 hour would show the high low of the candle on the 4 hour chart when price closes by 1 pip (pip value can be changed) within one bar ago's high or low give it an arrow up or downExample 2 15 min chart how the high low of the candle on the 1 hour  I...
 

nobody

 
You've asked four times.
OP GABIEN: Who can help change this code  !
#3 GABIEN:Who can help change this code  !
#6 GABIEN: Who can help change this code 
#8 GABIEN: nobody
Your question has already been answered three times.
#1 Jose Francisco Casado Fernandez: You can consider  Freelance section.  Regards.
#2 whroeder1: or pay (Freelance) someone to code it. We're not going to code it for you
#7 Marco vd Heijden: Here they can help you https://www.mql5.com/en/job

What part of don't you under stand?

Reason: