Aynı göstergede bir eğilim ve teyit gibi görünüyor. ilginç!
Merhaba Gösterge kodunuzu paylaştığınız için teşekkürler, Sqeeze Momentum Göster gesini Trading View'dan dönüştürmeye çalıştım, işte sahip olduğum kod ... biraz farklı .. Bu konuda sizden haber almak isterim! Teşekkürler.
//+------------------------------------------------------------------------+ //|SqueezeMomentumIndicator.mq5 | //|LazyBear tarafından Pine Script'ten dönüştürülmüştür | //|| //+------------------------------------------------------------------------+ #property copyright "Converted from Pine Script by LazyBear" #property link "" #property version "1.02" #property indicator_separate_window #property indicator_buffers 4 #property indicator_plots 2 #property indicator_type1 DRAW_COLOR_HISTOGRAM #property indicator_color1 clrLime, clrGreen, clrRed, clrMaroon #property indicator_style1 STYLE_SOLID #property indicator_width1 4 #property indicator_label1 "Squeeze Momentum" #property indicator_type2 DRAW_COLOR_LINE #property indicator_color2 clrBlue, clrBlack, clrGray #property indicator_style2 STYLE_SOLID #property indicator_width2 2 #property indicator_label2 "Squeeze" //--- giriş parametreleri input int LengthBB = 20; // BB Uzunluğu input double MultBB = 2.0; // BB MultFactor input int LengthKC = 20; // KC Uzunluğu input double MultKC = 1.5; // KC MultFactor input bool UseTrueRange = true; // TrueRange (KC) kullanın //--- gösterge tamponları double MomentumBuffer[]; // Momentum değerleri double MomentumColorBuffer[]; // Momentum renkleri double SqueezeBuffer[]; // Sıkıştırma değerleri double SqueezeColorBuffer[]; // Renkleri sıkın //+------------------------------------------------------------------+ //| Özel gösterge başlatma işlevi| //+------------------------------------------------------------------+ int OnInit() { //--- gösterge tamponları eşleme SetIndexBuffer(0, MomentumBuffer, INDICATOR_DATA); SetIndexBuffer(1, MomentumColorBuffer, INDICATOR_COLOR_INDEX); SetIndexBuffer(2, SqueezeBuffer, INDICATOR_DATA); SetIndexBuffer(3, SqueezeColorBuffer, INDICATOR_COLOR_INDEX); //--- renk indekslerini ayarla PlotIndexSetInteger(0, PLOT_COLOR_INDEXES, 4); // histogram için 4 renk PlotIndexSetInteger(1, PLOT_COLOR_INDEXES, 3); // Çizgi için 3 renk //--- gösterge adını ayarla IndicatorSetString(INDICATOR_SHORTNAME, "SQZMOM_LB [LazyBear]"); //--- hassasiyeti ayarla IndicatorSetInteger(INDICATOR_DIGITS, 5); //--- dizileri seri olarak ayarlayın ArraySetAsSeries(MomentumBuffer, true); ArraySetAsSeries(MomentumColorBuffer, true); ArraySetAsSeries(SqueezeBuffer, true); ArraySetAsSeries(SqueezeColorBuffer, true); return(INIT_SUCCEEDED); } //+------------------------------------------------------------------+ //| Basit Hareketli Ortalama| //+------------------------------------------------------------------+ double SimpleMA(const double &price[], int period, int shift) { double sum = 0.0; for(int i = 0; i < period; i++) { sum += price[shift + i]; } return sum / period; } //+------------------------------------------------------------------+ //| Standart Sapma| //+------------------------------------------------------------------+ double StdDev(const double &price[], int period, int shift) { double avg = SimpleMA(price, period, shift); double sum = 0.0; for(int i = 0; i < period; i++) { sum += MathPow(price[shift + i] - avg, 2); } return MathSqrt(sum / period); } //+------------------------------------------------------------------+ //| Doğrusal Regresyon| //+------------------------------------------------------------------+ double LinReg(const double &price[], int period, int shift) { double sum_x = 0.0; double sum_y = 0.0; double sum_xy = 0.0; double sum_x2 = 0.0; for(int i = 0; i < period; i++) { sum_x += i; sum_y += price[shift + i]; sum_xy += i * price[shift + i]; sum_x2 += i * i; } double m = period; double slope = (m * sum_xy - sum_x * sum_y) / (m * sum_x2 - sum_x * sum_x); double intercept = (sum_y - slope * sum_x) / m; return intercept; } //+------------------------------------------------------------------+ //| Özel gösterge yineleme işlevi| //+------------------------------------------------------------------+ 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[]) { // Minimum veri olup olmadığını kontrol edin int min_bars = MathMax(LengthBB, LengthKC) + 1; if(rates_total < min_bars) return(0); // Doğru indeksleme için dizileri seri olarak ayarlayın ArraySetAsSeries(high, true); ArraySetAsSeries(low, true); ArraySetAsSeries(close, true); // Başlangıç noktasını hesapla int limit; if(prev_calculated == 0) limit = rates_total - min_bars; else limit = rates_total - prev_calculated; limit = MathMin(limit, rates_total - min_bars); // Kaynak hesaplaması için dizileri hazırlayın double source[]; ArrayResize(source, rates_total); ArraySetAsSeries(source, true); // Ana hesaplama döngüsü for(int i = limit; i >= 0; i--) { // Bollinger Bantlarını Hesapla double basis = 0.0; for(int j = 0; j < LengthBB; j++) basis += close[i+j]; basis /= LengthBB; double dev = 0.0; for(int j = 0; j < LengthBB; j++) dev += MathPow(close[i+j] - basis, 2); dev = MultBB * MathSqrt(dev / LengthBB); double upperBB = basis + dev; double lowerBB = basis - dev; // Keltner Kanallarını Hesapla double ma = 0.0; for(int j = 0; j < LengthKC; j++) ma += close[i+j]; ma /= LengthKC; double range_sum = 0.0; for(int j = 0; j < LengthKC; j++) { double tr; if(UseTrueRange && i+j+1 < rates_total) tr = MathMax(high[i+j] - low[i+j], MathMax(MathAbs(high[i+j] - close[i+j+1]), MathAbs(low[i+j] - close[i+j+1]))); else tr = high[i+j] - low[i+j]; range_sum += tr; } double range_ma = range_sum / LengthKC; double upperKC = ma + MultKC * range_ma; double lowerKC = ma - MultKC * range_ma; // Sıkıştırma koşullarını hesaplayın bool sqzOn = (lowerBB > lowerKC) && (upperBB < upperKC); bool sqzOff = (lowerBB < lowerKC) && (upperBB > upperKC); bool noSqz = !sqzOn && !sqzOff; // KC dönemi için en yüksek ve en düşük değerleri bulun double highest = high[i]; double lowest = low[i]; for(int j = 1; j < LengthKC; j++) { if(i+j >= rates_total) break; if(high[i+j] > highest) highest = high[i+j]; if(low[i+j] < lowest) lowest = low[i+j]; } // linreg için kaynağı hesapla double avg_hl = (highest + lowest) / 2; double avg_val = (avg_hl + ma) / 2; for(int j = 0; j < LengthKC; j++) { if(i+j >= rates_total) break; source[i+j] = close[i+j] - avg_val; } // Doğrusal regresyon ile momentumu hesaplayın MomentumBuffer[i] = LinReg(source, LengthKC, i); // Sıkma hattı değerini ayarla (her zaman 0) SqueezeBuffer[i] = 0; // Renkleri tam olarak Pine Script'teki gibi koşullara göre ayarlayın // bcolor = iff(val > 0, iff(val > nz(val[1]), lime, green), iff(val < nz(val[1]), red, maroon)) if(i < rates_total - 1) { if(MomentumBuffer[i] > 0) { if(MomentumBuffer[i] > MomentumBuffer[i+1]) MomentumColorBuffer[i] = 0; // misket limonu else MomentumColorBuffer[i] = 1; // yeşil } else { if(MomentumBuffer[i] < MomentumBuffer[i+1]) MomentumColorBuffer[i] = 2; // kırmızı else MomentumColorBuffer[i] = 3; // bordo } } else { // İlk çubuk için MomentumColorBuffer[i] = (MomentumBuffer[i] > 0) ? 0 : 2; // misket limonu veya kırmızı } // scolor = noSqz ? blue : sqzOn ? black : gray if(noSqz) SqueezeColorBuffer[i] = 0; // mavi else if(sqzOn) SqueezeColorBuffer[i] = 1; // siyah else SqueezeColorBuffer[i] = 2; // gri } return(rates_total); } //+------------------------------------------------------------------+
Dosyalar:
Squeze_Momentum.mq5
9 kb
Alım-satım fırsatlarını kaçırıyorsunuz:
- Ücretsiz alım-satım uygulamaları
- İşlem kopyalama için 8.000'den fazla sinyal
- Finansal piyasaları keşfetmek için ekonomik haberler
Kayıt
Giriş yap
Gizlilik ve Veri Koruma Politikasını ve MQL5.com Kullanım Şartlarını kabul edersiniz
Hesabınız yoksa, lütfen kaydolun
Bollinger Squeeze Basic MT5:
Bollinger Squeeze Basic MetaTrader göstergesi - Momentum, Bollinger bantları ve Keltner kanalına dayanan karmaşık bir göstergedir. Gösterge, grafiğin ayrı penceresinde bir Momentum histogramı ve mevcut Bollinger bantları ile Keltner kanal değerleri arasındaki ilişkiyi gösterirken bir dizi nokta olarak çizilir. Bu gösterge, işlem platformunun hem MT4 hem de MT5 sürümleri için kullanılabilir.
Author: Tuan Nguyen Van