Discussion of article "Migrating from MQL4 to MQL5" - page 2

 

I love this article ! thanks

 

So if you're not some kinda programer you're stuffed!!

 

Thanks MT5 :) 

 
Hi how do i use ima() in a ma cross expert advisor in mql5 if it doesnt contain an entry for bar shift, because the mql4 format gives an error saying "wrong parameters count" you should note that im not talking about ma_shift here
Documentation on MQL5: Technical Indicators / iMA
  • www.mql5.com
Technical Indicators / iMA - Documentation on MQL5
 

i love this article.

your idea for make emulator mt4, very good idea... 

 

Thank you for this nice article.
 
Trintoro:

i love this article.

your idea for make emulator mt4, very good idea... 

I agree with Trintoro. This article is not about migrating, it's more like emulating. I much concern about speed execution then especially after reading this and Rosh's reply to this topic.  I think what happen to that topic, is the user still think in MQL4 kind a way. Maybe out of habit, so I can't blame him.

Its better to fresh learn and fresh write everything directly into mql5 rather than using commands that this article suggest.

Nevertheless, it's good to know the differences which this article has show.  

BTW. Out of my habit :

1. Pressing F5 (or F7, but rarely use) in MQL4 MetaEditor will compile, in MQL5 MetaEditor is F7 to compile, F5 will start / resume debugging.

2. In MQL4 MetaEditor, pressing Esc, will show/hide Toolbox window, In MQL5 MetaEditor, nothing will ever happen.  

Migrating that are annoying for me :) 

 

Dear Guys,

I call a below function into my indicator. But i got 7 warning message. i can i improve below function, so that not to show warning message:

 

double MarketInfoMQL4(string symbol,
                      int type)
  {
   switch(type)
     {
      case MODE_LOW:
         return(SymbolInfoDouble(symbol,SYMBOL_LASTLOW));
      case MODE_HIGH:
         return(SymbolInfoDouble(symbol,SYMBOL_LASTHIGH));
      case MODE_TIME:
         return(SymbolInfoInteger(symbol,SYMBOL_TIME));
      case MODE_BID:
         //return(Bid);
      case MODE_ASK:
         //return(Ask);
      case MODE_POINT:
         return(SymbolInfoDouble(symbol,SYMBOL_POINT));
      case MODE_DIGITS:
         return(SymbolInfoInteger(symbol,SYMBOL_DIGITS));
      case MODE_SPREAD:
         return(SymbolInfoInteger(symbol,SYMBOL_SPREAD));
      case MODE_STOPLEVEL:
         return(SymbolInfoInteger(symbol,SYMBOL_TRADE_STOPS_LEVEL));
      case MODE_LOTSIZE:
         return(SymbolInfoDouble(symbol,SYMBOL_TRADE_CONTRACT_SIZE));
      case MODE_TICKVALUE:
         return(SymbolInfoDouble(symbol,SYMBOL_TRADE_TICK_VALUE));
      case MODE_TICKSIZE:
         return(SymbolInfoDouble(symbol,SYMBOL_TRADE_TICK_SIZE));
      case MODE_SWAPLONG:
         return(SymbolInfoDouble(symbol,SYMBOL_SWAP_LONG));
      case MODE_SWAPSHORT:
         return(SymbolInfoDouble(symbol,SYMBOL_SWAP_SHORT));
      case MODE_STARTING:
         return(0);
      case MODE_EXPIRATION:
         return(0);
      case MODE_TRADEALLOWED:
         return(0);
      case MODE_MINLOT:
         return(SymbolInfoDouble(symbol,SYMBOL_VOLUME_MIN));
      case MODE_LOTSTEP:
         return(SymbolInfoDouble(symbol,SYMBOL_VOLUME_STEP));
      case MODE_MAXLOT:
         return(SymbolInfoDouble(symbol,SYMBOL_VOLUME_MAX));
      case MODE_SWAPTYPE:
         return(SymbolInfoInteger(symbol,SYMBOL_SWAP_MODE));
      case MODE_PROFITCALCMODE:
         return(SymbolInfoInteger(symbol,SYMBOL_TRADE_CALC_MODE));
      case MODE_MARGINCALCMODE:
         return(0);
      case MODE_MARGININIT:
         return(0);
      case MODE_MARGINMAINTENANCE:
         return(0);
      case MODE_MARGINHEDGED:
         return(0);
      case MODE_MARGINREQUIRED:
         return(0);
      case MODE_FREEZELEVEL:
         return(SymbolInfoInteger(symbol,SYMBOL_TRADE_FREEZE_LEVEL));

      default: return(0);
     }
   return(0);
  }
 
advali82:

Dear Guys,

I call a below function into my indicator. But i got 7 warning message. i can i improve below function, so that not to show warning message:

 

What are thee warning ?
 
RaptorUK:
What are thee warning ?

warning is:

possible loss of data due to type conversion Ciiio.mq5 676 10

Documentation on MQL5: Language Basics / Data Types / Typecasting
  • www.mql5.com
Language Basics / Data Types / Typecasting - Documentation on MQL5
 
iStdOnArray() is missing :) Seems MT5 is the first autotrading platform which doesn't have basic statistic :) Trying to do something with MQL5 for a few days, but until now only various problems like I would be creating entire financial engineering warehouse.
Reason: