Hey everyone. Someone can rewrite the indicator code from mq4 to TOS. Very good at drawing channels.
Code:
*/
#property copyright "ATEI,Pupo,Dimanchik"
#property link "[email protected]"
#property indicator_chart_window
#property indicator_buffers 7
#property indicator_color1 Green
#property indicator_color2 Green
#property indicator_color3 Green
#property indicator_color4 Green
#property indicator_color5 Green
#property indicator_color6 Green
#property indicator_color7 Green
extern string SeparatorVol = " Настройки индикатора VolProfit ";
extern int CountBarsForAverage = 89;
extern int PeriodShift = 0;
extern string SeparatorSAKS = " Настройки индикатора SAKSChanell";
extern bool AutoLevel = FALSE;
extern int EMAPeriod = 233;
extern int LevelR1 = 40;
extern int LevelR2 = 40;
extern int LevelR3 = 40;
extern int LevelS1 = 40;
extern int LevelS2 = 40;
extern int LevelS3 = 40;
double gd_132 = 40.0;
double gd_140 = 40.0;
double gd_148 = 40.0;
double gd_156 = 40.0;
double gd_164 = 40.0;
double gd_172 = 40.0;
double gda_180[];
double gda_184[];
double gda_188[];
double gda_192[];
double gda_196[];
double gda_200[];
double gda_204[];
int gi_208;
int gi_212;
int gi_216;
double gd_220 = 0.0;
double gd_228 = 0.0;
double gd_236 = 0.0;
string gsa_244[] = {"", "M1", "M5", "M15", "M30", "H1", "H4", "D1", "W1", "MN1"};
int gia_248[] = {0, 1, 5, 15, 30, 60, 240, 1440, 10080, 43200};
int gi_252;
string gs_256;
int init() {
gi_252 = gia_248[ArrayBsearch(gia_248, Period()) + PeriodShift];
gs_256 = gsa_244[ArrayBsearch(gia_248, Period()) + PeriodShift];
SetIndexStyle(0, DRAW_LINE);
SetIndexBuffer(0, gda_180);
SetIndexStyle(1, DRAW_LINE);
SetIndexBuffer(1, gda_184);
SetIndexStyle(2, DRAW_LINE);
SetIndexBuffer(2, gda_188);
SetIndexStyle(3, DRAW_LINE);
SetIndexBuffer(3, gda_192);
SetIndexStyle(4, DRAW_LINE);
SetIndexBuffer(4, gda_196);
SetIndexStyle(5, DRAW_LINE);
SetIndexBuffer(5, gda_200);
SetIndexStyle(6, DRAW_LINE);
SetIndexBuffer(6, gda_204);
IndicatorShortName(Symbol() + "(" + Period() + "): ");
SetIndexLabel(0, "МА" + DoubleToStr(EMAPeriod, 0));
SetIndexLabel(1, "R1 ");
SetIndexLabel(2, "R2 ");
SetIndexLabel(3, "R3 ");
SetIndexLabel(4, "S1 ");
SetIndexLabel(5, "S2 ");
SetIndexLabel(6, "S3 ");
return (0);
}
int deinit() {
return (0);
}
int start() {
int li_0 = IndicatorCounted();
double ld_4 = Ask - Bid;
if (li_0 < 0) return (-1);
if (li_0 > 0) li_0 -= 10;
gi_212 = Bars - li_0;
int li_12 = 6;
int li_16 = 3;
if (AutoLevel == FALSE) {
for (gi_208 = 0; gi_208 < gi_212; gi_208++) {
gda_180[gi_208] = iMA(NULL, 0, EMAPeriod, 0, MODE_EMA, PRICE_CLOSE, gi_208);
gda_184[gi_208] = gda_180[gi_208] + NormalizeDouble(LevelR1 * Point, Digits);
gda_188[gi_208] = gda_184[gi_208] + NormalizeDouble(LevelR2 * Point, Digits);
gda_192[gi_208] = gda_188[gi_208] + NormalizeDouble(LevelR3 * Point, Digits);
gda_196[gi_208] = gda_180[gi_208] - NormalizeDouble(LevelS1 * Point, Digits);
gda_200[gi_208] = gda_196[gi_208] - NormalizeDouble(LevelS2 * Point, Digits);
gda_204[gi_208] = gda_200[gi_208] - NormalizeDouble(LevelS3 * Point, Digits);
}
} else {
for (gi_208 = 0; gi_208 < gi_212; gi_208++) {
gd_220 = 0;
gd_228 = 0;
for (gi_216 = CountBarsForAverage; gi_216 > 0; gi_216--) {
gd_220 += MathAbs(iHigh(Symbol(), gi_252, gi_216 + gi_208) - iLow(Symbol(), gi_252, gi_216 + gi_208));
if (gd_228 < MathAbs(iHigh(Symbol(), gi_252, gi_216 + gi_208) - iLow(Symbol(), gi_252, gi_216 + gi_208))) gd_228 = MathAbs(iHigh(Symbol(), gi_252, gi_216 + gi_208) - iLow(Symbol(), gi_252, gi_216 + gi_208));
}
gd_236 = gd_220 / CountBarsForAverage;
gd_132 = gd_236;
gd_140 = gd_132;
gd_148 = gd_132;
gd_156 = gd_132;
gd_164 = gd_132;
gd_172 = gd_132;
gda_180[gi_208] = NormalizeDouble(iMA(NULL, 0, EMAPeriod, 0, MODE_EMA, PRICE_CLOSE, gi_208), Digits);
gda_184[gi_208] = NormalizeDouble(gda_180[gi_208] + gd_132, Digits);
gda_188[gi_208] = gda_184[gi_208] + NormalizeDouble(gd_140, Digits);
gda_192[gi_208] = gda_188[gi_208] + NormalizeDouble(gd_148, Digits);
gda_196[gi_208] = gda_180[gi_208] - NormalizeDouble(gd_156, Digits);
gda_200[gi_208] = gda_196[gi_208] - NormalizeDouble(gd_164, Digits);
gda_204[gi_208] = gda_200[gi_208] - NormalizeDouble(gd_172, Digits);
}
}
return (0);
}