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

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

author EAcpu | 5 reads | 0 comments |

Derivative - indicator for MetaTrader 4

Derivative - indicator for MetaTrader 4

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

Derivative - indicator for MetaTrader 4 , (1)

In the original definition, the difference between x and x0 is infinitesimal, that is, using the limit of the function. Using formula (1), the function value can be used to calculate an approximation of the derivative, 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 value must be treated as f(x) and f(x0) so that the derivative f'(x0) can be found. To do this, take the 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 only the value of the derivative, but also 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.

Derivative - indicator for MetaTrader 4

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.


Attachment download

📎 derivative.mq4 (13.66 KB)

Source: MQL5 #13785

Verification code Refresh