0
Views
0
Downloads
0
Favorites
SupremAutoFibo_Grand_Full
ÿþ//+------------------------------------------------------------------+
//| SupremAutoFibo_Grand_Full.mq5 |
//| Copyright © 2018, Nikolay Kositsin |
//| Khabarovsk, farria@mail.redcom.ru |
//+------------------------------------------------------------------+
//---- 02B>@AB2> 8=48:0B>@0
#property copyright "Copyright © 2018, Nikolay Kositsin"
//---- AAK;:0 =0 A09B 02B>@0
#property link "farria@mail.redcom.ru"
//---- >B@8A>2:0 8=48:0B>@0 2 3;02=>< >:=5
#property indicator_chart_window
//---- 4;O @0AGQB0 8 >B@8A>2:8 8=48:0B>@0 8A?>;L7>20=> 19 1CD5@>2
#property indicator_buffers 19
//---- 8A?>;L7>20=> 19 3@0D8G5A:8E ?>AB@>5=89
#property indicator_plots 19
//+----------------------------------------------+
//| >1JO2;5=85 :>=AB0=B |
//+----------------------------------------------+
#define RESET 0 // >=AB0=B0 4;O 2>72@0B0 B5@<8=0;C :><0=4K =0 ?5@5AG5B 8=48:0B>@0
//+-----------------------------------+
//| 0@0<5B@K >B@8A>2:8 8=48:0B>@>2 |
//+-----------------------------------+
//--- plot buffer 1
#property indicator_label1 "FiboLevel 1"
#property indicator_type1 DRAW_LINE
//--- plot buffer 2
#property indicator_label2 "FiboLevel 2"
#property indicator_type2 DRAW_LINE
//--- plot buffer 3
#property indicator_label3 "FiboLevel 3"
#property indicator_type3 DRAW_LINE
//--- plot buffer 4
#property indicator_label4 "FiboLevel 4"
#property indicator_type4 DRAW_LINE
//--- plot buffer 5
#property indicator_label5 "FiboLevel 5"
#property indicator_type5 DRAW_LINE
//--- plot buffer 6
#property indicator_label6 "FiboLevel 6"
#property indicator_type6 DRAW_LINE
//--- plot buffer 7
#property indicator_label7 "FiboLevel 7"
#property indicator_type7 DRAW_LINE
//--- plot buffer 8
#property indicator_label8 "FiboLevel 8"
#property indicator_type8 DRAW_LINE
//--- plot buffer 9
#property indicator_label9 "FiboLevel 9"
#property indicator_type9 DRAW_LINE
//--- plot buffer 10
#property indicator_label10 "FiboLevel 10"
#property indicator_type10 DRAW_LINE
//--- plot buffer 11
#property indicator_label11 "FiboLevel 11"
#property indicator_type11 DRAW_LINE
//--- plot buffer 12
#property indicator_label12 "FiboLevel 12"
#property indicator_type12 DRAW_LINE
//--- plot buffer 13
#property indicator_label13 "FiboLevel 13"
#property indicator_type13 DRAW_LINE
//--- plot buffer 13
#property indicator_label14 "FiboLevel 14"
#property indicator_type14 DRAW_LINE
//--- plot buffer 15
#property indicator_label15 "FiboLevel 15"
#property indicator_type15 DRAW_LINE
//--- plot buffer 16
#property indicator_label16 "FiboLevel 16"
#property indicator_type16 DRAW_LINE
//--- plot buffer 17
#property indicator_label17 "FiboLevel 17"
#property indicator_type17 DRAW_LINE
//--- plot buffer 18
#property indicator_label18 "FiboLevel 18"
#property indicator_type18 DRAW_LINE
//--- plot buffer 19
#property indicator_label19 "FiboLevel 19"
#property indicator_type19 DRAW_LINE
//+-----------------------------------+
//| %+ " + " |
//+-----------------------------------+
input ENUM_TIMEFRAMES Timeframe=PERIOD_D1; //"09<D@59< 8=48:0B>@0 4;O @0AG5B0 C@>2=59 $81>=0G8
input double FiboRatio =1.000; //>MDD8F85=B 4><=>65=8O 2A5E D81>C@>2=59
input double FiboLevelsShift=0.000; //!4283 ?> 25@B8:0;8 2A5E D81>C@>2=59 2 $810E >B =C;52>3> C@>2=O
input uint nPeriod=30; //>;8G5AB2> 10@>2 4;O ?>8A:0 M:AB@5<C<>2
//----
input double FiboLevel1 =-1.000; //7=0G5=85 D81>C@>2=O 1
input ENUM_LINE_STYLE StyleLevel1=STYLE_SOLID; //AB8;L ;8=88 D81>C@>2=O 1
input uint WidthLevel1=4; //B>;I8=0 ;8=88 D81>C@>2=O 1
input color Color_Level1 = clrOrange; //F25B D81>C@>2=O 1
//----
input double FiboLevel2=-0.764; //7=0G5=85 D81>C@>2=O 2
input ENUM_LINE_STYLE StyleLevel2=STYLE_SOLID; //AB8;L ;8=88 D81>C@>2=O 2
input uint WidthLevel2=1; //B>;I8=0 ;8=88 D81>C@>2=O 2
input color Color_Level2= clrDarkViolet; //F25B D81>C@>2=O 2
//----
input double FiboLevel3 =-0.618; //7=0G5=85 D81>C@>2=O 3
input ENUM_LINE_STYLE StyleLevel3=STYLE_DASH; //AB8;L ;8=88 D81>C@>2=O 3
input uint WidthLevel3=1; //B>;I8=0 ;8=88 D81>C@>2=O 3
input color Color_Level3 = clrMagenta; //F25B D81>C@>2=O 3
//----
input double FiboLevel4 =-0.500; //7=0G5=85 D81>C@>2=O 4
input ENUM_LINE_STYLE StyleLevel4=STYLE_SOLID; //AB8;L ;8=88 D81>C@>2=O 4
input uint WidthLevel4=2; //B>;I8=0 ;8=88 D81>C@>2=O 4
input color Color_Level4 = clrMediumSeaGreen; //F25B D81>C@>2=O 4
//----
input double FiboLevel5 =-0.382; //7=0G5=85 D81>C@>2=O 5
input ENUM_LINE_STYLE StyleLevel5=STYLE_DASH; //AB8;L ;8=88 D81>C@>2=O 5
input uint WidthLevel5=1; //B>;I8=0 ;8=88 D81>C@>2=O 5
input color Color_Level5 = clrBlue; //F25B D81>C@>2=O 5
//----
input double FiboLevel6=-0.236; //7=0G5=85 D81>C@>2=O 6
input ENUM_LINE_STYLE StyleLevel6=STYLE_SOLID; //AB8;L ;8=88 D81>C@>2=O 6
input uint WidthLevel6=1; //B>;I8=0 ;8=88 D81>C@>2=O 6
input color Color_Level6 = clrGray; //F25B D81>C@>2=O 6
//----
input double FiboLevel7 = 0.000; //7=0G5=85 D81>C@>2=O 7
input ENUM_LINE_STYLE StyleLevel7=STYLE_SOLID; //AB8;L ;8=88 D81>C@>2=O 7
input uint WidthLevel7=4; //B>;I8=0 ;8=88 D81>C@>2=O 7
input color Color_Level7=clrOrange; //F25B D81>C@>2=O 7
//----
input double FiboLevel8=0.236; //7=0G5=85 D81>C@>2=O 8
input ENUM_LINE_STYLE StyleLevel8=STYLE_SOLID; //AB8;L ;8=88 D81>C@>2=O 8
input uint WidthLevel8=1; //B>;I8=0 ;8=88 D81>C@>2=O 8
input color Color_Level8 = clrDarkViolet; //F25B D81>C@>2=O 8
//----
input double FiboLevel9 = 0.382; //7=0G5=85 D81>C@>2=O 9
input ENUM_LINE_STYLE StyleLevel9=STYLE_DASH; //AB8;L ;8=88 D81>C@>2=O 9
input uint WidthLevel9=1; //B>;I8=0 ;8=88 D81>C@>2=O 9
input color Color_Level9 = clrMagenta; //F25B D81>C@>2=O 9
//----
input double FiboLevel10 = 0.500; //7=0G5=85 D81>C@>2=O 10
input ENUM_LINE_STYLE StyleLevel10=STYLE_SOLID; //AB8;L ;8=88 D81>C@>2=O 10
input uint WidthLevel10=2; //B>;I8=0 ;8=88 D81>C@>2=O 10
input color Color_Level10 = clrMediumSeaGreen; //F25B D81>C@>2=O 10
//----
input double FiboLevel11 = 0.618; //7=0G5=85 D81>C@>2=O 11
input ENUM_LINE_STYLE StyleLevel11=STYLE_DASH; //AB8;L ;8=88 D81>C@>2=O 11
input uint WidthLevel11=1; //B>;I8=0 ;8=88 D81>C@>2=O 11
input color Color_Level11 = clrBlue; //F25B D81>C@>2=O 11
//----
input double FiboLevel12=0.764; //7=0G5=85 D81>C@>2=O 12
input ENUM_LINE_STYLE StyleLevel12=STYLE_SOLID; //AB8;L ;8=88 D81>C@>2=O 12
input uint WidthLevel12=1; //B>;I8=0 ;8=88 D81>C@>2=O 12
input color Color_Level12 = clrGray; //F25B D81>C@>2=O 12
//----
input double FiboLevel13 = 1.000; //7=0G5=85 D81>C@>2=O 13
input ENUM_LINE_STYLE StyleLevel13=STYLE_SOLID; //AB8;L ;8=88 D81>C@>2=O 13
input uint WidthLevel13=4; //B>;I8=0 ;8=88 D81>C@>2=O 13
input color Color_Level13 = clrOrange; //F25B D81>C@>2=O 13
//----
input double FiboLevel14=1.236; //7=0G5=85 D81>C@>2=O 14
input ENUM_LINE_STYLE StyleLevel14=STYLE_SOLID; //AB8;L ;8=88 D81>C@>2=O 14
input uint WidthLevel14=1; //B>;I8=0 ;8=88 D81>C@>2=O 14
input color Color_Level14 = clrDarkViolet; //F25B D81>C@>2=O 14
//----
input double FiboLevel15 = 1.382; //7=0G5=85 D81>C@>2=O 15
input ENUM_LINE_STYLE StyleLevel15=STYLE_DASH; //AB8;L ;8=88 D81>C@>2=O 15
input uint WidthLevel15=1; //B>;I8=0 ;8=88 D81>C@>2=O 15
input color Color_Level15 = clrMagenta; //F25B D81>C@>2=O 15
//----
input double FiboLevel16 = 1.500; //7=0G5=85 D81>C@>2=O 16
input ENUM_LINE_STYLE StyleLevel16=STYLE_SOLID; //AB8;L ;8=88 D81>C@>2=O 16
input uint WidthLevel16=2; //B>;I8=0 ;8=88 D81>C@>2=O 16
input color Color_Level16 = clrMediumSeaGreen; //F25B D81>C@>2=O 16
//----
input double FiboLevel17 = 1.618; //7=0G5=85 D81>C@>2=O 17
input ENUM_LINE_STYLE StyleLevel17=STYLE_DASH; //AB8;L ;8=88 D81>C@>2=O 17
input uint WidthLevel17=1; //B>;I8=0 ;8=88 D81>C@>2=O 17
input color Color_Level17 = clrBlue; //F25B D81>C@>2=O 17
//----
input double FiboLevel18=1.764; //7=0G5=85 D81>C@>2=O 18
input ENUM_LINE_STYLE StyleLevel18=STYLE_SOLID; //AB8;L ;8=88 D81>C@>2=O 18
input uint WidthLevel18=1; //B>;I8=0 ;8=88 D81>C@>2=O 18
input color Color_Level18 = clrGray; //F25B D81>C@>2=O 18
//----
input double FiboLevel19 = 2.000; //7=0G5=85 D81>C@>2=O 19
input ENUM_LINE_STYLE StyleLevel19=STYLE_SOLID; //AB8;L ;8=88 D81>C@>2=O 19
input uint WidthLevel19=4; //B>;I8=0 ;8=88 D81>C@>2=O 19
input color Color_Level19 = clrOrange; //F25B D81>C@>2=O 19
//----
input int Shift=0; //!4283 8=48:0B>@0 ?> 3>@87>=B0;8 2 10@0E
//+-----------------------------------+
//--- indicator buffers
double Buffer1[];
double Buffer2[];
double Buffer3[];
double Buffer4[];
double Buffer5[];
double Buffer6[];
double Buffer7[];
double Buffer8[];
double Buffer9[];
double Buffer10[];
double Buffer11[];
double Buffer12[];
double Buffer13[];
double Buffer14[];
double Buffer15[];
double Buffer16[];
double Buffer17[];
double Buffer18[];
double Buffer19[];
//---- 1JO2;5=85 F5;KE ?5@5<5==KE =0G0;0 >BAGQB0 40==KE
int min_rates_total;
double nHigh[],nLow[];
datetime nTime[1];
//+------------------------------------------------------------------+
//| >;CG5=85 B09<D@59<0 2 2845 AB@>:8 |
//+------------------------------------------------------------------+
string GetStringTimeframe(ENUM_TIMEFRAMES timeframe)
{return(StringSubstr(EnumToString(timeframe),7,-1));}
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int OnInit()
{
//--- =8F80;870F8O ?5@5<5==KE =0G0;0 >BAGQB0 40==KE
min_rates_total=int(3+nPeriod*PeriodSeconds(Timeframe)/PeriodSeconds(PERIOD_CURRENT))+1;
//--- @0A?@545;5=85 ?0<OB8 ?>4 <0AA82K ?5@5<5==KE
ArrayResize(nHigh,nPeriod);
ArrayResize(nLow,nPeriod);
//--- 8=45:A0F8O M;5<5=B>2 2 <0AA820E :0: 2 B09<A5@8OE
ArraySetAsSeries(nHigh,true);
ArraySetAsSeries(nLow,true);
//---- ?@52@0I5=85 48=0<8G5A:8E <0AA82>2 2 8=48:0B>@=K5 1CD5@K
SetIndexBuffer(0,Buffer1,INDICATOR_DATA);
SetIndexBuffer(1,Buffer2,INDICATOR_DATA);
SetIndexBuffer(2,Buffer3,INDICATOR_DATA);
SetIndexBuffer(3,Buffer4,INDICATOR_DATA);
SetIndexBuffer(4,Buffer5,INDICATOR_DATA);
SetIndexBuffer(5,Buffer6,INDICATOR_DATA);
SetIndexBuffer(6,Buffer7,INDICATOR_DATA);
SetIndexBuffer(7,Buffer8,INDICATOR_DATA);
SetIndexBuffer(8,Buffer9,INDICATOR_DATA);
SetIndexBuffer(9,Buffer10,INDICATOR_DATA);
SetIndexBuffer(10,Buffer11,INDICATOR_DATA);
SetIndexBuffer(11,Buffer12,INDICATOR_DATA);
SetIndexBuffer(12,Buffer13,INDICATOR_DATA);
SetIndexBuffer(13,Buffer14,INDICATOR_DATA);
SetIndexBuffer(14,Buffer15,INDICATOR_DATA);
SetIndexBuffer(15,Buffer16,INDICATOR_DATA);
SetIndexBuffer(16,Buffer17,INDICATOR_DATA);
SetIndexBuffer(17,Buffer18,INDICATOR_DATA);
SetIndexBuffer(18,Buffer19,INDICATOR_DATA);
//--- !B8;L ;8=89
PlotIndexSetInteger(0,PLOT_LINE_STYLE,StyleLevel1);
PlotIndexSetInteger(1,PLOT_LINE_STYLE,StyleLevel2);
PlotIndexSetInteger(2,PLOT_LINE_STYLE,StyleLevel3);
PlotIndexSetInteger(3,PLOT_LINE_STYLE,StyleLevel4);
PlotIndexSetInteger(4,PLOT_LINE_STYLE,StyleLevel5);
PlotIndexSetInteger(5,PLOT_LINE_STYLE,StyleLevel6);
PlotIndexSetInteger(6,PLOT_LINE_STYLE,StyleLevel7);
PlotIndexSetInteger(7,PLOT_LINE_STYLE,StyleLevel8);
PlotIndexSetInteger(8,PLOT_LINE_STYLE,StyleLevel9);
PlotIndexSetInteger(9,PLOT_LINE_STYLE,StyleLevel10);
PlotIndexSetInteger(10,PLOT_LINE_STYLE,StyleLevel11);
PlotIndexSetInteger(11,PLOT_LINE_STYLE,StyleLevel12);
PlotIndexSetInteger(12,PLOT_LINE_STYLE,StyleLevel13);
PlotIndexSetInteger(13,PLOT_LINE_STYLE,StyleLevel14);
PlotIndexSetInteger(14,PLOT_LINE_STYLE,StyleLevel15);
PlotIndexSetInteger(15,PLOT_LINE_STYLE,StyleLevel16);
PlotIndexSetInteger(16,PLOT_LINE_STYLE,StyleLevel17);
PlotIndexSetInteger(17,PLOT_LINE_STYLE,StyleLevel18);
PlotIndexSetInteger(18,PLOT_LINE_STYLE,StyleLevel19);
//--- ">;I8=0 ;8=89
PlotIndexSetInteger(0,PLOT_LINE_WIDTH,WidthLevel1);
PlotIndexSetInteger(1,PLOT_LINE_WIDTH,WidthLevel2);
PlotIndexSetInteger(2,PLOT_LINE_WIDTH,WidthLevel3);
PlotIndexSetInteger(3,PLOT_LINE_WIDTH,WidthLevel4);
PlotIndexSetInteger(4,PLOT_LINE_WIDTH,WidthLevel5);
PlotIndexSetInteger(5,PLOT_LINE_WIDTH,WidthLevel6);
PlotIndexSetInteger(6,PLOT_LINE_WIDTH,WidthLevel7);
PlotIndexSetInteger(7,PLOT_LINE_WIDTH,WidthLevel8);
PlotIndexSetInteger(8,PLOT_LINE_WIDTH,WidthLevel9);
PlotIndexSetInteger(9,PLOT_LINE_WIDTH,WidthLevel10);
PlotIndexSetInteger(10,PLOT_LINE_WIDTH,WidthLevel11);
PlotIndexSetInteger(11,PLOT_LINE_WIDTH,WidthLevel12);
PlotIndexSetInteger(12,PLOT_LINE_WIDTH,WidthLevel13);
PlotIndexSetInteger(13,PLOT_LINE_WIDTH,WidthLevel14);
PlotIndexSetInteger(14,PLOT_LINE_WIDTH,WidthLevel15);
PlotIndexSetInteger(15,PLOT_LINE_WIDTH,WidthLevel16);
PlotIndexSetInteger(16,PLOT_LINE_WIDTH,WidthLevel17);
PlotIndexSetInteger(17,PLOT_LINE_WIDTH,WidthLevel18);
PlotIndexSetInteger(18,PLOT_LINE_WIDTH,WidthLevel19);
//--- ">;I8=0 ;8=89
PlotIndexSetInteger(0,PLOT_LINE_COLOR,Color_Level1);
PlotIndexSetInteger(1,PLOT_LINE_COLOR,Color_Level2);
PlotIndexSetInteger(2,PLOT_LINE_COLOR,Color_Level3);
PlotIndexSetInteger(3,PLOT_LINE_COLOR,Color_Level4);
PlotIndexSetInteger(4,PLOT_LINE_COLOR,Color_Level5);
PlotIndexSetInteger(5,PLOT_LINE_COLOR,Color_Level6);
PlotIndexSetInteger(6,PLOT_LINE_COLOR,Color_Level7);
PlotIndexSetInteger(7,PLOT_LINE_COLOR,Color_Level8);
PlotIndexSetInteger(8,PLOT_LINE_COLOR,Color_Level9);
PlotIndexSetInteger(9,PLOT_LINE_COLOR,Color_Level10);
PlotIndexSetInteger(10,PLOT_LINE_COLOR,Color_Level11);
PlotIndexSetInteger(11,PLOT_LINE_COLOR,Color_Level12);
PlotIndexSetInteger(12,PLOT_LINE_COLOR,Color_Level13);
PlotIndexSetInteger(13,PLOT_LINE_COLOR,Color_Level14);
PlotIndexSetInteger(14,PLOT_LINE_COLOR,Color_Level15);
PlotIndexSetInteger(15,PLOT_LINE_COLOR,Color_Level16);
PlotIndexSetInteger(16,PLOT_LINE_COLOR,Color_Level17);
PlotIndexSetInteger(17,PLOT_LINE_COLOR,Color_Level18);
PlotIndexSetInteger(18,PLOT_LINE_COLOR,Color_Level19);
//--- !4283 ;8=89 ?> >A8 2@5<5=8
PlotIndexSetInteger(0,PLOT_SHIFT,Shift);
PlotIndexSetInteger(1,PLOT_SHIFT,Shift);
PlotIndexSetInteger(2,PLOT_SHIFT,Shift);
PlotIndexSetInteger(3,PLOT_SHIFT,Shift);
PlotIndexSetInteger(4,PLOT_SHIFT,Shift);
PlotIndexSetInteger(5,PLOT_SHIFT,Shift);
PlotIndexSetInteger(6,PLOT_SHIFT,Shift);
PlotIndexSetInteger(7,PLOT_SHIFT,Shift);
PlotIndexSetInteger(8,PLOT_SHIFT,Shift);
PlotIndexSetInteger(9,PLOT_SHIFT,Shift);
PlotIndexSetInteger(10,PLOT_SHIFT,Shift);
PlotIndexSetInteger(11,PLOT_SHIFT,Shift);
PlotIndexSetInteger(12,PLOT_SHIFT,Shift);
PlotIndexSetInteger(13,PLOT_SHIFT,Shift);
PlotIndexSetInteger(14,PLOT_SHIFT,Shift);
PlotIndexSetInteger(15,PLOT_SHIFT,Shift);
PlotIndexSetInteger(16,PLOT_SHIFT,Shift);
PlotIndexSetInteger(17,PLOT_SHIFT,Shift);
PlotIndexSetInteger(18,PLOT_SHIFT,Shift);
//--- A>740=85 8<5=8 4;O >B>1@065=8O 2 >B45;L=>< ?>4>:=5 8 2> 2A?;K20NI59 ?>4A:07:5
PlotIndexSetString(0,PLOT_LABEL,"Level1 "+DoubleToString(FiboLevel1,3));
PlotIndexSetString(1,PLOT_LABEL,"Level2 "+DoubleToString(FiboLevel2,3));
PlotIndexSetString(2,PLOT_LABEL,"Level3 "+DoubleToString(FiboLevel3,3));
PlotIndexSetString(3,PLOT_LABEL,"Level4 "+DoubleToString(FiboLevel4,3));
PlotIndexSetString(4,PLOT_LABEL,"Level5 "+DoubleToString(FiboLevel5,3));
PlotIndexSetString(5,PLOT_LABEL,"Level6 "+DoubleToString(FiboLevel6,3));
PlotIndexSetString(6,PLOT_LABEL,"Level7 "+DoubleToString(FiboLevel7,3));
PlotIndexSetString(7,PLOT_LABEL,"Level8 "+DoubleToString(FiboLevel8,3));
PlotIndexSetString(8,PLOT_LABEL,"Level9 "+DoubleToString(FiboLevel9,3));
PlotIndexSetString(9,PLOT_LABEL,"Level10 "+DoubleToString(FiboLevel10,3));
PlotIndexSetString(10,PLOT_LABEL,"Level11 "+DoubleToString(FiboLevel11,3));
PlotIndexSetString(11,PLOT_LABEL,"Level12 "+DoubleToString(FiboLevel12,3));
PlotIndexSetString(12,PLOT_LABEL,"Level13 "+DoubleToString(FiboLevel13,3));
PlotIndexSetString(13,PLOT_LABEL,"Level14 "+DoubleToString(FiboLevel14,3));
PlotIndexSetString(14,PLOT_LABEL,"Level15 "+DoubleToString(FiboLevel15,3));
PlotIndexSetString(15,PLOT_LABEL,"Level16 "+DoubleToString(FiboLevel16,3));
PlotIndexSetString(16,PLOT_LABEL,"Level17 "+DoubleToString(FiboLevel17,3));
PlotIndexSetString(17,PLOT_LABEL,"Level18 "+DoubleToString(FiboLevel18,3));
PlotIndexSetString(18,PLOT_LABEL,"Level19 "+DoubleToString(FiboLevel19,3));
//---
IndicatorSetInteger(INDICATOR_DIGITS,_Digits);
IndicatorSetString(INDICATOR_SHORTNAME,"SupremAutoFibo_Grand_Full("+GetStringTimeframe(Timeframe)+")");
//---
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int OnCalculate(const int rates_total,
const int prev_calculated,
const datetime &time[],
const double &open[],
const double &high[],
const double &low[],
const double &close[],
const long &tick_volume[],
const long &volume[],
const int &spread[])
{
//--- check for data
if(rates_total<min_rates_total) return(0);
if(prev_calculated==rates_total) return(rates_total);
//---- >1JO2;5=8O ;>:0;L=KE ?5@5<5==KE
int first,bar;
double P1,P2;
static datetime nTime_prev;
//---- @0AGQB AB0@B>2>3> =><5@0 first 4;O F8:;0 ?5@5AGQB0 10@>2
if(prev_calculated>rates_total || prev_calculated<=0) // ?@>25@:0 =0 ?5@2K9 AB0@B @0AGQB0 8=48:0B>@0
{
first=min_rates_total-1; // AB0@B>2K9 =><5@ 4;O @0AGQB0 2A5E 10@>2
nTime_prev=NULL;
for(int index=0; index<=min_rates_total; index++)
{
Buffer1[index]=EMPTY_VALUE;
Buffer2[index]=EMPTY_VALUE;
Buffer3[index]=EMPTY_VALUE;
Buffer4[index]=EMPTY_VALUE;
Buffer5[index]=EMPTY_VALUE;
Buffer6[index]=EMPTY_VALUE;
Buffer7[index]=EMPTY_VALUE;
Buffer8[index]=EMPTY_VALUE;
Buffer9[index]=EMPTY_VALUE;
Buffer10[index]=EMPTY_VALUE;
Buffer11[index]=EMPTY_VALUE;
Buffer12[index]=EMPTY_VALUE;
Buffer13[index]=EMPTY_VALUE;
Buffer14[index]=EMPTY_VALUE;
Buffer15[index]=EMPTY_VALUE;
Buffer16[index]=EMPTY_VALUE;
Buffer17[index]=EMPTY_VALUE;
Buffer18[index]=EMPTY_VALUE;
Buffer19[index]=EMPTY_VALUE;
}
}
else first=prev_calculated-1; // AB0@B>2K9 =><5@ 4;O @0AGQB0 =>2KE 10@>2
//---- >A=>2=>9 F8:; @0AGQB0 8=48:0B>@0
for(bar=first; bar<rates_total && !IsStopped(); bar++)
{
//----
int to_copy=1;
if(CopyTime(NULL,Timeframe,time[bar],to_copy,nTime)<to_copy)return(RESET);
to_copy=int(nPeriod);
if(nTime[0]!=nTime_prev)
{
if(CopyHigh(NULL,Timeframe,time[bar],to_copy,nHigh)<to_copy)return(RESET);
if(CopyLow(NULL,Timeframe,time[bar],to_copy,nLow)<to_copy)return(RESET);
nTime_prev=nTime[0];
}
//----
int hbar=ArrayMaximum(nHigh,0,nPeriod);
int lbar=ArrayMinimum(nLow,0,nPeriod);
//----
int trend=+1;
if(lbar<=hbar)
{
P1=nHigh[hbar];
P2=nLow[lbar];
trend=-1;
}
else
{
P1=nLow[lbar];
P2=nHigh[hbar];
trend=+1;
}
//----
double range=nHigh[hbar]-nLow[lbar];
if(trend>0) P2=nHigh[hbar];
else P2=nLow[lbar];
//----
double vertSfift=range*FiboLevelsShift;
P2+=vertSfift;
//----
Buffer1[bar]=P2-range*FiboLevel1*FiboRatio*trend;
Buffer2[bar]=P2-range*FiboLevel2*FiboRatio*trend;
Buffer3[bar]=P2-range*FiboLevel3*FiboRatio*trend;
Buffer4[bar]=P2-range*FiboLevel4*FiboRatio*trend;
Buffer5[bar]=P2-range*FiboLevel5*FiboRatio*trend;
Buffer6[bar]=P2-range*FiboLevel6*FiboRatio*trend;
Buffer7[bar]=P2-range*FiboLevel7*FiboRatio*trend;
Buffer8[bar]=P2-range*FiboLevel8*FiboRatio*trend;
Buffer9[bar]=P2-range*FiboLevel9*FiboRatio*trend;
Buffer10[bar]=P2-range*FiboLevel10*FiboRatio*trend;
Buffer11[bar]=P2-range*FiboLevel11*FiboRatio*trend;
Buffer12[bar]=P2-range*FiboLevel12*FiboRatio*trend;
Buffer13[bar]=P2-range*FiboLevel13*FiboRatio*trend;
Buffer14[bar]=P2-range*FiboLevel14*FiboRatio*trend;
Buffer15[bar]=P2-range*FiboLevel15*FiboRatio*trend;
Buffer16[bar]=P2-range*FiboLevel16*FiboRatio*trend;
Buffer17[bar]=P2-range*FiboLevel17*FiboRatio*trend;
Buffer18[bar]=P2-range*FiboLevel18*FiboRatio*trend;
Buffer19[bar]=P2-range*FiboLevel19*FiboRatio*trend;
int bar1=bar-1;
//--- C40;5=85 ;8H=8E 7=0G5=89, ?>@BOI8E 284 3@0D8:0 8 <5H0NI8E 53> 2>A?@8OB8N
if(Buffer1[bar]!=Buffer1[bar1]
||Buffer2[bar]!=Buffer2[bar1]
||Buffer3[bar]!=Buffer3[bar1]
||Buffer4[bar]!=Buffer4[bar1]
||Buffer5[bar]!=Buffer5[bar1]
||Buffer6[bar]!=Buffer6[bar1]
||Buffer7[bar]!=Buffer7[bar1]
||Buffer8[bar]!=Buffer8[bar1]
||Buffer9[bar]!=Buffer9[bar1]
||Buffer10[bar]!=Buffer10[bar1]
||Buffer11[bar]!=Buffer11[bar1]
||Buffer12[bar]!=Buffer12[bar1]
||Buffer13[bar]!=Buffer13[bar1]
||Buffer14[bar]!=Buffer14[bar1]
||Buffer15[bar]!=Buffer15[bar1]
||Buffer16[bar]!=Buffer16[bar1]
||Buffer17[bar]!=Buffer17[bar1]
||Buffer18[bar]!=Buffer18[bar1]
||Buffer19[bar]!=Buffer19[bar1]
)
{
Buffer1[bar1]=EMPTY_VALUE;
Buffer2[bar1]=EMPTY_VALUE;
Buffer3[bar1]=EMPTY_VALUE;
Buffer4[bar1]=EMPTY_VALUE;
Buffer5[bar1]=EMPTY_VALUE;
Buffer6[bar1]=EMPTY_VALUE;
Buffer7[bar1]=EMPTY_VALUE;
Buffer8[bar1]=EMPTY_VALUE;
Buffer9[bar1]=EMPTY_VALUE;
Buffer10[bar1]=EMPTY_VALUE;
Buffer11[bar1]=EMPTY_VALUE;
Buffer12[bar1]=EMPTY_VALUE;
Buffer13[bar1]=EMPTY_VALUE;
Buffer14[bar1]=EMPTY_VALUE;
Buffer15[bar1]=EMPTY_VALUE;
Buffer16[bar1]=EMPTY_VALUE;
Buffer17[bar1]=EMPTY_VALUE;
Buffer18[bar1]=EMPTY_VALUE;
Buffer19[bar1]=EMPTY_VALUE;
}
}
//---
return(rates_total);
}
//+------------------------------------------------------------------+
Comments