How would one convert this AML_v2.mq4 to mq5? It creates ModSchiff PF and parallels, various "slave" objects that follow the user-drawn master Andrews PF object.

 

Hi mql5 experts,

 I have programmed several sophisticated indicators in MQL4, some even >25K lines (!).  It represents years of work, and happily for me anyway, most brokers show little sign of phasing out support for MT4.  I would have to guess that there is so much MT4 legacy work out there that it presents a big obstacle for users to move over to MT5.

I know so little about MQL5, the task of converting code over is a giant "UNKNOWN".   What kinds of things can MQL5 do better?  What kinds of things CANT it do at all?   I don't really know, and to be honest, I almost don't care very much -- so long as MT4 is supported.  That said, I can't count on the status quo forever, so I'm trying to get a sense of just how difficult (or impossible?) it would be to accomplish the same code-tasks I do quite well in MT4 in the newer MT5.

 I have heard rumors -- but don't really know if it's true -- that an MT5 indicator cannot create objects.   Is that so??  Hopefully I'm just misinformed, but rather than having somebody just say "yes" or "no", what I'd *really* like to know is to see a conversion of the attached AML_v2.mq4 file into MQL5.   A lot of Pitchfork traders do use this program or an older version (I made some minor improvements).  The user draws an Andrews pitchfork and changes the object name to "AL1", then adds this indicator to the chart and select the desired options.   A very useful "option" is to set the variable "Choose_type_of_Meridian_lines" to "3" which will calculate and draw the Modified Schiff variation of the Pitchfork, along with several "Quartiles" and "Warning" lines above and below the fork, parallel to the Mod.Schiff pitchfork.   If you move the original Andrews fork, the "slave" objects also move!  This capability is missing in MT4, and this indicator fills in a huge gap.  (FYI, many other commercial trading platforms have much better built-in support for Pitchforks and the various transforms and added parallel lines).

Maybe MT5 has "Modified Schiff" transforms built-in, but when I last looked (well over a year ago), it wasn't there.   If it's still not there, the need remains, and so... can the capability be coded up as an indicator in MQL5?

 

 EVEN IF MT5 now has Modified Schiff (and warning lines, quartiles, etc.) built in, Pitchforks are just one example among several.  *IF* MT5 has better built-in Pitchfork support, then maybe it won't make sense to convert this specific MT4 indicator into MT5, but EVEN SO, I still have the same question, which is to know whether and how can an MT5 indicator create and manipulate objects?    (If the answer is it can only be done by an "EA", then... can I run more than one EA on a chart (unlike MT4)?  )

If you know of an already existing MQL5 program that creates and manipulates objects, then please mention it as it could be another useful example.

And by the way, it's also very helpful to see as many examples as possible of side-by-side code (Original MT4 vs. converted-or-rewritten MT5).  Pointers to such examples are also very welcome. 

Thanks in advance for any advice, tips, replies, and an example of the converted file if someone is so inclined to help out.

Pips4life 

Documentation on MQL5: Standard Constants, Enumerations and Structures / Objects Constants / Object Types
  • www.mql5.com
Standard Constants, Enumerations and Structures / Objects Constants / Object Types - Documentation on MQL5
Files:
AML_v2.mq4  29 kb
 
Response from anyone appreciated.
 

It's so disappointing to get zero response to this.  18 months later, it's still a mystery to me, and I recently saw a post from another user *attempting* to use MT5 who wants the translation of this code.  Plus he asked if anyone on a popular pitchfork thread knew of any MT5 pitchfork-drawing indicators, and of course he got zero response.

 SCREW MT5.    If no one at MQ can explain or give hints as to how to translates and/or write the attached pitchfork code that does EXACTLY what this MT4 code can do, then MT5 is always going to be a joke, incapable of doing tasks essential for real traders.

 
pips4life:

It's so disappointing to get zero response to this.  18 months later, it's still a mystery to me, and I recently saw a post from another user *attempting* to use MT5 who wants the translation of this code.  Plus he asked if anyone on a popular pitchfork thread knew of any MT5 pitchfork-drawing indicators, and of course he got zero response.

 SCREW MT5.    If no one at MQ can explain or give hints as to how to translates and/or write the attached pitchfork code that does EXACTLY what this MT4 code can do, then MT5 is always going to be a joke, incapable of doing tasks essential for real traders.

I've only just seen your post . . .  so I'll reply now.

Indicators can draw Objects,  not all Object types are supported in the Strategy Tester, this is one deficit vs MT4 and causes a problem for products in the Market that need Objects,  when someone downloads a product to test they can only run it in the Strategy Tester,  if a product relies on Objects not supported by the Strategy Tester the product will not work as a demo and a potential customer may be lost. 

Ideally you shouldn't look to convert from mql4 to mql5 but ideally you should write directly in mql5, there are some functions that have no direct equivalent function in mql5,  for example iBarShift(),  you can get a better idea here:  Migrating from MQL4 to MQL5   IndicatorCounted() doesn't exist and bars seem to be counted in the opposite direction compared to mql4 . . . . something I've still not fully got to grips with.  Trading is very different, MT5 is position based,  if you place 2 trades in the same direction on the same symbol they will be combined into one position,  you can't have a long trade and short trade open at the same time on the same symbol,  instead you will have a position equal to the difference.

The best way to find the differences is to have a go at mql5,  if you have questions ask,  you will certainly get a reply quicker now than you did 18 months ago   

 
RaptorUK:

I've only just seen your post . . .  so I'll reply now.

Indicators can draw Objects,  not all Object types are supported in the Strategy Tester, this is one deficit vs MT4 and causes a problem for products in the Market that need Objects,  when someone downloads a product to test they can only run it in the Strategy Tester,  if a product relies on Objects not supported by the Strategy Tester the product will not work as a demo and a potential customer may be lost. 

Ideally you shouldn't look to convert from mql4 to mql5 but ideally you should write directly in mql5, there are some functions that have no direct equivalent function in mql5,  for example iBarShift(),  you can get a better idea here:  Migrating from MQL4 to MQL5   IndicatorCounted() doesn't exist and bars seem to be counted in the opposite direction compared to mql4 . . . . something I've still not fully got to grips with.  Trading is very different, MT5 is position based,  if you place 2 trades in the same direction on the same symbol they will be combined into one position,  you can't have a long trade and short trade open at the same time on the same symbol,  instead you will have a position equal to the difference.

The best way to find the differences is to have a go at mql5,  if you have questions ask,  you will certainly get a reply quicker now than you did 18 months ago   

IndicatorCounted() is replaced by prev_calculated which is a parameter of OnCalculate().

By default the buffers, timeseries and arrays are indexed from old candle (0) to current candle (rates_total-1), but this can be changed by using ArraySetAsSeries().

 
pips4life:

It's so disappointing to get zero response to this.  18 months later, it's still a mystery to me, and I recently saw a post from another user *attempting* to use MT5 who wants the translation of this code.  Plus he asked if anyone on a popular pitchfork thread knew of any MT5 pitchfork-drawing indicators, and of course he got zero response.

 SCREW MT5.    If no one at MQ can explain or give hints as to how to translates and/or write the attached pitchfork code that does EXACTLY what this MT4 code can do, then MT5 is always going to be a joke, incapable of doing tasks essential for real traders.

All necessary information are available on this site to learn to convert an indicator from mql4 to mql5. I doubt someone would like to do it for free, as it's a lot of work for your indicator. Maybe if you explain how it works and how to use it in trading, someone will be interested to invest his time on it.
 
angevoyageur:
All necessary information are available on this site to learn to convert an indicator from mql4 to mql5.
any direct link of that?
 
Suching:
any direct link of that?
https://www.mql5.com/en/search#!keyword=mql4
 
angevoyageur:
All necessary information are available on this site to learn to convert an indicator from mql4 to mql5. I doubt someone would like to do it for free, as it's a lot of work for your indicator. Maybe if you explain how it works and how to use it in trading, someone will be interested to invest his time on it.

Pitchforks are one of the most powerful tools traders can use to find pinpoint entries at exactly the key lines formed by the main Andrews pitchfork, OR... at other major lines *derived* from the Andrews fork.  While MT4 and MT5 can draw only the basic 3-line Andrews object (i.e. MedianLine=ML, UpperMedianLine=UML, LowerMedianLine=LML), it is also very important to have additional lines.  For example, "quartile" lines divide the 3 line PF into quarters.  A quartile line is drawn between the ML and UML, and another between the ML and LML.  Another example are WarningLines which use the same slope as the fork, and are spaced at multiples of the vertical pitch above and below the fork, where "pitch" is the distance between the ML and UML.  Beside these added lines, of even greater importance are the ability to add new 3-point pitchforks derived from the primary Andrews pitchfork.

ALL serious professional trading software tools that I've seen offer far more built in capability to draw Pitchforks than MT4/MT5.  (Ensign, Trade Navigator, NinjaTrader, ...).  Besides quartiles, most offer derived forks such as the "Modified Schiff" and the regular "Schiff".  There are far more derived forks, but those are the majors and they should be part of any serious trading package ...   but they're not built into MT4/MT5 at all!  

Therefore, one has to write the code necessary to draw the derived forks and also to add the additional same-sloped lines.  The "AML_v2.mq4" code attached does just that for MT4.  Given an Andrews pitchfork object that the user draws, the indicator can draw Mod.Schiff and add quartiles, WL's, etc.  Ultimately I have written other MT4 indicators which offer far MORE capability than other professional tools, and it's because of the ability to add such derived objects to the simple drawn Andrews pitchfork.

I would not like to imply that Pitchfork trading is easy, and that all such setups work like clockwork.  They don't, but... they do identify specific places where the reward:risk ratio is very good.

 Pitchfork traders hang out in several forums, but a few resources are here:

 http://www.forexfactory.com/showthread.php?t=76597 Andrews Pitchfork (Median Line)

http://www.medianline.com/

 Now that this thread has gotten some attention, I will say thanks.  But I will also say (again)... I don't care about MT5 because MT4 is still the main package the brokers support, and I'm not going to care about MT5 until it's clear MT4 is going away.  It shouldn't be the users who have to struggle through the gigantic task of rewriting all the indicators to work on MT5.  I would think that MQ has an interest to help users migrate.  The BIGGEST help would just be several side-by-side examples of MT4 vs. MT5 code.  In fact, I'd suggest 3 categories:  MT4 vs. translated-MT5 vs. rewritten-MT5.  Help the programmers to see that basically they can accomplish the same tasks with about the same flow (i.e. loosely "translated"); but with MT5, it's better (?) to rewrite the code with a fresh start, and explain the benefits why to do so.

Until that happens, or until MT4 just goes away and users are forced to migrate, I predict MT5 will remain unused by the vast majority of brokers and users.  Why the hell bother.

So, I'm not personally going to bother to translate the "AML_v2.mq4" code because I don't care.  But I would welcome someone else to do so, and then I promise you, I will study that code to see how MT5 can do it.  Then perhaps I'll have a reason to even start using MT5 more than I currently do, which is not at all.

I know MT4 programming very well.  I have shared a lot of well-written MT4 programs on ForexFactory.  I have many, many more I use personally.  It would be impossible for MQ to rewrite all the MT4 code out there; but if you (MQ) can't even get programmers like me interested to even start MT5, well... good luck with the vast majority of users who don't understand programming at all.  Give me some side-by-side examples, and maybe I'll start.

 

P.S. Why the heck am I not "subscribed" to my own thread???  I don't get emails when others make a post, and I don't see anywhere to access such a feature where I can add my request to be notified of thread updates.  That's just ridiculous.  I happen to be refreshing this page every few days to look for responses, but most of the time I don't.

 
pips4life:


P.S. Why the heck am I not "subscribed" to my own thread???  I don't get emails when others make a post, and I don't see anywhere to access such a feature where I can add my request to be notified of thread updates.  That's just ridiculous.  I happen to be refreshing this page every few days to look for responses, but most of the time I don't.

MetaQuotes do things a little differently as they use their own Forum software . . .  next to the thread title you will see a star,  click the star to add the thread to your favourites,  then in your profile you can set the Notifications options in your Favourites so that you are notified.  Favourites - Settings
 

To: Pips4life:

 I wholeheartedly agree with your statement "Pitchforks are one of the most powerful tools traders can use to find pinpoint entries at exactly the key lines formed by the main Andrews pitchfork, OR... at other major lines *derived* from the Andrews fork."  I have been studying Median Line technique for some time, mainly from Tim Morge.  I am inclined to use automation as a way to trade currencies.  Thoughts you can share as to the most effective way to learn MQL4 and to develop an EA based on it is highly appreciated.     

Reason: