|
想要弄个副图的反K线指标,现在只一步了:0轴到min(Open,Close)的柱状线画成黑色, 从而去掉K线实体之外的颜色
对mql4的这句不知道怎么处理,懂的帮下忙,先谢谢!
目前是成这样子:
下面是代码:
- #property indicator_separate_window
- #property indicator_buffers 4
- #property indicator_color1 RoyalBlue
- #property indicator_color2 OrangeRed
- #property indicator_color3 RoyalBlue
- #property indicator_color4 OrangeRed
- //#property indicator_color3 Yellow
- //---- buffers
- double ExtMapBuffer1[];
- double ExtMapBuffer2[];
- double ExtMapBuffer3[];
- double ExtMapBuffer4[];
- int n;
- int ExtCountedBars=0;
- int init()
- {
- //---- indicators
- SetIndexStyle(0,DRAW_HISTOGRAM,STYLE_SOLID,3);
- SetIndexBuffer(0, ExtMapBuffer1);
- SetIndexStyle(1,DRAW_HISTOGRAM,STYLE_SOLID,3);
- SetIndexBuffer(1, ExtMapBuffer2);
- SetIndexStyle(2,DRAW_HISTOGRAM,STYLE_SOLID,1);
- SetIndexBuffer(2, ExtMapBuffer3);
- SetIndexStyle(3,DRAW_HISTOGRAM,STYLE_SOLID,1);
- SetIndexBuffer(3, ExtMapBuffer4);
- return(0);
- }
- int deinit()
- {
- //----
- return(0);
- }
- int start()
- {
- if(Bars<=10) return(0);
- int pos=0;
- n=WindowBarsPerChart();
- while(pos<n)
- {
- ExtMapBuffer1[pos]=-1*Open[pos];
- ExtMapBuffer2[pos]=-1*Close[pos];
-
- if (Open[pos]<=Close[pos])
- {
- ExtMapBuffer3[pos]=-1*Low[pos];
- ExtMapBuffer4[pos]=-1*High[pos];
- }
- else
- {
- ExtMapBuffer4[pos]=-1*Low[pos];
- ExtMapBuffer3[pos]=-1*High[pos];
- }
- pos++;
- }
- //----
- return(0);
- }
- //+------------------------------------------------------------------+
复制代码
副图反k.mq4
(2.59 KB, 下载次数: 0)
|
|