Sebuah modifikasi dari indikator hari dalam seminggu - kini setiap hari dalam seminggu ditandai dengan warna yang berbeda:



Gaya DRAW_COLOR_HISTOGRAM memerlukan dua buffer (buffer nilai HistogramBuffer dan buffer warna HistogramColors):
//+------------------------------------------------------------------+ //| Indikator Warna Hari.mq5 | //| Copyright © 2018, Vladimir Karputov | //| http://wmua.ru/slesar/ | //+------------------------------------------------------------------+ #property copyright "Copyright © 2018, Vladimir Karputov" #property link "http://wmua.ru/slesar/" #property version "1.000" #property indicator_separate_window #property description "Hari dalam bentuk histogram warna" #property indicator_separate_window #property indicator_buffers 2 #property indicator_plots 1 //--- plot Histogram #property indicator_label1 "Warna Hari" #property indicator_type1 DRAW_COLOR_HISTOGRAM //--- definisikan 8 warna untuk section #property indicator_color1 clrCyan,clrRed,clrYellowGreen,clrBlue,clrYellow,clrNavy,clrGold,clrMediumSeaGreen #property indicator_style1 STYLE_SOLID #property indicator_width1 2 //--- buffer indikator double HistogramBuffer[]; double HistogramColors[]; //+------------------------------------------------------------------+ //| Fungsi inisialisasi indikator kustom | //+------------------------------------------------------------------+
Warna diatur pada baris
//--- definisikan 8 warna untuk section #property indicator_color1 clrCyan,clrRed,clrYellowGreen,clrBlue,clrYellow,clrNavy,clrGold,clrMediumSeaGreen
Di sini, warna clrCyan memiliki indeks "0", clrRed memiliki indeks "1", dan seterusnya.
Manajemen warna histogram dilakukan dengan menetapkan indeks warna untuk setiap indeks dari buffer HistogramColors:
switch(STime.day_of_week) { case 0: HistogramBuffer[i]=0; HistogramColors[i]=0; break; case 1: HistogramBuffer[i]=1; HistogramColors[i]=1; break; case 2: HistogramBuffer[i]=2; HistogramColors[i]=2; break; case 3: HistogramBuffer[i]=3; HistogramColors[i]=3; break; case 4: HistogramBuffer[i]=4; HistogramColors[i]=4; break; case 5: HistogramBuffer[i]=5; HistogramColors[i]=5; break; case 6: HistogramBuffer[i]=6; HistogramColors[i]=6; break; }
Postingan terkait
- Indikator Open Range Breakout untuk MetaTrader 5: Strategi Trading yang Efektif
- Volume Profile + Range v6.0: Indikator Penting untuk MetaTrader 5
- WeightOscillator_Alert: Indikator Trend dengan Notifikasi untuk MetaTrader 5
- ColorXdinMA_Alert: Indikator Trend dengan Notifikasi untuk MetaTrader 5
- Panduan Lengkap Volume Profile + Range v6.0 untuk MetaTrader 5