//+------------------------------------------------------------------+ //| !Experement.mq4 | //| Copyright © 2011, Korwin | //| korwin-kor@yandex.ru | //+------------------------------------------------------------------+ #property copyright "Copyright © 2011, Korwin" #property link "korwin-kor@yandex.ru" #property indicator_chart_window #property indicator_buffers 2 #property indicator_color1 Red #property indicator_color2 Green extern int divisor=6; double buf0[],buf1[],x,y,last,new1; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { SetIndexBuffer(0,buf0); SetIndexStyle(0,DRAW_LINE,STYLE_SOLID,2); SetIndexBuffer(1,buf1); SetIndexStyle(1,DRAW_LINE,STYLE_SOLID,2); return(0); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int start() { int i; int counted_bars=IndicatorCounted(); if(counted_bars<0) return(-1); if(counted_bars>0) counted_bars--; int limit=Bars-counted_bars; if(counted_bars==0) limit-=1+1; for(i=limit; i>=0; i--) { if(buf0[i+1]==EMPTY_VALUE && buf1[i+1]==EMPTY_VALUE) { if(Close[i+1]>Open[i+1]) buf1[i+1]=Low[i+1]; if(Close[i+1]Close[i+1]) buf0[i]=buf0[i+1]-(High[i+1]-Low[i+1])/divisor; else { buf0[i]=EMPTY_VALUE; x=i; int u=iLowest(NULL,0,MODE_LOW,(y-i),i); // buf1[i+1]=Low[u]; for(;u>=i;u--) { if(last!=EMPTY_VALUE) {new1=last+(High[u+1]-Low[u+1])/divisor; last=new1;} else new1=Low[u]; } buf1[i]=new1; new1=EMPTY_VALUE; last=EMPTY_VALUE; // buf1[i+1]=Low[i+1]; // buf1[i]=buf1[i+1]+(High[i+1]-Low[i+1])/divisor; } } if(buf1[i+1]!=EMPTY_VALUE) { if(buf1[i+1]=i;u--) { if(last!=EMPTY_VALUE) {new1=last-(High[u+1]-Low[u+1])/divisor; last=new1;} else new1=High[u]; } buf0[i]=new1; new1=EMPTY_VALUE; last=EMPTY_VALUE; // buf0[i+1]=High[i+1]; // buf0[i]=buf0[i+1]-(High[i+1]-Low[i+1])/divisor; } } } return(0); } //+------------------------------------------------------------------+