Voir comment télécharger gratuitement des robots de trading
Retrouvez-nous sur Facebook !
Rejoignez notre page de fans
Un script intéressant ?
Poster un lien vers celui-ci -
laisser les autres l'évaluer
Vous avez aimé le script ? Essayez-le dans le terminal MetaTrader 5
Bibliothèque

Price_Compare - bibliothèque pour MetaTrader 5

Vues:
3004
Note:
(27)
Publié:
2016.09.19 12:49
\MQL5\Scripts\ \MQL5\Include\
Besoin d'un robot ou d'un indicateur basé sur ce code ? Commandez-le sur Freelance Aller sur Freelance

This small cross-platform library allows to compare the 'double' values of the "price" conveniently and quickly.

For example, before placing a SellLimit, it is sometimes useful to check if the opening price is below the current Bid price.

// if (NormalizeDouble(OpenPrice, Digits()) >= NormalizeDouble(Bid, Digits())) // this method was the most frequently used
if (CP(OpenPrice) >= Bid) // now it can be done like this
  OrderSend...;

Not only is this much clearer and more concise than the standard type check, but also the execution speed is several times higher! Such efficient usage of computational resources sometimes grants a noticeable boost in the tester/optimizer.

It is also possible to set the precision for comparing the 'double' values. For example

if ((CP(Lots, 0.01) >= MinLot) && ((CP(Lots, 0.01) <= MaxLot))) // compare with the precision up to the second decimal place
  OrderSend...;

All the comparison operators (==, !=, >=, <=, >, <) are handled in a similar fashion.

The library contains a faster method of the NormalizeDouble implementation. To improve the execution speed of the standard function, it is sufficient to add the following at the beginning

// Almost four times faster than the corresponding standard function (build 1395)
#define NormalizeDouble PRICE_COMPARE::MyNormalizeDouble

As an example, the attached script shows the results of comparison and normalization method for different price values.

Traduit du russe par MetaQuotes Ltd.
Code original : https://www.mql5.com/ru/code/16169

XFatlXSatlCloud XFatlXSatlCloud

Indicator based on smoothed FATL and SATL digital filters and signal trend cloud between them.

XFatlXSatlMACD XFatlXSatlMACD

The MACD histogram, based on the FATL and SATL digital filters with color indication of trends.

Elliott_Wave_Oscillator_Sign_Alert Elliott_Wave_Oscillator_Sign_Alert

Semaphore signal indicator based on the algorithm of the Elliott_Wave_Oscillator indicator, which features alerts, sending emails and push-notifications to mobile devices.

i4_DRF_v3 i4_DRF_v3

A simple trend indicator with calculation of rise and fall in High and Low prices.