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

 
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 :) 

 
Thanks!!!!!! Cool, massive, very necessary and useful work!!!! Even with its individual flaws, it's very very helpful when translating a robot from language to language. I'm not talking about a completely substring translation, no, just when you look at the robot in the fourth, and do not know where in the help of the fifth to look for this that does not compile, say... And here you can find explanations in detail!!! It's very necessary and useful!
 

Could you please tell me which code in MQL5 can be used to get the same as below for MQL4?

double AccountFreeMarginCheck(string symbol,
                              int cmd,
                              double volume)
NO analogue
AccountFreeMarginCheck
Returns the amount of free funds that will remain after opening the specified position at the current price on the current account.
AccountFreeMarginCheck - Документация на MQL4
  • docs.mql4.com
AccountFreeMarginCheck - Документация на MQL4
 
solandr:

Could you please tell me which code in MQL5 can be used to get the same as below for MQL4?

...
Look at the OrderCalcProfit(...) and OrderCalcMargin(...) functions.
 

iBarShift erroneous.

Read more https://www.mql5.com/ru/forum/11243/

 

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
 

The article Migration from MQL4 to MQL5 concludes with the following statement

3. It is planned to create an emulator that will allow you to run your MQL4 programmes in the new MT5 terminal.

who can tell me, is this emulator already available or when will it appear?

 
Novikov:

The article Migration from MQL4 to MQL5 concludes with the following statement

who can tell me, is this emulator already available or when will it appear?

Yes, it was created at the same time as the article. But there is no sense in it, without trading functions!