Ayrıca bir seri versiyonu da kodladım
kod stili MetaEditor'da "Mozilla" seçimidir
#property indicator_separate_window #property indicator_buffers 5 #property indicator_plots 1 #property indicator_color1 clrGreen, clrRed #property indicator_type1 DRAW_COLOR_HISTOGRAM double plot[]; double col[]; double incomingVolume[]; double ma[]; double closes[]; input bool grannularTrend = false; // Granüler trend int period = 20; //+------------------------------------------------------------------+ //| Özel gösterge başlatma işlevi | //+------------------------------------------------------------------+ int OnInit() { //--- gösterge tamponları eşleme SetIndexBuffer(0, plot, INDICATOR_DATA); SetIndexBuffer(1, col, INDICATOR_COLOR_INDEX); SetIndexBuffer(2, ma, INDICATOR_CALCULATIONS); SetIndexBuffer(3, incomingVolume, INDICATOR_CALCULATIONS); SetIndexBuffer(4, closes, INDICATOR_CALCULATIONS); ArraySetAsSeries(plot, true); ArraySetAsSeries(col, true); ArraySetAsSeries(ma, true); ArraySetAsSeries(incomingVolume, true); ArraySetAsSeries(closes, true); return(INIT_SUCCEEDED); } //+------------------------------------------------------------------+ //| Ö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[]) { ArraySetAsSeries(close, false); ArrayCopy(incomingVolume, tick_volume, 0, rates_total-1); ArrayCopy(closes, close, 0, rates_total-1); int buffSize = ArraySize(incomingVolume); ArraySetAsSeries(close, true); if(prev_calculated == 0) { initialzeBuffers(); } long volumeThreshold = 0; long sum = 0; for (int j = 0; j < period; j++) sum += tick_volume[j]; volumeThreshold = sum / 20; int empty_data = rates_total - buffSize; for(int i = buffSize-1; i>=empty_data; i--) { plot[i] = incomingVolume[i]; trend(period, i, ma, closes); if (i < buffSize - 1) { if (!grannularTrend) { col[i] = ma[0] > ma[1] ? 0 : 1; } else { col[i] = (ma[i] > ma[i+1]) ? 0 : 1; } } } for(int i = buffSize-2; i>=0; i--) { closes[i+1] = closes[i]; incomingVolume[i+1] = incomingVolume[i]; } return buffSize; } void initialzeBuffers(){ ArrayInitialize(plot, EMPTY_VALUE); ArrayInitialize(col, EMPTY_VALUE); ArrayInitialize(ma, EMPTY_VALUE); ArrayInitialize(incomingVolume, EMPTY_VALUE); ArrayInitialize(closes, EMPTY_VALUE); } void trend(int per, int idx, double &arr[], const double &close[]) { double sum = 0.0; for(int k = 1; k < per && (idx + k) < ArraySize(close); k++) { sum += close[idx + k]; } arr[idx] = sum / per; }

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
Intrabar Volume Flow:
Her çubukta hacmin zaman içinde nasıl değiştiğini görselleştiren bir gösterge. Kene hacmini yuvarlanan bir histogram biçiminde gösterir.
Author: Conor Mcnamara