Alım-satım robotlarını ücretsiz olarak nasıl indirebileceğinizi izleyin
Bizi Telegram üzerinde bulun!
Fan sayfamıza katılın
Komut dosyasını ilginç mi buldunuz?
Öyleyse bir link gönderin -
başkalarının da faydalanmasını sağlayın
Komut dosyasını beğendiniz mi? MetaTrader 5 terminalinde deneyin
Kütüphaneler

PriceChannel - MetaTrader 5 için kütüphane

Görüntülemeler:
4743
Derecelendirme:
(19)
Yayınlandı:
\MQL5\Include\fxsaber\PriceChannel\ \MQL5\Experts\fxsaber\
MQL5 Freelance Bu koda dayalı bir robota veya göstergeye mi ihtiyacınız var? Freelance üzerinden sipariş edin Freelance'e git

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.

MetaQuotes Ltd tarafından Rusçadan çevrilmiştir.
Orijinal kod: https://www.mql5.com/ru/code/23418

Stochastic_RSI Stochastic_RSI

Indicator Stochastic RSI

MTF_LRMA MTF_LRMA

Indicator Multi Timeframe Linear Regression MA with signal line

MTF_Stochastic_RSI MTF_Stochastic_RSI

Indicator Multi timeframes Stochastic RSI

ZigZag_Oscillator ZigZag_Oscillator

Indicator ZigZag Oscillator