//+------------------------------------------------------------------+
//| 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);
}
//+------------------------------------------------------------------+
Comments