25周期内的每根K线的"CLOSE-OPEN"的值加起来,在指标窗口画一条线 出来,该怎么编写,非常感谢您看我的留言,要是能帮我一把,我会把赚的钱全部拿出请您吃巴西烤肉
哈哈,好啊!我试试!
#property indicator_separate_window #property indicator_buffers 1 #property indicator_color1 Yellow //---- input parameters int periods=25; double line[]; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { //---- indicators SetIndexBuffer(0,line); //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int start() { int i,j; double a; for (i=Bars-1;i>=0;i--) { a=0; for (j=i;j<i+periods;j++) a+=Close[j]-Open[j]; line[i]=a; } //---- return(0); }
mkdaoyi:
哈哈,好啊!我试试!
#property indicator_separate_window #property indicator_buffers 1 #property indicator_color1 Yellow //---- input parameters int periods=25; double line[]; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { //---- indicators SetIndexBuffer(0,line); //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int start() { int i,j; double a; for (i=Bars-1;i>=0;i--) { a=0; for (j=i;j<i+periods;j++) a+=Close[j]-Open[j]; line[i]=a; } //---- return(0); }
mkdaoyi:
哈哈,好啊!我试试!
#property indicator_separate_window #property indicator_buffers 1 #property indicator_color1 Yellow //---- input parameters int periods=25; double line[]; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { //---- indicators SetIndexBuffer(0,line); //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int start() { int i,j; double a; for (i=Bars-1;i>=0;i--) { a=0; for (j=i;j<i+periods;j++) a+=Close[j]-Open[j]; line[i]=a; } //---- return(0); }
非常感谢,我先试试,然后再次感谢