Discussion of article "Plotting trend lines based on fractals using MQL4 and MQL5"

 

New article Plotting trend lines based on fractals using MQL4 and MQL5 has been published:

The article describes the automation of trend lines plotting based on the Fractals indicator using MQL4 and MQL5. The article structure provides a comparative view of the solution for two languages. Trend lines are plotted using two last known fractals.

Recently, I have been thinking about using trend lines. There was a question about choosing a method of determining the points for plotting lines, and also about plotting accuracy. I decided to use fractals as a basis.

I often analyze markets at my main job where I can spend some time on trading. Also, you can't just draw the lines on a larger timeframe - the line should be plotted by extreme points with accuracy up to 15 minutes. The reason for this is that the fractal time on a larger timeframe doesn't always match the time of the same extreme point on M15. In short, this is where automation comes to help. It happened that I began writing the code using MQL5 and then moved to MQL4, because I needed this program for MetaTrader 4.

In this article I presented my solution of the problem using MQL4 and MQL5. The article provides the comparative view, but it would be inappropriate to compare the efficiency of MQL4 and MQL5 here. Also, I understand that there are probably other solutions, more effective than mine. The article can be useful to beginners who write scripts using either MQL4 or MQL5, especially to those who plan to use fractals and trend lines.

3. Determining price and time values of fractals

To draw the line we need to determine the time and price of a fractal. Of course, in MQL4 we could simply use the High[] and Low[] predefined timeseries, and the iTime() function, however we also need to get more precise time coordinates to ensure the correct plotting of the trend line.

Fig. 1-2 show the difference between the time values of extreme points on H4 and M15 timeframes.

Fig.1. The extreme point time value on H4

Fig.1. The extreme point time value on H4

Fig.2. The extreme point time value on M15

Fig.2. The extreme point time value on M15

Author: Almat Kaldybay

 
MetaQuotes Software Corp.:

New article Plotting trend lines based on fractals using MQL4 and MQL5 has been published:

Author: Almat Kaldybay

Hi,

 

I dont get the trendline as ilustrated above.
Any special setting? 

 
Hairi Baba:

Hi,

 

I dont get the trendline as ilustrated above.
Any special setting? 

Hi, maybe you do not have historical data M15
 

Hi Almat,

 I am not getting trendlines in chart, but I am getting continuous mobile alerts. Please help if I miss anything.

 thanks,
Prakash.R 

 
prakki79:

Hi Almat,

 I am not getting trendlines in chart, but I am getting continuous mobile alerts. Please help if I miss anything.

 thanks,
Prakash.R 

Hi, 

1. You need compile mq4 file in the metaeditor;

2.  I think that you have trendlines in chart, but you do not see them because of the scale of chart  

 

Hi - I cannot pretend to understand all of the coding, but I am working my way through it as it does exactly what I have been trying to code myself (badly as very much a novice).

I have recreated the EA and successfully complied in MQL4 and on first initialisation it will draw the support and resistance lines and will send the notifications but it doesn't redraw NEW support and resistance lines when NEW extreme point fractals appear- is it supposed too? Is there something I am missing something.

Also I couldn't get the fractals to show on the chart but testing the EA in strategy tester the fractals would correctly appear after stopping the test?? Any ideas what I a missing again?

Genius work by the way, fractals and trend lines against the extreme points is not easy to explain let alone code it :)


Best Regards

Andy

 
fxalert:

Hi - I cannot pretend to understand all of the coding, but I am working my way through it as it does exactly what I have been trying to code myself (badly as very much a novice).

I have recreated the EA and successfully complied in MQL4 and on first initialisation it will draw the support and resistance lines and will send the notifications but it doesn't redraw NEW support and resistance lines when NEW extreme point fractals appear- is it supposed too? Is there something I am missing something.

Also I couldn't get the fractals to show on the chart but testing the EA in strategy tester the fractals would correctly appear after stopping the test?? Any ideas what I a missing again?

Genius work by the way, fractals and trend lines against the extreme points is not easy to explain let alone code it :)


Best Regards

Andy

Hi, about first question: if it doesn't redraw new trendlines maybe you don't used code, which delete created objects. Look 4-th part of article. About second question: you can create new template with fractals for tester and called it "tester.tpl". Thereafter fractals will always show on the chart when you use tester

 
Almat Kaldybay:

Hi, about first question: if it doesn't redraw new trendlines maybe you don't used code, which delete created objects. Look 4-th part of article. About second question: you can create new template with fractals for tester and called it "tester.tpl". Thereafter fractals will always show on the chart when you use tester

Thanks for the reply, I left the EA attached to two charts overnight (1x 4hr chart and 1x 15m=M chart) and it has redrawn them so my bad for little patience.

 Thanks for the tip regarding tester.pl.


Many thanks

 
Hi,
Thank you for your article, I will explore the idea and try to adapt it for my EA's.
Thanks again and happy trading.