//+------------------------------------------------------------------+ //| PivotChannel.mq4 | //| Copyright © 2010, Korwin | //| korwin-kor@yandex.ru | //+------------------------------------------------------------------+ #property copyright "Copyright © 2010, Korwin" #property link "korwin-kor@yandex.ru" #property indicator_chart_window #property indicator_buffers 7 #property indicator_style1 0 #property indicator_style2 0 #property indicator_style3 3 #property indicator_style4 2 #property indicator_style7 0 #property indicator_style5 2 #property indicator_style6 3 #property indicator_color1 Magenta #property indicator_color2 Magenta #property indicator_color3 Yellow #property indicator_color4 Aqua #property indicator_color7 White #property indicator_color5 Aqua #property indicator_color6 Yellow extern int Время_жизни_Pivot_High=21; extern int Время_жизни_Pivot_Low=21; extern string _____________________________="______________________________"; extern int Процентная_линия_от_High=15; extern int Пpоцентная_линия_от_High=40; extern string Середина ="Да"; extern int Пpоцентная_линия_от_Low=40; extern int Процентная_линия_от_Low=15; double buf0[]; double buf1[]; double buf2[]; double buf3[]; double buf4[]; double buf5[]; double buf6[]; double buf7[]; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { IndicatorBuffers(8); //---- drawing settings SetIndexStyle(0,DRAW_SECTION); SetIndexStyle(1,DRAW_SECTION); SetIndexStyle(2,DRAW_SECTION,2); SetIndexStyle(3,DRAW_LINE,2,1); SetIndexStyle(6,DRAW_SECTION,2,2); SetIndexStyle(4,DRAW_LINE,2,1); SetIndexStyle(5,DRAW_SECTION,2); //---- indicator buffers mapping SetIndexBuffer(0,buf0); SetIndexBuffer(1,buf1); SetIndexBuffer(2,buf2); SetIndexBuffer(3,buf3); SetIndexBuffer(4,buf4); SetIndexBuffer(5,buf5); SetIndexBuffer(6,buf6); SetIndexBuffer(7,buf7); SetIndexEmptyValue(0,0.0); SetIndexEmptyValue(1,0.0); //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator deinitialization function | //+------------------------------------------------------------------+ int deinit() { //---- //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int start() { int i, x, shift; double val, res; for(shift=Bars-Время_жизни_Pivot_High-1; shift>=0; shift--) { val=High[iHighest(NULL,0,MODE_HIGH,Время_жизни_Pivot_High,shift)]; buf0[shift]=val; } for(shift=Bars-Время_жизни_Pivot_Low-1; shift>=0; shift--) { val=Low[iLowest(NULL,0,MODE_LOW,Время_жизни_Pivot_Low,shift)]; buf1[shift]=val; } for(shift=Bars-Время_жизни_Pivot_High; shift>=0; shift--) { buf2[shift]=buf1[shift]-((buf1[shift]-buf0[shift])/100*Процентная_линия_от_High); //1я Пpоцентная_линия_от_High } for(shift=Bars-Время_жизни_Pivot_Low; shift>=0; shift--) { buf3[shift]=buf1[shift]-((buf1[shift]-buf0[shift])/100*Пpоцентная_линия_от_High); //2я Пpоцентная_линия_от_High } if(Середина=="Да" || Середина=="да" || Середина=="yes" || Середина=="Yes" || Середина=="1" || Середина=="true" || Середина=="True" || Середина=="50") { for(shift=Bars-100; shift>=0; shift--) { buf6[shift]=buf0[shift]+((buf1[shift]-buf0[shift])/100*50); } } for(shift=Bars-Время_жизни_Pivot_Low; shift>=0; shift--) { buf4[shift]=buf0[shift]+((buf1[shift]-buf0[shift])/100*Пpоцентная_линия_от_Low); } for(shift=Bars-Время_жизни_Pivot_Low; shift>=0; shift--) { buf5[shift]=buf0[shift]+((buf1[shift]-buf0[shift])/100*Процентная_линия_от_Low); } //---- //---- return(0); } //+------------------------------------------------------------------+