Guarda come scaricare robot di trading gratuitamente
Ci trovi su Telegram!
Unisciti alla nostra fan page
Unisciti alla nostra fan page
Ti è piaciuto lo script? Provalo nel Terminale MetaTrader 5
- Visualizzazioni:
- 4195
- Valutazioni:
- Pubblicato:
- 2019.02.07 08:48
-
Hai bisogno di un robot o indicatore basato su questo codice? Ordinalo su Freelance Vai a Freelance
PriceChannel the highest and the lowest price over the period selected.
This cross-platform library allows computing the PriceChannel without attributing it to standard bars, i.e., by ticks.
Accordingly, PriceChannel can be computed on any timeframe, including the one-second one. It can also work as a channel on ticks.
Example.
// PriceChannel library operation sample input int inPeriod = 1; // Channel period sinput bool inPriceChannel = true; // Enable/disable calculating the PriceChannel via the library #define PRICECHANNEL_LOW_PRICE bid // bid/ask/last for the bar Low #include <fxsaber\PriceChannel\PriceChannel.mqh> // https://www.mql5.com/en/code/23418 // The highest price over the last iPeriod bars double GetHigh( const int iPeriod ) { static double Highs[]; CopyHigh(_Symbol, PERIOD_CURRENT, 0, iPeriod, Highs); return(Highs[ArrayMaximum(Highs)]); } // The lowest price over the last iPeriod bars double GetLow( const int iPeriod ) { static double Lows[]; CopyLow(_Symbol, PERIOD_CURRENT, 0, iPeriod, Lows); return(Lows[ArrayMinimum(Lows)]); } double Sum = 0; void OnTick() { static const int BarInterval = PeriodSeconds(PERIOD_CURRENT); static PRICECHANNEL PriceChannel(inPeriod); // Created a PriceChannel object with a predefined period static int CountBars = 0; static datetime PrevTime = 0; if (inPriceChannel) PriceChannel.NewTick(); // Considered the new tick if (TimeCurrent() / BarInterval != PrevTime / BarInterval) // New bar CountBars++; if (CountBars > MAX_BARS) // Start calculating when the relevant history has accumulated Sum += inPriceChannel ? PriceChannel.GetHigh() - PriceChannel.GetLow() // Calculate the PriceChannel via the library : GetHigh(inPeriod) - GetLow(inPeriod); // Calculate the PriceChannel by standard method PrevTime = TimeCurrent(); } double OnTester() { return(Sum); }
This EA will show in Tester the identical results: The standard one and that via the library.
Performance.
Standard calculations
optimization finished, total passes 200 optimization done in 6 minutes 55 seconds shortest pass 0:00:01.061, longest pass 0:00:03.432, average pass 0:00:02.066
Via the library
optimization finished, total passes 200 optimization done in 2 minutes 57 seconds shortest pass 0:00:00.764, longest pass 0:00:01.982, average pass 0:00:00.862
Features.
- Calculations on every tick.
- You can set any duration for the bar.
- No binding to standard bars.
- The largest default value (can be specified) is calculated by Bid, the smallest one by Ask.
- The performance does not practically depend on the period.
Tradotto dal russo da MetaQuotes Ltd.
Codice originale https://www.mql5.com/ru/code/23418
![Stochastic_RSI](https://c.mql5.com/i/code/indicator.png)
Indicator Stochastic RSI
![MTF_LRMA](https://c.mql5.com/i/code/indicator.png)
Indicator Multi Timeframe Linear Regression MA with signal line
![MTF_Stochastic_RSI](https://c.mql5.com/i/code/indicator.png)
Indicator Multi timeframes Stochastic RSI
![ZigZag_Oscillator](https://c.mql5.com/i/code/indicator.png)
Indicator ZigZag Oscillator