Alım-satım robotlarını ücretsiz olarak nasıl indirebileceğinizi izleyin
Bizi Facebook ü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
Görüntülemeler:
74
Derecelendirme:
(6)
Yayınlandı:
MQL5 Freelance Bu koda dayalı bir robota veya göstergeye mi ihtiyacınız var? Freelance üzerinden sipariş edin Freelance'e git

Bu göstergeyi, MetaTrader 5 Bollinger Bantları göstergesindeki yalnızca 'basit' yöntemi sunan standart hareketli ortalama yöntemlerine bir alternatif sağlamak için geliştirdim. Göstergemle, kullanıcılar Üstel, Düzleştirilmiş ve Doğrusal Ağırlıklı dahil olmak üzere ek yöntemler arasından seçim yapma seçeneğine sahiptir.

Bu göstergeyi kullanmak için, aşağıdaki yola benzeyen bir dizine (Windows'ta) yerleştirmeniz gerekir:

C:\Users\lucas\AppData\Roaming\MetaQuotes\Terminal\Indicators\Examples

Eklenen özellikler:

bir


Varsayılan olarak sıfır olarak ayarlanmıştır:

iki


LinearWeighted ortalamasını tercih eden yürütme örneği:


ağaç dört


KOD:

//+------------------------------------------------------------------+
//|BBPersonalizada.mq5 |
//|Lucas Vidal |
//|https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright   "Lucas Vidal"
#property link        "https://www.mql5.com/tr/users/lucasmoura00"
#property description "Bollinger Bands Personalizada"
#include <MovingAverages.mqh>
//---
#property indicator_chart_window
#property indicator_buffers 4
#property indicator_plots   3
#property indicator_type1   DRAW_LINE
#property indicator_color1  LightSeaGreen
#property indicator_type2   DRAW_LINE
#property indicator_color2  LightSeaGreen
#property indicator_type3   DRAW_LINE
#property indicator_color3  LightSeaGreen
#property indicator_label1  "Bands middle"
#property indicator_label2  "Bands upper"
#property indicator_label3  "Bands lower"
//--- giriş parametreleri
enum MovingAverageMethod {
    Simple,    // 0
    Exponential,  // 1
    Smoothed,     // 2
    LinearWeighted  // 3
};
input MovingAverageMethod InpMaMethod = Simple; // Método da Média Móvel
input int     InpBandsPeriod=20;       // Dönem
input int     InpBandsShift=0;         // Vardiya
input double  InpBandsDeviations=2.0;  // Sapma
//--- küresel değişkenler
int           ExtBandsPeriod,ExtBandsShift;
double        ExtBandsDeviations;
int           ExtPlotBegin=0;
//--- gösterge tamponu
double        ExtMLBuffer[];
double        ExtTLBuffer[];
double        ExtBLBuffer[];
double        ExtStdDevBuffer[];
//+------------------------------------------------------------------+
//| Özel gösterge başlatma işlevi |
//+------------------------------------------------------------------+
void OnInit()
  {
//--- giriş değerlerini kontrol edin
   if(InpBandsPeriod<2)
     {
      ExtBandsPeriod=20;
      PrintFormat("Incorrect value for input variable InpBandsPeriod=%d. Indicator will use value=%d for calculations.",InpBandsPeriod,ExtBandsPeriod);
     }
   else
      ExtBandsPeriod=InpBandsPeriod;
   if(InpBandsShift<0)
     {
      ExtBandsShift=0;
      PrintFormat("Incorrect value for input variable InpBandsShift=%d. Indicator will use value=%d for calculations.",InpBandsShift,ExtBandsShift);
     }
   else
      ExtBandsShift=InpBandsShift;
   if(InpBandsDeviations==0.0)
     {
      ExtBandsDeviations=2.0;
      PrintFormat("Incorrect value for input variable InpBandsDeviations=%f. Indicator will use value=%f for calculations.",InpBandsDeviations,ExtBandsDeviations);
     }
   else
      ExtBandsDeviations=InpBandsDeviations;
//--- tamponları tanımla
   SetIndexBuffer(0,ExtMLBuffer);
   SetIndexBuffer(1,ExtTLBuffer);
   SetIndexBuffer(2,ExtBLBuffer);
   SetIndexBuffer(3,ExtStdDevBuffer,INDICATOR_CALCULATIONS);
//--- dizin etiketlerini ayarla
   PlotIndexSetString(0,PLOT_LABEL,"Bands("+string(ExtBandsPeriod)+") Middle");
   PlotIndexSetString(1,PLOT_LABEL,"Bands("+string(ExtBandsPeriod)+") Upper");
   PlotIndexSetString(2,PLOT_LABEL,"Bands("+string(ExtBandsPeriod)+") Lower");
//--- gösterge adı
   IndicatorSetString(INDICATOR_SHORTNAME,"Bollinger Bands");
//--- indeksler başlangıç ayarlarını çizer
   ExtPlotBegin=ExtBandsPeriod-1;
   PlotIndexSetInteger(0,PLOT_DRAW_BEGIN,ExtBandsPeriod);
   PlotIndexSetInteger(1,PLOT_DRAW_BEGIN,ExtBandsPeriod);
   PlotIndexSetInteger(2,PLOT_DRAW_BEGIN,ExtBandsPeriod);
//--- indeksler vardiya ayarları
   PlotIndexSetInteger(0,PLOT_SHIFT,ExtBandsShift);
   PlotIndexSetInteger(1,PLOT_SHIFT,ExtBandsShift);
   PlotIndexSetInteger(2,PLOT_SHIFT,ExtBandsShift);
//--- gösterge değerinin basamak sayısı
   IndicatorSetInteger(INDICATOR_DIGITS,_Digits+1);
  }
//+------------------------------------------------------------------+
//| Hareketli Ortalamayı Hesapla|
//+------------------------------------------------------------------+
double CalculateMovingAverage(int position, int period, const double &price[]) {
    switch(InpMaMethod) {
        case Simple:
            return SimpleMA(position, period, price);
        case Exponential:
            // Corrigindo a chamada da função iMA com os parâmetros corretos
            return iMA(NULL, 0, period, 0, MODE_EMA, PRICE_CLOSE);
        case Smoothed:
            // SMMA işlevinizi buradan uygulayın
            break;
        case LinearWeighted:
            return LinearWeightedMA(position, period, price);
    }
    return 0; // Retorno padrão em caseo de método indefinido
}

//+------------------------------------------------------------------+
//| Bollinger Bantları|
//+------------------------------------------------------------------+
int OnCalculate(const int rates_total,
                const int prev_calculated,
                const int begin,
                const double &price[])
  {
   if(rates_total<ExtPlotBegin)
      return(0);
//--- indeksler, önceki başlangıçları aldığımızda başlangıç ayarlarını çizer
   if(ExtPlotBegin!=ExtBandsPeriod+begin)
     {
      ExtPlotBegin=ExtBandsPeriod+begin;
      PlotIndexSetInteger(0,PLOT_DRAW_BEGIN,ExtPlotBegin);
      PlotIndexSetInteger(1,PLOT_DRAW_BEGIN,ExtPlotBegin);
      PlotIndexSetInteger(2,PLOT_DRAW_BEGIN,ExtPlotBegin);
     }
//--- başlangıç hesaplaması
   int pos;
   if(prev_calculated>1)
      pos=prev_calculated-1;
   else
      pos=0;
//--- ana döngü
   for(int i=pos; i<rates_total && !IsStopped(); i++)
     {
      //--- orta çizgi
      ExtMLBuffer[i]=CalculateMovingAverage(i, ExtBandsPeriod, price);
      //--- StdDev'i hesaplayın ve yazın
      ExtStdDevBuffer[i]=StdDev_Func(i,price,ExtMLBuffer,ExtBandsPeriod);
      //--- üst satır
      ExtTLBuffer[i]=ExtMLBuffer[i]+ExtBandsDeviations*ExtStdDevBuffer[i];
      //--- alt satır
      ExtBLBuffer[i]=ExtMLBuffer[i]-ExtBandsDeviations*ExtStdDevBuffer[i];
     }
//--- OnCalculate tamamlandı. Yeni prev_calculated döndür.
   return(rates_total);
  }
//+------------------------------------------------------------------+
//| Standart Sapmayı Hesapla|
//+------------------------------------------------------------------+
double StdDev_Func(const int position,const double &price[],const double &ma_price[],const int period)
  {
   double std_dev=0.0;
//--- StdDev'i hesaplayın
   if(position>=period)
     {
      for(int i=0; i<period; i++)
         std_dev+=MathPow(price[position-i]-ma_price[position],2.0);
      std_dev=MathSqrt(std_dev/period);
     }
//--- hesaplanan değeri döndür
   return(std_dev);
  }
//+------------------------------------------------------------------+




MetaQuotes Ltd tarafından İngilizceden çevrilmiştir.
Orijinal kod: https://www.mql5.com/en/code/49464

Geometric Moving Average Geometric Moving Average

Geometrik hareketli ortalamanın MQL5 versiyonu.

X2MA_KLx3_Cloud X2MA_KLx3_Cloud

Keltner'ın kanalı, renkli bir arka plan olarak işlenmiştir.

FisherTransform_HTF_Signal FisherTransform_HTF_Signal

FisherTransform_HTF_Signal göstergesi, trend yönünü renkli trend göstergesi ile grafiksel bir nesne olarak görüntüler ve trend değiştiğinde uyarılar veya ses sinyalleri verir.

^X_NonLinearRegression ^X_NonLinearRegression

Fiyat grafiğinin gelecekteki değerlerinin enterpolasyonu ile doğrusal olmayan regresyon kanalı.