Divergence Petr_HL_BB.mq4 download link will appear after 10 seconds.
#property stacksize 16384
#property indicator_separate_window
#property indicator_level1 80
#property indicator_level2 50
#property indicator_level3 20
#property indicator_level4 0
#property indicator_levelstyle STYLE_SOLID
#property indicator_levelcolor DarkSlateGray
#property indicator_buffers 6
#property indicator_color1 DimGray
#property indicator_color2 Red
#property indicator_color3 Blue
#property indicator_color4 DarkKhaki
#property indicator_color5 DarkKhaki
#property indicator_color6 DarkKhaki
#property indicator_style4 2
#property indicator_style5 2
#property indicator_style6 2
extern int Osc=19; /*1=Accelerator/Decelerator, 2=Accumulation/Distribution,
3=Average Directional Movement Index, 4=Average True Range,
5=Awesome oscillator, 6=Bears Power, 7=Bulls Power,
8=CCI, 9=DeMarker, 10=Force Index,
11=Momentum, 12=Money Flow Index, 13=Moving Averages Convergence/Divergence,
14=Moving Average of Oscillator, 15=On Balance Volume,
16=Relative Vigor Index, 17=Standard Deviation,
18=Stochastic Oscillator, 19=Volume,
20=Close, 21=Open, 22=High, 23=Low,
24=(H+L)/2, 25=(H+L+C)/3, 26=(H+L+C+C)/4, 27=(O+C+H+L)/4, 28=(O+C)/2,
29=Relative Strength Index, 30=RBCI, 31=FTLM, 32=STLM, 33=JRSX,34=MACD_OsMA_ColorH_2LVar_mtf,
35=ZUP_RSI_v48,
other=RSI;*/
extern int RSIPeriod = 9;
extern int PriceType_buy = 2;
extern int PriceType_sell = 3;
extern string timeFrame = "Current time frame";
extern int OverBought = 80;
extern int OverSold = 20;
extern bool showArrows = false;
extern bool TH=true;
extern bool TL=true;
extern bool trend=false;
extern bool divergen=true;
extern bool convergen=true;
extern int Complect=3;
extern int cs=3;
int Complect10=10;
int Complect20=20;
int Complect30=30;
int Complect40=40;
int Complect50=50;
int Complect60=60;
int Complect70=70;
int Complect80=80;
int Complect1=0;
int Complect2=0;
int Complect8=0;
int Complect3=0;
int Complect4=0;
int Complect5=0;
extern int BSteph=0;
extern int BStepl=0;
extern int BackSteph=0; // количество шагов назад h
extern int BackStepl=0; // количество шагов назад l
extern int histo=0; // История
extern int qSteps=55; // количество обсчитываемых шагов
extern int LevDPl=3; // уровень точек демарка; 2 = центральный бар будет выше(ниже) 2х баров слева
extern int LevDPr=1; // уровень точек демарка; 2 = центральный бар будет выше(ниже) 2х баров справа
extern int period=8;
int ma_method=0;
int ma_shift=0;
extern int applied_price=5;
int mode=0;
extern int fast_ema_period=12;
extern int slow_ema_period=26;
extern int signal_period=9;
extern int Kperiod=13;
extern int Dperiod=5;
extern int slowing=3;
extern int price_field=0;
int T3_Period = 1;
double b = 0.7;
extern int showBars=5000; // если = 0, то индюк отображается для всего графика
extern bool LeftStrong=false;
extern bool RightStrong=true;
bool Anti=true;
bool Trend_Down=true;
bool Trend_Up=true;
bool TrendLine=true; // false = линий тренда не будет
bool HandyColour=true;
color Highline=Red;
color Lowline=Blue;
bool ChannelLine=false; // true = строить паралельно линиям тренда каналы
int Trend=0; // 1 = только для UpTrendLines, -1 = только для DownTrendLines, 0 = для всех TrendLines
bool Channel=false;
bool Regression=true;
bool RayH=true;
bool RayL=true;
color ChannelH=Red;
color ChannelL=Blue;
//double STD.widthH=1.0;
//double STD.widthL=1.0;
extern int Back=0;
bool comment=false;
extern int code=159; //161;
//---
extern int BB_Period = 21;
extern double BB_Deviation = 1;
extern int BB_Shift = 0;
//---
//extern bool BuyStop = false;
//extern bool SellLimit = false;
//extern bool SellStop = false;
//extern bool BuyLimit = false;
double e1, e2, e3, e4, e5, e6;
double n, c1, c2, c3, c4, w1, w2, b2, b3;
int time2; double E1, E2, E3, E4, E5, E6;
//---- buffers
double Oscil[], t3_Oscil[];
double Buf1[];
double Buf2[];
//----
string Col[]={"Красная","Синяя","Розовая","Голубая","Коричневая","Синяя"};
int ColNum[]={Red,DeepSkyBlue,Coral,Aqua,SaddleBrown,Blue};
int qPoint=0; // переменная для нормализации цены
int qBars; double qTime=0; // переменные для ликвидации глюков при загрузке
int low=1;
int high=0;
double BUpper[];
double BLower[];
double BMiddle[];
int init()
{
//double Complect1, Complect2,Complect3, Complect4, Complect5,Complect6, Complect7, Complect8, buy,sell, buy1,sell1;
if (Complect>0)
{
Complect=Complect+10;
Complect1=Complect+Complect20+10;
Complect2=Complect+Complect40+10;
Complect3=Complect+Complect60+10;
Complect8=Complect+Complect80+10;
Complect4=Complect+Complect70+10;
Complect5=Complect+Complect60+10;
}
if(qSteps<1) {qSteps=1;}
//if (BackStep>0)
//{BackSteph=BackStep; BackStepl=BackStep;}
string short_name;
IndicatorBuffers(7);
qBars=Bars;
qSteps=MathMin(500,qSteps);
while (NormalizeDouble(Point,qPoint)==0)qPoint++;
string Rem="DLines © GameOver";
SetIndexStyle(0,DRAW_LINE);
SetIndexBuffer(0,t3_Oscil);
SetIndexDrawBegin(0,2*T3_Period);
SetIndexStyle(1,DRAW_ARROW);
SetIndexStyle(2,DRAW_ARROW);
SetIndexArrow(1,code);
SetIndexArrow(2,code);
SetIndexBuffer(1,Buf1);
SetIndexBuffer(2,Buf2);
SetIndexEmptyValue(1,0.0);
SetIndexEmptyValue(2,0.0);
SetIndexLabel(1,Rem);
SetIndexLabel(2,Rem);
//---
SetIndexStyle (3, DRAW_LINE);
SetIndexBuffer(3, BUpper);
SetIndexLabel (3, "BB Up");
SetIndexStyle (4, DRAW_LINE);
SetIndexBuffer(4, BMiddle);
SetIndexLabel (4, "BB Middle");
SetIndexStyle (5, DRAW_LINE);
SetIndexBuffer(5, BLower);
SetIndexLabel (5, "BB Dn");
//---
SetIndexBuffer(6,Oscil);
switch(Osc)
{
case 1 : short_name="AC"; break;
case 2 : short_name="A/D"; break;
case 3 : short_name="ADX"; break;
case 4 : short_name="ATR"; break;
case 5 : short_name="AO"; break;
case 6 : short_name="Bears"; break;
case 7 : short_name="Bulls"; break;
case 8 : short_name="CCI"; break;
case 9 : short_name="DeM"; break;
case 10 : short_name="Force"; break;
case 11 : short_name="Momentum"; break;
case 12 : short_name="MFI"; break;
case 13 : short_name="MACD"; break;
case 14 : short_name="OsMA"; break;
case 15 : short_name="OBV"; break;
case 16 : short_name="RVI"; break;
case 17 : short_name="StdDev"; break;
case 18 : short_name="Stoch"; break;
case 19 : short_name="Volume"; break;
case 20 : short_name="Close"; break;
case 21 : short_name="Open"; break;
case 22 : short_name="High"; break;
case 23 : short_name="Low"; break;
case 24 : short_name="Median Price"; break;
case 25 : short_name="Typical Price"; break;
case 26 : short_name="Weighted Close Price"; break;
case 27 : short_name="(O+C+H+L)/4"; break;
case 28 : short_name="(O+C)/2"; break;
case 29 : short_name="RSI_C"; break;
case 30 : short_name="RBC"; break;
case 31 : short_name="FTLM"; break;
case 32 : short_name="STLM"; break;
case 33 : short_name="FullSSA"; break;
case 34 : short_name="MACD_OsMA_ColorH_2LVar_mtf"; break;
case 35 : short_name="ZUP_RSI_v48"; break;
default : short_name="RSI_C";
}
IndicatorShortName(short_name+Complect);
SetIndexLabel(0,short_name+Complect);
b2 = b*b;
b3 = b2*b;
c1 = -b3;
c2 = (3*(b2 + b3));
c3 = -3*(2*b2 + b + b3);
c4 = (1 + 3*b + b3 + 3*b2);
if(T3_Period < 1)
T3_Period = 1;
n = 1 + 0.5*(T3_Period - 1);
w1 = 2 / (n + 1);
w2 = 1 - w1;
return(0);
}
int deinit()
{
if(comment) Comment("");
int dd=histo+1;
if(histo==0){dd=1;}
for(int i=0;i<=dd;i++)
{
ObjectDelete("HLh"+Complect+i);ObjectDelete("LLl"+Complect+i);
ObjectDelete("RSIh"+Complect+i);ObjectDelete("RSIl"+Complect+i);
ObjectDelete("RBCh"+Complect+i);ObjectDelete("RBCl"+Complect+i);
ObjectDelete("HLh"+Complect8+i);ObjectDelete("LLl"+Complect8+i);
ObjectDelete("RSIh"+Complect8+i);ObjectDelete("RSIl"+Complect8+i);
ObjectDelete("RBCh"+Complect8+i);ObjectDelete("RBCl"+Complect8+i);
ObjectDelete("HLh"+Complect1+i);ObjectDelete("LLl"+Complect1+i);
ObjectDelete("RSIh"+Complect1+i);ObjectDelete("RSIl"+Complect1+i);
ObjectDelete("RBCh"+Complect1+i);ObjectDelete("RBCl"+Complect1+i);
ObjectDelete("HLh"+Complect2+i);ObjectDelete("LLl"+Complect2+i);
ObjectDelete("RSIh"+Complect2+i);ObjectDelete("RSIl"+Complect2+i);
ObjectDelete("RBCh"+Complect2+i);ObjectDelete("RBCl"+Complect2+i);
ObjectDelete("HLh"+Complect3+i);ObjectDelete("LLl"+Complect3+i);
ObjectDelete("RSIh"+Complect3+i);ObjectDelete("RSIl"+Complect3+i);
ObjectDelete("RBCh"+Complect3+i);ObjectDelete("RBCl"+Complect3+i);
ObjectDelete("HLh"+Complect4+i);ObjectDelete("LLl"+Complect4+i);
ObjectDelete("RSIh"+Complect4+i);ObjectDelete("RSIl"+Complect4+i);
ObjectDelete("RBCh"+Complect4+i);ObjectDelete("RBCl"+Complect4+i);
ObjectDelete("HLh"+Complect5+i);ObjectDelete("LLl"+Complect5+i);
ObjectDelete("RSIh"+Complect5+i);ObjectDelete("RSIl"+Complect5+i);
ObjectDelete("RBCh"+Complect5+i);ObjectDelete("RBCl"+Complect5+i);
ObjectDelete("MACDh"+Complect+i);ObjectDelete("MACDl"+Complect+i);
ObjectDelete("HLhC"+Complect+i);ObjectDelete("LLlC"+Complect+i);
ObjectDelete("RSIhC"+Complect+i);ObjectDelete("RSIlC"+Complect+i);
ObjectDelete("RBChC"+Complect+i);ObjectDelete("RBClC"+Complect+i);
ObjectDelete("MACDhC"+Complect+i);ObjectDelete("MACDlC"+Complect+i);
ObjectDelete("HCL"+Complect+i);ObjectDelete("LCL"+Complect+i);
ObjectDelete("CHAh"+Complect+i);ObjectDelete("CHAl"+Complect+i);
ObjectDelete("MACDh"+Complect8+i);ObjectDelete("MACDl"+Complect8+i);
ObjectDelete("HLhC"+Complect8+i);ObjectDelete("LLlC"+Complect8+i);
ObjectDelete("RSIhC"+Complect8+i);ObjectDelete("RSIlC"+Complect8+i);
ObjectDelete("RBChC"+Complect8+i);ObjectDelete("RBClC"+Complect8+i);
ObjectDelete("MACDhC"+Complect8+i);ObjectDelete("MACDlC"+Complect8+i);
ObjectDelete("HCL"+Complect8+i);ObjectDelete("LCL"+Complect8+i);
ObjectDelete("CHAh"+Complect8+i);ObjectDelete("CHAl"+Complect8+i);
ObjectDelete("MACDh"+Complect1+i);ObjectDelete("MACDl"+Complect1+i);
ObjectDelete("HLhC"+Complect1+i);ObjectDelete("LLlC"+Complect1+i);
ObjectDelete("RSIhC"+Complect1+i);ObjectDelete("RSIlC"+Complect1+i);
ObjectDelete("RBChC"+Complect1+i);ObjectDelete("RBClC"+Complect1+i);
ObjectDelete("MACDhC"+Complect1+i);ObjectDelete("MACDlC"+Complect1+i);
ObjectDelete("HCL"+Complect1+i);ObjectDelete("LCL"+Complect1+i);
ObjectDelete("CHAh"+Complect1+i);ObjectDelete("CHAl"+Complect1+i);
ObjectDelete("MACDh"+Complect2+i);ObjectDelete("MACDl"+Complect2+i);
ObjectDelete("HLhC"+Complect2+i);ObjectDelete("LLlC"+Complect2+i);
ObjectDelete("RSIhC"+Complect2+i);ObjectDelete("RSIlC"+Complect2+i);
ObjectDelete("RBChC"+Complect2+i);ObjectDelete("RBClC"+Complect2+i);
ObjectDelete("MACDhC"+Complect2+i);ObjectDelete("MACDlC"+Complect2+i);
ObjectDelete("HCL"+Complect2+i);ObjectDelete("LCL"+Complect2+i);
ObjectDelete("CHAh"+Complect2+i);ObjectDelete("CHAl"+Complect2+i);
ObjectDelete("MACDh"+Complect3+i);ObjectDelete("MACDl"+Complect3+i);
ObjectDelete("HLhC"+Complect3+i);ObjectDelete("LLlC"+Complect3+i);
ObjectDelete("RSIhC"+Complect3+i);ObjectDelete("RSIlC"+Complect3+i);
ObjectDelete("RBChC"+Complect3+i);ObjectDelete("RBClC"+Complect3+i);
ObjectDelete("MACDhC"+Complect3+i);ObjectDelete("MACDlC"+Complect3+i);
ObjectDelete("HCL"+Complect3+i);ObjectDelete("LCL"+Complect3+i);
ObjectDelete("CHAh"+Complect3+i);ObjectDelete("CHAl"+Complect3+i);
ObjectDelete("MACDh"+Complect4+i);ObjectDelete("MACDl"+Complect4+i);
ObjectDelete("HLhC"+Complect4+i);ObjectDelete("LLlC"+Complect4+i);
ObjectDelete("RSIhC"+Complect4+i);ObjectDelete("RSIlC"+Complect4+i);
ObjectDelete("RBChC"+Complect4+i);ObjectDelete("RBClC"+Complect4+i);
ObjectDelete("MACDhC"+Complect4+i);ObjectDelete("MACDlC"+Complect4+i);
ObjectDelete("HCL"+Complect4+i);ObjectDelete("LCL"+Complect4+i);
ObjectDelete("CHAh"+Complect4+i);ObjectDelete("CHAl"+Complect4+i);
ObjectDelete("MACDh"+Complect5+i);ObjectDelete("MACDl"+Complect5+i);
ObjectDelete("HLhC"+Complect5+i);ObjectDelete("LLlC"+Complect5+i);
ObjectDelete("RSIhC"+Complect5+i);ObjectDelete("RSIlC"+Complect5+i);
ObjectDelete("RBChC"+Complect5+i);ObjectDelete("RBClC"+Complect5+i);
ObjectDelete("MACDhC"+Complect5+i);ObjectDelete("MACDlC"+Complect5+i);
ObjectDelete("HCL"+Complect5+i);ObjectDelete("LCL"+Complect5+i);
ObjectDelete("CHAh"+Complect5+i);ObjectDelete("CHAl"+Complect5+i);
}
return(0);
}
int start()
{
int i, j, counted_bars=IndicatorCounted();
int shift, limit;
//----
if(counted_bars<0) return(-1);
if(counted_bars<1) limit=Bars-1;
else limit=Bars-counted_bars;
for(shift=0; shift<=limit; shift++)
{
switch (Osc)
{
case 1: Oscil[shift] = iAC(NULL,0,shift)+1; break;
case 2: Oscil[shift] = iAD(NULL,0,shift); break;
case 3: Oscil[shift] = iADX(NULL,0,period,applied_price,mode,shift); break;
case 4: Oscil[shift] = iATR(NULL,0,period,shift); break;
case 5: Oscil[shift] = iAO(NULL,0,shift)+1; break;
case 6: Oscil[shift] = iBearsPower(NULL,0,period,applied_price,shift)+1; break;
case 7: Oscil[shift] = iBullsPower(NULL,0,period,applied_price,shift)+1; break;
case 8: Oscil[shift] = iCCI(NULL,0,period,applied_price,shift)+1000; break;
case 9: Oscil[shift] = iDeMarker(NULL,0,period,shift); break;
case 10: Oscil[shift] = iForce(NULL,0,period,ma_method,applied_price,shift)+100; break;
case 11: Oscil[shift] = iMomentum(NULL,0,period,applied_price,shift); break;
case 12: Oscil[shift] = iMFI(NULL,0,period,shift); break;
case 13: Oscil[shift] = iMACD(NULL,0,fast_ema_period,slow_ema_period,signal_period,applied_price,mode,shift)+1; break;
case 14: Oscil[shift] = iOsMA(NULL,0,fast_ema_period,slow_ema_period,signal_period,applied_price,shift)+1; break;
case 15: Oscil[shift] = iOBV(NULL,0,applied_price,shift)/10000000+100; break;
case 16: Oscil[shift] = iRVI(NULL,0,period,mode,shift)+1; break;
case 17: Oscil[shift] = iStdDev(NULL,0,period,ma_shift,ma_method,applied_price,shift); break;
case 18: Oscil[shift] = iStochastic(NULL,0,Kperiod,Dperiod,slowing,ma_method,price_field,mode,shift); break;
case 19: Oscil[shift] = Volume[shift]; break;
case 20: Oscil[shift] = Close[shift]; break;
case 21: Oscil[shift] = Open[shift]; break;
case 22: Oscil[shift] = High[shift]; break;
case 23: Oscil[shift] = Low[shift]; break;
case 24: Oscil[shift] =(High[shift]+Low[shift])/2; break;
case 25: Oscil[shift] =(High[shift]+Low[shift]+Close[shift])/3; break;
case 26: Oscil[shift] =(High[shift]+Low[shift]+Close[shift]+Close[shift])/4; break;
case 27: Oscil[shift] =(Open[shift]+Close[shift]+High[shift]+Low[shift])/4; break;
case 28: Oscil[shift] =(Open[shift]+Close[shift])/2; break;
case 29: Oscil[shift] =iCustom(NULL,0,"RSI_C",RSIPeriod,PriceType_buy,PriceType_sell,timeFrame,OverBought,OverSold,showArrows,0,shift); break; //iRSI(NULL,0,period,applied_price,shift); break;
case 30: Oscil[shift] =iCustom(NULL,0,"RBC",0,shift); break;
case 31: Oscil[shift] =iCustom(NULL,0,"FTLM Petr2",0,shift); break;
case 32: Oscil[shift] =iCustom(NULL,0,"STLM Petr2",0,shift); break;
case 33: Oscil[shift] =iCustom(NULL,0,"FullSSA",0,shift); break;
case 34: Oscil[shift] =iCustom(NULL,0,"MACD_OsMA_ColorH_2LVar_mtf",0,shift); break;
case 35: Oscil[shift] =iCustom(NULL,0,"ZUP_RSI_v48",0,shift); break;
default: Oscil[shift] = iCustom(NULL,0,"RSI_C",RSIPeriod,PriceType_buy,PriceType_sell,timeFrame,OverBought,OverSold,showArrows,0,shift);
}
}
//----
if(Bars-1 < T3_Period)
return(0);
//----
int MaxBar, counted_bars1=IndicatorCounted();
//----
if(counted_bars1 > 0)
counted_bars1--;
//----
MaxBar = Bars - 1 - T3_Period;
//----
limit = (Bars - 1 - counted_bars1);
//----
if(limit > MaxBar)
{
for(int bar = Bars - 1; bar >= MaxBar; bar--)
t3_Oscil[bar] = 0.0;
limit = MaxBar;
}
//---
int Tnew = Time[limit+1];
if(limit < MaxBar)
if(Tnew == time2)
{
e1 = E1;
e2 = E2;
e3 = E3;
e4 = E4;
e5 = E5;
e6 = E6;
}
else
{
if(Tnew > time2)
Print("ERROR01");
else
Print("ERROR02");
return(-1);
}
//---
for(bar = limit; bar >= 0; bar--)
{
if(bar == 1)
if(((limit == 1)&&(time2 != Time[2])) || (limit > 1))
{
time2 = Time[2];
E1 = e1;
E2 = e2;
E3 = e3;
E4 = e4;
E5 = e5;
E6 = e6;
}
//+---+============================================+
e1 = w1*Oscil[bar] + w2*e1;
e2 = w1*e1 + w2*e2;
e3 = w1*e2 + w2*e3;
e4 = w1*e3 + w2*e4;
e5 = w1*e4 + w2*e5;
e6 = w1*e5 + w2*e6;
t3_Oscil[bar]=c1*e6 + c2*e5 + c3*e4 + c4*e3;
}
//---
for (i = 0; i < limit; i++)
{
BLower [i] = iBandsOnArray(t3_Oscil, 0, BB_Period, BB_Deviation, BB_Shift, MODE_LOWER, i);
BUpper [i] = iBandsOnArray(t3_Oscil, 0, BB_Period, BB_Deviation, BB_Shift, MODE_UPPER, i);
BMiddle[i] = iBandsOnArray(t3_Oscil, 0, BB_Period, BB_Deviation, BB_Shift, MODE_MAIN, i);
}
//----
if (qBars!=Bars){ deinit(); Sleep(1000); qBars=Bars; qTime=0; return(0);}
if (qTime==Time[0]) return(0); qTime=Time[0]; // запускаеца тока на 1м тике
if (showBars>Bars-LevDPl-1) showBars=Bars-LevDPl-1;
if (showBars==0) showBars=Bars-LevDPl-1;
// заполнили и отобразили точки демарка
for (int cnt=showBars+Back;cnt>LevDPr+Back;cnt--)
{
int mx=1, mmx=1, mxx=1;
if(LevDPl!=0)
{
for(i=LevDPl, j=LevDPr; i>0; i--, j--)
{
if(LeftStrong)
{
if(t3_Oscil[cnt+i]>=t3_Oscil[cnt]) mx=0;
}
else
{
if(t3_Oscil[cnt+i]>t3_Oscil[cnt]) mx=0;
}
if(j>0)
{
if(RightStrong)
{
if(t3_Oscil[cnt-j]>=t3_Oscil[cnt]) mmx=0;
}
else
{
if(t3_Oscil[cnt-j]>t3_Oscil[cnt]) mmx=0;
}
}
mxx=mx*mmx*mxx;
}
if(mxx>0) Buf1[cnt]=t3_Oscil[cnt];
else Buf1[cnt]=0;
if(mxx>0 && low==1)
{
low=0;
high=1;
}
}
else
{
for(j=LevDPr; j>0; j--)
{
if(RightStrong)
{
if(t3_Oscil[cnt-j]>=t3_Oscil[cnt]) mmx=0;
}
else
{
if(t3_Oscil[cnt-j]>t3_Oscil[cnt]) mmx=0;
}
mxx=mmx*mxx;
}
if(mxx>0) Buf1[cnt]=t3_Oscil[cnt];
else Buf1[cnt]=0;
if(mxx>0 && low==1)
{
low=0;
high=1;
}
}
//----
int mn=1,mmn=1, mnn=1;
if(LevDPl!=0)
{
for(i=LevDPl, j=LevDPr; i>0; i--, j--)
{
if(LeftStrong)
{
if(t3_Oscil[cnt+i]<=t3_Oscil[cnt]) mn=0;
}
else
{
if(t3_Oscil[cnt+i]0)
{
if(RightStrong)
{
if(t3_Oscil[cnt-j]<=t3_Oscil[cnt]) mmn=0;
}
else
{
if(t3_Oscil[cnt-j]0) Buf2[cnt]=t3_Oscil[cnt];
else Buf2[cnt]=0;
if(mnn>0 && high==1)
{
low=1;
high=0;
}
}
else
{
for(j=LevDPr; j>0; j--)
{
if(RightStrong)
{
if(t3_Oscil[cnt-j]<=t3_Oscil[cnt]) mmn=0;
}
else
{
if(t3_Oscil[cnt-j]0)Buf2[cnt]=t3_Oscil[cnt];
else Buf2[cnt]=0;
if(mnn>0 && high==1)
{
low=1;
high=0;
}
}
//----
}
string Comm;
for(cnt=qSteps;cnt>=1;cnt--) Comm=Comm+(TDMain(cnt));
if(comment) Comment(Comm);
return(0);
}
string TDMain(int Step)
{
int hhH1,hH1,hH2,hH3,hH4,hH5,hH6,hH7,hH8,hH9,hH10,hH11,hH12,hH13,H1,H2,H3,H4,H5,H6,H7,H8,H9,H10,H11,H12,H13,H14,H15,H1h,H2h,H3h,H4h,H5h,H6h,H7h,H8h,H9h,H10h,H11h,H12h,H13h,H14h,
llL1,lL1,lL2,lL3,lL4,lL5,lL6,lL7,lL8,lL9,lL10,lL11,lL12,lL13,L1,L2,L3,L4,L5,L6,L7,L8,L9,L10,L11,L12,L13,L14,L15,L1l,L2l,L3l,L4l,L5l,L6l,L7l,L8l,L9l,L10l,L11l,L12l,L13l,L14l,
qExt14,qExt13,qExt12,qExt11,qExt10,qExt9,qExt8,qExt7,qExt6,qExt5,qExt4,qExt3,qExt2,qExt,col;
int Ext14,Ext13,Ext12,Ext11,Ext10,Ext9,Ext8,Ext7,Ext6,Ext5,Ext4,Ext3,Ext2;
int xt8,xt7,xt6,xt5,xt4,xt3,xt2;
double qTL;
string Comm="»—»—» Шаг "+Step+" из "+qSteps+" (histo "+histo+")\n",Rem,Rem1,Rem2,Rem3,Rem4,Rem5,Rem6;
string Short_name;
switch(Osc)
{
case 1 : Short_name="AC"; break;
case 2 : Short_name="A/D"; break;
case 3 : Short_name="ADX"; break;
case 4 : Short_name="ATR"; break;
case 5 : Short_name="AO"; break;
case 6 : Short_name="Bears"; break;
case 7 : Short_name="Bulls"; break;
case 8 : Short_name="CCI"; break;
case 9 : Short_name="DeM"; break;
case 10 : Short_name="Force"; break;
case 11 : Short_name="Momentum"; break;
case 12 : Short_name="MFI"; break;
case 13 : Short_name="MACD"; break;
case 14 : Short_name="OsMA"; break;
case 15 : Short_name="OBV"; break;
case 16 : Short_name="RVI"; break;
case 17 : Short_name="StdDev"; break;
case 18 : Short_name="Stoch"; break;
case 19 : Short_name="Volume"; break;
case 20 : Short_name="Close"; break;
case 21 : Short_name="Open"; break;
case 22 : Short_name="High"; break;
case 23 : Short_name="Low"; break;
case 24 : Short_name="Median Price"; break;
case 25 : Short_name="Typical Price"; break;
case 26 : Short_name="Weighted Close Price"; break;
case 27 : Short_name="(O+C+H+L)/4"; break;
case 29 : Short_name="RSI_C"; break;
case 30 : Short_name="RBC"; break;
case 31 : Short_name="FTLM"; break;
case 32 : Short_name="STLM"; break;
case 33 : Short_name="FullSSA"; break;
case 34 : Short_name="MACD_OsMA_ColorH_2LVar_mtf"; break;
case 35 : Short_name="ZUP_RSI_v48"; break;
default : Short_name="RSI_C";
}
// для DownTrendLines
if (Trend<=0)
{
Comm=Comm+"» "+Col[Step*2-2]+" DownTrendLine ";
if(HandyColour) col=Highline; else col=ColNum[Step*2-2];
int y;
for (y=0; y<=histo; y++) {
if (histo>0)
{BackSteph=y; BackStepl=y;}
if(trend==true)
{
H1=GetTD(Step+BSteph,Buf1);
L1=GetTD(Step+BSteph,Buf2);
if (Time[H1]>Time[L1]) {
H1=GetNextHighTD(L1);}
else H1=GetTD(Step+BSteph,Buf1);
L2=GetNextLowTD(H1);
H2=GetNextHighTD(L2);
hH1=GetNextHighTD(H1);
if (Time[hH1]