What mql5 code can do that mql4 can't?

 
Mql5 is based directly on C++ a strong language as everyone know,  but what exaclety i wont be able to program - that is useful-   on mql4 that i can only code on mql5? thanks
 

The question should be about, what the difference of native MQL4 and new MQL4 or MQL5 is, because new MQL4 and MQL5 are basically the same, except that new MQL4 is designed for MT4 and MQL5 is designed for MT5.

There are plenty of things that you cannot do with native MQL4, but it depends on your skills as a developer. The power of inheritance and overloading is priceless and allows for example for complex programs at a maximum level of compatiblity in view of future changes, for much better structured code, for higher efficiency, for easy communcation between objects/modules inside your code ... and so on. Fact is, there is nothing what you cant do with native MQL4 what you could not do with new MQL4/MQL5, but not vice versa.

If you ever get really familiar with true object orientied programming, you will never code native again.  

 

The main advantage mt5 have over mt4 is that it works in 64 bits mode, this is great for more complex Ea's, because 64 bits can do serveral  things at the same time, it is a multi threaded cpu technology,

where mt4 only can do one thing at the time,  if for example a code have multiple instructions, Mt4 must first do the 1, wait for it complete then begin with 2, and wait for it to complete, then 3, etc.

Mt5 will do all the calls at once, depending on how many instructions there is, so mt5 will work faster with code and it can be made to do things mt4 can't,

of course this require a computer with a cpu based on 64 bits technology. but the bad part is that you must re-invest, re-code in all previous indicators and EA's you have for mt4,

which is why nobody wants to use Mt5. 

 
The last sentence is interesting, the rest of course too, but has there ever been a poll why people avoided MT5? The main argument I heard was, that MT5 didnt support hedging?! And of course also cause most did not want to re-code due to the different order mechanism and so on, anyway, you can run MT5 in 32 bit mode and you are not forced to implement multithreading. 
 
cozyman:

The main advantage mt5 have over mt4 is that it works in 64 bits mode, this is great for more complex Ea's, because 64 bits can do serveral  things at the same time, it is a multi threaded cpu technology,

where mt4 only can do one thing at the time,  if for example a code have multiple instructions, Mt4 must first do the 1, wait for it complete then begin with 2, and wait for it to complete, then 3, etc.

Mt5 will do all the calls at once, depending on how many instructions there is, so mt5 will work faster with code and it can be made to do things mt4 can't,

of course this require a computer with a cpu based on 64 bits technology. but the bad part is that you must re-invest, re-code in all previous indicators and EA's you have for mt4,

which is why nobody wants to use Mt5. 

The disadvantage of MQL5 over MQL4 is that the amount of code required for the same operation can often be a factor of X100.

This means what you do in MQL4 in just a single line of code, can take 100 Lines of code in MQL5.

Thus it means, in this example, that you are writing 100 times the amount of code in MQL5, that you would normally have to write in MQL4 to accomplish the same result.

 
Marco vd Heijden:

The disadvantage of MQL5 over MQL4 is that the amount of code required for the same operation can often be a factor of X100.

This means what you do in MQL4 in just a single line of code, can take 100 Lines of code in MQL5.

Thus it means, in this example, that you are writing 100 times the amount of code in MQL5, that you would normally have to write in MQL4 to accomplish the same result.

This is excessive. Sometimes you need some additional lines of code in mql5.
 
Alain Verleyen:
This is excessive. Sometimes you need some additional lines of code in mql5.

100 times more code isn't some additional lines of code its a 100 fold increase and i think it is utter insanity.

I have seen it more then on one occasion, in fact i have seen it on most if not all occasions.

Maybe not all to this X100 extend but it was certainly present, and when i came by the X100 example i was simply amazed for quite some time.

It was 97 lines of code to draw a single object, where i would only need one line to draw the exact same thing in MQL4.

I remember it very well because it was the moment i took on the X100 factor and decided to stick to it as a standard measure.

 
Marco vd Heijden:

100 times more code isn't some additional lines of code its a 100 fold increase and i think it is utter insanity.

I have seen it more then on one occasion, in fact i have seen it on most if not all occasions.

Maybe not all to this X100 extend but it was certainly present, and when i came by the X100 example i was simply amazed for quite some time.

It was 97 lines of code to draw a single object, where i would only need one line to draw the exact same thing in MQL4.

I remember it very well because it was the moment i took on the X100 factor and decided to stick to it as a standard measure.

There is enough to say about the actual pros and cons of both languages without inventing new one.

You are just not right.

 
Alain Verleyen:

There is enough to say about the actual pros and cons of both languages without inventing new one.

You are just not right.

Not right in what ?

 
Marco vd Heijden:

Not right in what ?

Please prove your assertion that "what you do in MQL4 in just a single line of code, can take 100 Lines of code in MQL5".

I am saying that this claim is never true.

 
Alain Verleyen:

Please prove your assertion that "what you do in MQL4 in just a single line of code, can take 100 Lines of code in MQL5".

I am saying that this claim is never true.

For me it is.

Yesterday i was reading a topic from imamushroom

He was wanting to create a trendline by angle.

#include <Kerching!/libIndicators.mqh>
#include <ChartObjects/ChartObjectsLines.mqh>

class CPlayable : CCustomIndicator
{
   private:
      bool _selectable;
      bool _hidden;
      color _l1Colour;
      color _l2Colour;
      bool _playable;        
      datetime _t[];
      double _o[];

      CChartObjectTrendByAngle* _L1;
      CChartObjectTrendByAngle* _L2; 
   
      double GetMa(int pAppliedPrice, int pShift);
      void UpdateMa(int pShift);
      
   public:
      void CPlayable(string pSymbol, int pTimeframe, bool pSelectable, bool pHidden, color pL1Colour, color pL2Colour);
      void ~CPlayable(void);
      bool Playable(int pShift);     
      int Direction(int pShift); 
};

void CPlayable::CPlayable(string pSymbol, int pTimeframe, bool pSelectable, bool pHidden, color pL1Colour, color pL2Colour)
{
   Init(pSymbol,pTimeframe);
   
   _selectable = pSelectable;
   _hidden = pHidden;
   _l1Colour = pL1Colour;
   _l2Colour = pL2Colour;
   _playable = false;

   
   _L1 = new CChartObjectTrendByAngle();
   _L2 = new CChartObjectTrendByAngle();

   
   const int m = 3;
   
   ArrayResize(_t,m);
   ArrayResize(_o,m);
}

void CPlayable::~CPlayable(void)
{
   delete _L1;
   delete _L2;
}

bool CPlayable::Playable(int pShift)
{
   if( _L1 != NULL ) _L1.Delete();
   if( _L2 != NULL ) _L2.Delete();
   
   int mt = ArraySize(_t);
   int mo = ArraySize(_o);
   
   CopyOpen(_symbol,_timeFrame,0,mt,_o);
   CopyTime(_symbol,_timeFrame,0,mo,_t);
   
   mt--;
   mo--;

   long chartid = ChartID();
   
   _L1.Create(chartid,"L1",0,_t[mt-1],_o[mo-1],_t[mt],_o[mo]);   // displays example screenshot
//   L1.SetDouble(OBJPROP_PRICE2,o0);  //works with this line but shouldn't need it 
   _L1.Selectable(_selectable);
   _L1.Selected(true);
   _L1.Hidden(_hidden);
   _L1.Color(_l1Colour);
   _L1.RayRight(true);
   
   _L2.Create(chartid,"L2",0,_t[mt-2],_o[mo-2],_t[mt-1],_o[mo-1]);
//   L2.SetDouble(OBJPROP_PRICE2,o1);
   _L2.Selectable(_selectable);
   _L2.Selected(true);
   _L2.Hidden(_hidden);
   _L2.Color(_l2Colour);
   _L2.RayRight(true);

   ObjectCreate(chartid,"Test",OBJ_TRENDBYANGLE,0,_t[mt-1],iClose(_symbol,_timeFrame,pShift+1),_t[mt],iClose(_symbol,_timeFrame,pShift));  //works
   
   double l1angle = _L1.Angle();

   PrintFormat("&& l1angle = %f, l2angle = %f, initalAngle = %i",l1angle,_L2.Angle());    // displaying 0.00
   PrintFormat("&& ObjectGetDouble(m_chart_id,m_name,OBJPROP_ANGLE) = %f,",ObjectGetDouble(chartid,"L1",OBJPROP_ANGLE));    // displaying 0.00
   PrintFormat("&& ObjectGetDouble(Close) = %f,",ObjectGetDouble(chartid,"Test",OBJPROP_ANGLE));  // displaying 0.00  

   
   return _playable;
}

i put it in the compiler and it read:

9


97 lines.

He asked for help and i told him i never use it like that.

I  simply use:

ObjectCreate("Ray1",OBJ_TREND,0,iTime(Symbol(),PERIOD_MN1,0),iOpen(Symbol(),PERIOD_MN1,0),iTime(Symbol(),PERIOD_M1,0),Bid);

For example, which is just one line, but i was unable to help him so i redirected him to Doerk Hilger

But i am not here to prove anything to anybody i just share my experience and for me there is no right or wrong.

You see it's all the same thing.

Wrong is simply less right, and likewise right is less wrong, but they are both one the same thing.

Reason: