Добрый день! Подскажите новичку, пожалуйста, как правильно получать данные из индикаторов ClusterDelta в свой индикатор в Metatrader 5?
Пробую через iCustom. Из стандартных индикаторов MT данные копируются без проблем, но из ClusterDelta почему-то всегда приходит ноль.
Вот пример кода, который должен отобразить данные по объёму из ClusterDelta_PremiumVolume_4.1 в виде линии:
Код:
#property version "1.00"
#property indicator_separate_window
#property indicator_buffers 1
#property indicator_plots 1
//---- стиль линии
#property indicator_label1 "Volume"
#property indicator_type1 DRAW_LINE
#property indicator_color1 clrRed
#property indicator_style1 STYLE_SOLID
#property indicator_width1 1
//--- Входные данные CD Volume
extern string HELP_URL="http://my.clusterdelta.com/volume";
input string Instrument="AUTO";
input string MetaTrader_GMT="AUTO";
input string Comment_History="--- Premium Settings ";
input int Days_in_History=0;
input datetime Custom_Start_time=D'2017.01.01 00:00';
input datetime Custom_End_time=D'2017.01.01 00:00';
input color Current_Volume=clrRed;
input int Font_Size=8;
//--- буфер
double LineBuffer[];
//--- хэндл
int LineHandle;
int OnInit()
{
//--- Привязка буфера
SetIndexBuffer(0,LineBuffer,INDICATOR_DATA);
ResetLastError();
//--- Получение хэндла
LineHandle=iCustom(NULL,0,"ClusterDelta_PremiumVolume_4.1"
,HELP_URL
,Instrument
,MetaTrader_GMT
,Comment_History
,Days_in_History
,Custom_Start_time
,Custom_End_time
,Current_Volume
,Font_Size
);
//--- Результат запроса хэндла
Print("LineHandle = ",LineHandle," error = ",GetLastError());
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[])
{
//--- копируем значения индикатора в наш индикаторный буфер
int copy = CopyBuffer(LineHandle,0,0,rates_total,LineBuffer);
//--- Результат копирования данных
Print("copy=",copy," | rates_total=",rates_total," | LineBuffer=",LineBuffer[0]);
//--- Если попытка неудачная сообщим об этом
if(copy<=0) Print("Неудачная попытка получить значения индикатора");
return(rates_total);
}
Подскажите, пожалуйста, где ошибка?