MT4 to MT5 code converter - page 52

9555803824
5
9555803824  
HELLO MLADEN, CAN YOU CONVERT THIS INTO MQL5?...PLEEEEASSE

Donley Pope
95
Donley Pope  
The script is not working for me it showing error message
putri88
34
putri88  

MQL5 help

Can anyone give me any suggestion to translate this simple indicator from MQL4 to MQL5 ?

I'v tried with mql4to5rewrite_sample_v4_2 script but it really doesn't work properly....

Thanks for help !

Files:
Keith Watford
Moderator
26733
Keith Watford  
putri88:

MQL5 help

Can anyone give me any suggestion to translate this simple indicator from MQL4 to MQL5 ?

I'v tried with mql4to5rewrite_sample_v4_2 script but it really doesn't work properly....

Thanks for help !

That is not an indicator, it is an EA.

putri88
34
putri88  
#property copyright "(c) Fx ";

string                  simbol            = Symbol(),                        aVcL              = "aVcL  b2bM";  
int                     magicBuyAv        = 12345,                           magicSellAv       = 123451; 
double                  spreadB           = 50,                              spreadS           = 20, 
                        awalOrderAtas     = 77777,                           awalOrderBwh      = 0.07;
extern double           TPh1           = 2000,                               SLh1         = 1000;

int OnInit()  {   Comment("(c) Fx ");   return(INIT_SUCCEEDED);  }
void OnDeinit(const int reason)  {  }

void OnTick()  { 
   entry_Arah();
      if(cekJml(OP_BUY, magicBuyAv )   == 0) b2bM (OP_BUYSTOP ,magicBuyAv);      
      if(cekJml(OP_SELL,magicSellAv )  == 0) b2bM (OP_SELLSTOP,magicSellAv);    
   exit_TPSL();
  }

void entry_Arah()   {
   int i;   bool t;
   for(i=0; i<OrdersTotal(); i++)
      {
      t=OrderSelect(i,SELECT_BY_POS, MODE_TRADES); 
      if (OrderType()==OP_BUYSTOP && OrderSymbol()==simbol &&  OrderMagicNumber()!=magicBuyAv  )
         {
            if(cekJml(OP_BUYSTOP, magicBuyAv ) == 0) t=OrderSend(simbol,OP_BUYSTOP,OrderLots(), awalOrderAtas, 3,0,0,aVcL,   magicBuyAv, 0,Green);
            t=OrderDelete(OrderTicket());
         }
      if (OrderType()==OP_SELLSTOP && OrderSymbol()==simbol && OrderMagicNumber() != magicSellAv )
         {
            if(cekJml(OP_SELLSTOP, magicSellAv)== 0) t=OrderSend(simbol,OP_SELLSTOP, OrderLots() ,awalOrderBwh, 3,0,0,aVcL,   magicSellAv, 0,Red);        
            t=OrderDelete(OrderTicket());
         }
      }
   } 
 
void b2bM(int arah,int magic)    {
   int i;   bool t;
   for(i=0; i<OrdersTotal(); i++)
      {
      t=OrderSelect(i,SELECT_BY_POS,MODE_TRADES);
      if(OrderSymbol() == simbol && arah==OP_BUYSTOP && OrderMagicNumber()==magic && OrderTakeProfit() ==0 && OrderStopLoss()==0)
         {
         if ( iMACD(simbol,0,5,13,1,PRICE_WEIGHTED,MODE_MAIN,1) < 0 &&  iMACD(simbol,0,5,13,1,PRICE_WEIGHTED,MODE_MAIN,2)<0 )   // macd di bwh
            {
            if(iLow  (simbol,0,1) <= iLow (simbol,0,2)  &&  iHigh (simbol,0,1)  < iHigh(simbol,0,2))                                           t=OrderModify(OrderTicket(), iHigh(simbol,0,2)+spreadB*Point(),0,0, 0,Green);    // break 2bar yg lalu
            if(iHigh (simbol,0,1) <  OrderOpenPrice()   &&  iHigh (simbol,0,1)  < iHigh(simbol,0,3) && iHigh(simbol,0,1) > iHigh(simbol,0,2))  t=OrderModify(OrderTicket(), iHigh(simbol,0,1)+spreadB*Point(),0,0, 0,Green);
            }
         }
      if(OrderSymbol()== simbol &&  arah==OP_SELLSTOP && OrderMagicNumber()== magic && OrderTakeProfit() ==0 && OrderStopLoss()==0)
         {
         if ( iMACD(simbol,0,5,13,1,PRICE_WEIGHTED,MODE_MAIN,1) > 0 &&  iMACD(simbol,0,5,13,1,PRICE_WEIGHTED,MODE_MAIN,2)>0 )
            {
            if(iHigh (simbol,0,1) >= iHigh (simbol,0,2) && iLow(simbol,0,1) > iLow(simbol,0,2))                                        t=OrderModify(OrderTicket(), iLow(simbol,0,2)-spreadS*Point(),0,0, 0,Red);
            if(iLow  (simbol,0,1) >  OrderOpenPrice()   && iLow(simbol,0,1) > iLow(simbol,0,3) && iLow(simbol,0,1) < iLow(simbol,0,2)) t=OrderModify(OrderTicket(), iLow(simbol,0,1)-spreadS*Point(),0,0, 0,Red);
            }
         }
      } 
   }
    
void exit_TPSL()    {
   int i=0;   bool t;
   for(i=0; i<OrdersTotal(); i++)
     {
      t=OrderSelect(i,SELECT_BY_POS,MODE_TRADES);
      if(OrderSymbol()==simbol)
        {
         if(OrderType()==OP_BUY  && OrderTakeProfit() == 0 && OrderStopLoss() == 0 ) t= OrderModify(OrderTicket(),OrderOpenPrice(),OrderOpenPrice()- SLh1*Point(),OrderOpenPrice()+ TPh1*Point(),0,Green);
         if(OrderType()==OP_SELL && OrderTakeProfit() == 0 && OrderStopLoss() == 0 ) t= OrderModify(OrderTicket(),OrderOpenPrice(),OrderOpenPrice()+ SLh1*Point(),OrderOpenPrice()- TPh1*Point(),0,Red);
         if(cekJml(OP_BUY,magicBuyAv) == 1  && cekJml(OP_BUYSTOP,magicBuyAv)  ==0 )  t=OrderSend(simbol,OP_BUYSTOP, 2*cekLotAwal(OP_BUY, magicBuyAv),awalOrderAtas,3,0,0,aVcL,magicBuyAv,0,Green);  //
         if(cekJml(OP_SELL,magicSellAv)== 1 && cekJml(OP_SELLSTOP,magicSellAv)==0 )  t=OrderSend(simbol,OP_SELLSTOP,2*cekLotAwal(OP_SELL,magicSellAv),awalOrderBwh, 3,0,0,aVcL,magicSellAv,0,Red  );
        }
     }
  }

int cekJml(int mode,int magic)   {
   int i, x=0;   bool t;
   for(i=0; i<OrdersTotal(); i++)
      {
      t=OrderSelect(i,SELECT_BY_POS, MODE_TRADES);
      if(OrderSymbol()==simbol &&  OrderType()==mode  && OrderMagicNumber()==magic)   x++;
      }
   return(x);
   }

double cekLotAwal(int ini,int magicN)   {
   int i;   bool t;   double x=0;
   for(i=0; i<OrdersTotal(); i++)
      {
      t=OrderSelect(i,SELECT_BY_POS, MODE_TRADES);
      if(OrderSymbol()==simbol &&  OrderType()==ini  && OrderMagicNumber()==magicN)    x=OrderLots();
      }
   return(x);
   }

Hello

Anyone that can convert this EA to MT5?

Thank you

putri88
34
putri88  


Keith Watford:

That is not an indicator, it is an EA.


yes, sorry, I just copy paste from other guy, because of my English,

Thanks a lot Keith

2020Abm
9
2020Abm  
Hello can someone please help convert this indicators  mt4 to mt5 indicators please help me out
Island Palm
20
Island Palm  

need help convert mt4 code to mt5. 

please advise if anyone can assist. 

Sergey Golubev
Moderator
119513
Sergey Golubev  
Island Palm:

need help convert mt4 code to mt5. 

please advise if anyone can assist. 

You can use Freelance for example.
Trading applications for MetaTrader 5 to order
Trading applications for MetaTrader 5 to order
  • www.mql5.com
I want to convert this script to mql4: // // @author LazyBear // // If you use this code in its original/modified form, do drop me a note. // n1 = input(10, "Channel Length") n2 = input(21, "Average Length") obLevel1 = input(60, "Over Bought Level 1") obLevel2 = input(53, "Over Bought Level 2") osLevel1 = input(-60, "Over Sold Level 1...
Only Brave
10
Only Brave  

Hello People any one can do me favor and convert this small indicator to enlarge to wick for the candle to make it more visible  

Weak vision here :)