1 Attachment (s) สวัสดีเพื่อน ๆ ,
ฉันไม่ใช่ผู้เชี่ยวชาญ coder และสับสนเกี่ยวกับวิธีการเพิ่มสีเขียวสำหรับ histogram บวกและสีแดงสำหรับ histogram ค่าลบในตัวบ่งชี้นี้
รหัสตัวบ่งชี้:
แทรกรหัส/ --------------------------------------------- --------------------- /| CandleAverage_v1.mq4 |/| สงวนลิขสิทธิ์© 2006, Forex-TSD.com |/| เขียนโดย IgorAD, igorad2003 @ yahoo.co.uk |/| http://finance.groups.yahoo.com/group/TrendLaboratory |/ ----------------------------------------------- ------------------- # property copyright © 2006, Forex-TSD.com # คุณสมบัติลิงค์ http://www.forex-tsd.com/#property_separate_window #property indior_buffers 1 #property indior_color1 DeepSkyBlue/---- ใส่พารามิเตอร์ extern int ความยาว = 31; int ภายนอก H_period = 25; extern int L_period = 27; extern int C_period = 9;/---- บัฟเฟอร์คู่ CandleAvg # 91; # 93 ;; คู่ BarValue # 91; # 93 ;;/ ----------------------------------------------- ------------------- /| ฟังก์ชันการเริ่มต้นตัวบ่งชี้ที่กำหนดเอง |/ ----------------------------------------------- ------------------- int init () {//---- indior IndiorBuffers (2); SetIndexStyle (0, DRAW_HISTOGRAM); SetIndexBuffer (0, CandleAvg); SetIndexBuffer (1, BarValue);/---- ชื่อสำหรับ DataWindow และตัวบ่งชี้ subwindow ป้ายชื่อสตริง short_name = CandleAverage ( ความยาว ); IndiorShortName (SHORT_NAME); SetIndexLabel (0, CandleAvg); SetIndexDrawBegin (0, ความยาว);/---- return (0); }/ ---------------------------------------------- -------------------- /| ฟังก์ชันย้ำตัวบ่งชี้ที่กำหนดเอง |/ ----------------------------------------------- ------------------- int เริ่มต้น () {int shift, limit, counted_bars = IndiorCounted (); ดับเบิล UpDel, DnDel, H, L, C;/---- if (counted_barslt; 0) return (-1); ถ้า (counted_bars == 0) วงเงิน = บาร์ - ยาว -1;/---- ล่าสุดนับแถบจะ recounted if (counted_barsgt; 0) limits = Bars-counted_bars; limit--; สำหรับ (shift = limit; shiftgt; = 0; shift--) {H = iMA (NULL, 0, H_period, 0, MODE_EMA, PRICE_HIGH, shift); L = iMA (NULL, 0, L_period, 0, MODE_EMA, PRICE_LOW, shift); C = iMA (NULL, 0, C_period, 0, MODE_EMA, PRICE_CLOSE, shift); UpDel = H - C; DnDel = C - L; if (UpDel lt; DnDel) BarValue # 91; shift # 93; = 1; if (UpDel gt; DnDel) BarValue # 91; shift # 93; = -1; if (UpDel == DnDel) BarValue # 91; shift # 93; = 0; } for (shift = limit; shiftgt; = 0; shift--) {CandleAvg # 91; shift # 93; = iMAOnArray (BarValue, 0, ความยาว, 0, MODE_SMA, shift); }/---- return (0); }/ ---------------------------------------------- -------------------- ฉันพยายามเปลี่ยนรหัสเช่นร้อง:
แทรกรหัส # property indior_separate_window # property indior_buffers 2 #property_color1 DeepSkyBlue #property_color2 สีแดง แต่ไม่ได้ผลเนื่องจากค่า histogram เก็บไว้เฉพาะในบัฟเฟอร์ 1 อัน CandleAvg
วิธีการแยกค่าบวกและลบจากบัฟเฟอร์ CandleAvg และเพิ่มสีเขียวแดง?
กรุณาแนะนำ.
ขอขอบคุณสำหรับความช่วยเหลือ