Voir comment télécharger gratuitement des robots de trading
Retrouvez-nous sur Facebook !
Rejoignez notre page de fans
Rejoignez notre page de fans
Vous avez aimé le script ? Essayez-le dans le terminal MetaTrader 5
- Publié par:
- Tobias Johannes Zimmer
- Vues:
- 3449
- Note:
- Publié:
- 2022.04.24 15:43
- Mise à jour:
- 2023.08.10 13:33
-
Besoin d'un robot ou d'un indicateur basé sur ce code ? Commandez-le sur Freelance Aller sur Freelance
int OnCalculate(const int rates_total, const int prev_calculated, const datetime &time[], const double &open[], const double &high[], const double &low[], const double &close[], const long &tick_volume[], const long &volume[], const int &spread[]) { int to_copy = (rates_total - prev_calculated) * (prev_calculated < rates_total) + (1) * (prev_calculated == rates_total); CopyBuffer(RSIHandle, 0, 0, to_copy, ExtRSIBuffer); //--- ZigZagExtremaOnBuffer.mqh calculation function ZZOnBuffer(rates_total, prev_calculated, ExtRSIBuffer, ExtOutputBuffer, InpSearchMode, InpDepth, InpDeviation, InpBackstep); return(rates_total); }
To get only highs or only lows there is an additional input of type EnSearchmode:
//+------------------------------------------------------------------+ //| ZigZag calculation | //+------------------------------------------------------------------+ int ZZOnBuffer(const int rates, //On a non indicator array, Arraysize can be used as 'rates_total' const int calculated, const double &src[], //source buffer for calculation double &dst[], //destination buffer for calculation buffer EnSearchMode mode_search, //Set output buffer to High only, Low only or both in const int &depth, const int &deviation, const int &backstep //ZZ input parameters ) { ... ...
Only Highs:
Only Lows:
Both highs and lows in one buffer:
It is not restricted to indicator buffers, you can use it on any array, just set "rates" to the length of the array instead of rates_total.
The absolute minimum number of bars that this function can hadle is 100. So although you can use this calculation function on an array of a few hundred bars, in indicator buffers, rates_total is usually a few thousand.
![Trading Volume Line](https://c.mql5.com/i/code/indicator.png)
The indicator compares OHLC prices
![Detecting the start of a new bar or candle](https://c.mql5.com/i/code/expert.png)
Detecting the start of a new bar or candle, in the OnTick() event handler of an expert advisor.
![Custom Fractals](https://c.mql5.com/i/code/indicator.png)
Have you ever asked yourself why it is not possible to customize fractals more? ... now it is.
![SmoothStep](https://c.mql5.com/i/code/indicator.png)
SmoothStep