Вы упускаете торговые возможности:
- Бесплатные приложения для трейдинга
- 8 000+ сигналов для копирования
- Экономические новости для анализа финансовых рынков
Регистрация
Вход
Вы принимаете политику сайта и условия использования
Если у вас нет учетной записи, зарегистрируйтесь
Помогите, пожалуйста, поправить индикатор, вычисляющий в пунктах средний диапазон баров по всей истории (сам код был любезно выложен на этом форуме Yuri):
#property indicator_separate_window
#property indicator_buffers 1
#property indicator_color1 Red
//---- buffers
double AverRange=0.0;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
SetIndexStyle(0,DRAW_LINE,1);
SetIndexBuffer(0,AverRange);
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
int counted_bars=IndicatorCounted();
if(counted_bars<0) return(-1);
//---- last counted bar will be recounted
if(counted_bars>0) counted_bars--;
int limit=Bars-counted_bars;
int bars = Bars; //расчётное количество баров
int i, b=0, s=0;
for (i=bars; i>0; i--)
{
s+=(High[i]-Low[i])/Point;
b++;
}
AverRange = s/b;
//----
return(0);
}
//+------------------------------------------------------------------+
Заранее благодарен!