Welcome Forex EA downloads & MT4/MT5 auto-trading resources — EAs, Gold EAs, quant tools and real-world automation.
Sign In Sign Up

Derivatives - MetaTrader 5 Script | Trading Script Download - MT4/MT5 Resources - MetaTrader 5 Resources

author EAcpu | 5 reads | 0 comments |

Derivative - indicator for MetaTrader 5

Derivative - indicator for MetaTrader 5

In mathematics, the value of a derivative is calculated according to the following simple formula:

Derivative - indicator for MetaTrader 5 , (1)

In the original definition, the difference between x and x0 is infinitesimal, that is, using the limit of the function. Using equation (1), it is possible to calculate an approximation of the derivative using the function value, avoiding direct differentiation.

Regarding the price chart, x0 is the current bar and x is the upcoming bar which will be formed after many chart periods. Respectively, f(x0) is the price value of the current bar, and f(x) is the price value of the upcoming bar. We find that (1) contains two unknowns - f(x0) and f(x) . Since we do not have an additional expression involving the same two unknowns, a solution to equation (1) does not exist in this case.

The known values ​​must be considered as f(x) and f(x0) so that the derivative f'(x0) can be found. To do this, you need to take a point to the left of the current bar as x0 and specify the current bar as x . therefore, f(x0) and f(x) become certain values ​​(the price of the point x and x0 corresponds to the price value visible on the chart).

Nonetheless, the calculated value will characterize the area known to traders in which an increase or decrease in price can be judged without the help of derivatives. In this case, the useful information is not just the value of the derivative, but the comparison of two values ​​of the derivative on adjacent bars. If the signs of the calculated values ​​are different, the price has passed an extreme value. The type of extreme value can be easily determined using a combination of signs: the transition from negative to positive values ​​is the minimum value, and the transition from positive to negative values ​​is the maximum value.

The described derivative calculation principle is implemented in the derivative indicator. As a result, it shows the price difference between the checked bar and several bars set in the "Delay" parameter spaced from the checked bar.

The simplest way to use this indicator is: the line crosses the zero level from below - you should buy, and from above - you should sell.

The indicator was originally written in MQL4 and first published in the code base on mql5.com on September 9, 2015.

Derivative - indicator for MetaTrader 5

Figure 1. Derived indicators


Attachment download

📎 derivative.mq5 (7.49 KB)

Source: MQL5 #13902

Verification code Refresh