Здравствуйте! компилируйте код
#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 Lime
#property indicator_color2 Red
extern int length = 20;
extern double deviation = 0.5;
double support[];
double resistance[];
void calculateLevels() {
int limit = Bars - length;
ArrayResize(support, limit);
ArrayResize(resistance, limit);
for (int i = 0; i < limit; i++) {
double lowestLow = Low;
double highestHigh = High;
for (int j = i; j < i + length; j++) {
if (Low[j] < lowestLow) {
lowestLow = Low[j];
}
if (High[j] > highestHigh) {
highestHigh = High[j];
}
}
support = lowestLow - deviation * iStdDev(NULL, 0, length, i);
resistance = highestHigh + deviation * iStdDev(NULL, 0, length, i);
}
}
int OnInit() {
calculateLevels();
return(INIT_SUCCEEDED);
}
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[]) {
calculateLevels();
return(rates_total);
}
void OnDeinit(const int reason) {
ArrayFree(support);
ArrayFree(resistance);
}
int start() {
for (int i = 0; i < Bars - length; i++) {
SetIndexBuffer(0, support);
SetIndexBuffer(1, resistance);
PlotIndexSetDouble(0, PLOT_EMPTY_VALUE, 0);
PlotIndexSetDouble(1, PLOT_EMPTY_VALUE, 0);
}
return(0);
}