Watch how to download trading robots for free
Find us on Facebook!
Join our fan page
Interesting script?
So post a link to it -
let others appraise it
You liked the script? Try it in the MetaTrader 5 terminal
Libraries

Func Measure Trends - library for MetaTrader 5

Views:
6183
Rating:
(30)
Published:
2013.02.06 13:17
Updated:
2016.09.20 10:02
Need a robot or indicator based on this code? Order it on Freelance Go to Freelance

Target:

Due to the creation of an indicator, which needed to determine the direction of a trend formed earlier in order to further solve the algorithm, I came up with a certain formula to measure the trend strength (closeness of this trend to the ideal) as a percentage.

Below is represented the illustration that to my point of view symbolizes the ideal trend (on the left side is the down trend, on the right side is the up trend). Next to each trend are indicated existence conditions of an ideal trend:

The algorithm:

At first, to write this function I decided to enter the rating system, i.e. for every true condition some "ball" variable gets one rating. Further on these ratings were formed into this variable and after calculating the ratings at last the received number of ratings was divided by the maximum possible number and multiplied by 100% that allows conversing the received ratings into a percentage.

Actually the function itself is given in the Func_Trend.mqh.

Another type of analysis:

Then I came up with another idea, which supposed a non-uniform accrual of ratings. For example, for the most important conditions more ratings would be accrued. So the idea of counting the ratings by power of two was created and the more important the condition is, the higher the power of two will be.

Below is represented the illustration with a lot of number of conditions for each trend. More important conditions are located at the beginning of the list:

The conditions were added into the functions and the sense of calculating the ratings changed, but, in general, the trend percentage remained the same. It can be seen in the Func_Trend_2.mqh.

Translated from Russian by MetaQuotes Ltd.
Original code: https://www.mql5.com/ru/code/1506

AFL Winner AFL Winner

The oscillator for intraday trading.

PFE2 PFE2

The smooth oscillator performed in the form of the color histogram

NDuet NDuet

Two different period Moving Averages to define the direction of the trend and the semaphore signal indicator to specify the moment for settlement of a deal

TrendLine Touch Alert TrendLine Touch Alert

This indicator simply alerts and sends email every time the trend line touched by the price.