1 Attachment (s) Halo teman-teman,

Saya bukan ahli pembuat kode dan mengacaukan cara menambahkan warna hijau untuk mendapatkan histogram positif dan warna merah untuk histogram negatif dengan indikator ini.


Kode indikator:
Kode yang dimasukkan/ --------------------------------------------- --------------------- /| CandleAverage_v1. mq4 |/| Hak Cipta © 2006, Forex-TSD. Com |/| Disusun oleh IgorAD, igorad2003 @ yahoo.co.uk |/| http://finance.groups.yahoo.com/group/TrendLaboratory |/p ----------------------------------------------- ------------------- #property hak cipta Hak Cipta © 2006, Forex-TSD. Tautan #property com http://www.forex-tsd.com/#property indior_separate_window #property indior_buffers 1 #property indior_color1 DeepSkyBlue/- masukkan parameter ekstern int Panjang = 31; extern int H_period = 25; extern int L_period = 27; extern int C_period = 9;/- buffer dua CandleAvg # 91; # 93 ;; dual BarValue # 91; # 93 ;;/ ----------------------------------------------- ------------------- /| Fungsi inisialisasi indikator kustom |/ ----------------------------------------------- ------------------- int init ()/- indikator IndiorBuffers (2); SetIndexStyle (0, DRAW_HISTOGRAM); SetIndexBuffer (0, CandleAvg); SetIndexBuffer (1, BarValue);/- nama untuk DataWindow dan indikator subwindow label string short_name = CandleAverage ( Panjang ); IndiorShortName (short_name); SetIndexLabel (0, CandleAvg); SetIndexDrawBegin (0, Panjang);/- kembali (0);/ ----------------------------------------------- ------------------- /| Indikator kustomisasi iterasi melayani |/ ----------------------------------------------- ------------------- int begin () int change, limit, counted_bars = IndiorNilai (); dual UpDel, DnDel, H, L, C;/- if (counted_barslt; 0) return (-1); if (counted_bars == 0) limit = Bars-Length-1;/- bilah terhitung terakhir akan diceritakan jika (counted_barsgt; 0) limit = Bar-counted_bars; batasan - untuk (shift = batasan; shiftgt; = 0; ubah -) H = iMA (NULL, 0, H_period, 0, MODE_EMA, PRICE_HIGH, ubah); L = iMA (NULL, 0, L_period, 0, MODE_EMA, PRICE_LOW, ubah); C = iMA (NULL, 0, C_period, 0, MODE_EMA, PRICE_CLOSE, ubah); UpDel = H - C; DnDel = C - L; if (UpDel lt; DnDel) BarValue # 91; ubah # 93; = 1; if (UpDel gt; DnDel) BarValue # 91; ubah # 93; = -1; if (UpDel == DnDel) BarValue # 91; ubah # 93; = 0; untuk (shift = batasan; shiftgt; = 0; ubah -) CandleAvg # 91; ubah # 93; = iMAOnArray (BarValue, 0, Length, 0, MODE_SMA, ubah);/- kembali (0);/ ----------------------------------------------- ------------------- Saya mencoba mengubah kode seperti di bawah ini:

Kode Tersisipkan #property indior_separate_window #property indior_buffers 2 #property indior_color1 DeepSkyBlue #property indior_color2 Red Tetapi tidak berfungsi karena nilai histogram disimpan hanya dalam 1 buffer, CandleAvg.

Bagaimana cara memisahkan nilai negatif dan positif dari buffer CandleAvg dan menambahkan warna hijau merah?

Tolong saran.

Terima kasih untuk bantuannya.