Здравствуйте! Подскажите пожалуйста, в чем проблема? Есть индикатор Аллигатор. По вверх синей линии хочу создать еще одну линию, но другого цвета и с большей толщиной. Но получается какая-то вот такая дребедень(Прикрепил во вложения). Код следующий:
//+------------------------------------------------------------------+//| MA_Test.mq5 |//| copyright "2009, MetaQuotes Software Corp." |//| https://www.mql5.com |//+------------------------------------------------------------------+
#property copyright "2009, MetaQuotes Software Corp."
#property link"https://www.mql5.com"#property version"1.00"#property indicator_chart_window#property indicator_plots4#property indicator_buffers8#property indicator_type1DRAW_COLOR_LINE#property indicator_color1clrBlue#property indicator_width11#property indicator_label1"Jaws"#property indicator_type2DRAW_COLOR_LINE#property indicator_color2clrRed#property indicator_width21#property indicator_label2"Teeth"#property indicator_type3DRAW_COLOR_LINE#property indicator_color3clrLime#property indicator_width31#property indicator_label3"Lips"#property indicator_type4DRAW_COLOR_LINE#property indicator_color4clrAqua#property indicator_width43#property indicator_label4"BuyCross"double ExtJaws[];
double ExtColorJaws[];
double ExtTeeth[];
double ExtColorTeeth[];
double ExtLips[];
double ExtColorLips[];
double ExtBuyCr[];
double ExtClrBuyCr[];
//---- input parametersinputint InpJawsPeriod=13; // Jaws periodinputint InpJawsShift=8; // Jaws shiftinputint InpTeethPeriod=8; // Teeth periodinputint InpTeethShift=5; // Teeth shiftinputint InpLipsPeriod=5; // Lips periodinputint InpLipsShift=3; // Lips shiftinputENUM_MA_METHOD InpMAMethod=MODE_SMMA; // Moving average methodinputENUM_APPLIED_PRICE InpAppliedPrice=PRICE_MEDIAN; // Applied price//---- indicator buffers//---- handles for moving averagesint ExtJawsHandle;
int ExtTeethHandle;
int ExtLipsHandle;
int ExtBuyCRHandle;
//--- bars minimum for calculationint ExtBarsMinimum;
//+------------------------------------------------------------------+//| Custom indicator initialization function |//+------------------------------------------------------------------+intOnInit()
{
SetIndexBuffer(0,ExtJaws,INDICATOR_DATA);
SetIndexBuffer(1,ExtColorJaws,INDICATOR_COLOR_INDEX);
SetIndexBuffer(2,ExtTeeth,INDICATOR_DATA);
SetIndexBuffer(3,ExtColorTeeth,INDICATOR_COLOR_INDEX);
SetIndexBuffer(4,ExtLips,INDICATOR_DATA);
SetIndexBuffer(5,ExtColorLips,INDICATOR_COLOR_INDEX);
SetIndexBuffer(6,ExtBuyCr,INDICATOR_DATA);
SetIndexBuffer(7,ExtClrBuyCr,INDICATOR_COLOR_INDEX);
//--- indicator buffers mapping//--- set accuracyIndicatorSetInteger(INDICATOR_DIGITS,_Digits);
//---- sets first bar from what index will be drawnPlotIndexSetInteger(0,PLOT_DRAW_BEGIN,InpJawsPeriod-1);
PlotIndexSetInteger(1,PLOT_DRAW_BEGIN,InpTeethPeriod-1);
PlotIndexSetInteger(2,PLOT_DRAW_BEGIN,InpLipsPeriod-1);
PlotIndexSetInteger(3,PLOT_DRAW_BEGIN,InpJawsPeriod-1);
//---- line shifts when drawingPlotIndexSetInteger(0,PLOT_SHIFT,InpJawsShift);
PlotIndexSetInteger(1,PLOT_SHIFT,InpTeethShift);
PlotIndexSetInteger(2,PLOT_SHIFT,InpLipsShift);
PlotIndexSetInteger(3,PLOT_SHIFT,InpJawsShift);
//---- name for DataWindowPlotIndexSetString(0,PLOT_LABEL,"Jaws("+string(InpJawsPeriod)+")");
PlotIndexSetString(1,PLOT_LABEL,"Teeth("+string(InpTeethPeriod)+")");
PlotIndexSetString(2,PLOT_LABEL,"Lips("+string(InpLipsPeriod)+")");
PlotIndexSetString(3,PLOT_LABEL,"Buy Cross("+string(InpJawsPeriod)+")");
//--- get MA's handles
ExtJawsHandle=iMA(NULL,0,InpJawsPeriod,0,InpMAMethod,InpAppliedPrice);
ExtTeethHandle=iMA(NULL,0,InpTeethPeriod,0,InpMAMethod,InpAppliedPrice);
ExtLipsHandle=iMA(NULL,0,InpLipsPeriod,0,InpMAMethod,InpAppliedPrice);
ExtBuyCRHandle=iMA(NULL,0,InpJawsPeriod,0,InpMAMethod,InpAppliedPrice);
ExtBarsMinimum=InpJawsPeriod+InpJawsShift;
if(ExtBarsMinimum<(InpTeethPeriod+InpTeethShift))
ExtBarsMinimum=InpTeethPeriod+InpTeethShift;
if(ExtBarsMinimum<(InpLipsPeriod+InpLipsPeriod))
ExtBarsMinimum=InpLipsPeriod+InpLipsPeriod;
//---return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+//| Custom indicator iteration function |//+------------------------------------------------------------------+intOnCalculate(constint rates_total,
constint prev_calculated,
constdatetime &time[],
constdouble &open[],
constdouble &high[],
constdouble &low[],
constdouble &close[],
constlong &tick_volume[],
constlong &volume[],
constint &spread[])
{
//---//--- check for rates totalif(rates_total<ExtBarsMinimum)
return(0); // not enough bars for calculation//--- not all data may be calculatedint calculated=BarsCalculated(ExtJawsHandle);
if(calculated<rates_total)
{
Print("Not all data of ExtJawsHandle is calculated (",calculated,"bars ). Error",GetLastError());
return(0);
}
calculated=BarsCalculated(ExtTeethHandle);
if(calculated<rates_total)
{
Print("Not all data of ExtTeethHandle is calculated (",calculated,"bars ). Error",GetLastError());
return(0);
}
calculated=BarsCalculated(ExtLipsHandle);
if(calculated<rates_total)
{
Print("Not all data of ExtLipsHandle is calculated (",calculated,"bars ). Error",GetLastError());
return(0);
}
calculated=BarsCalculated(ExtBuyCRHandle);
if(calculated<rates_total)
{
Print("Not all data of ExtBuyCRHandle is calculated (",calculated,"bars ). Error",GetLastError());
return(0);
}
//--- we can copy not all dataint to_copy;
if(prev_calculated>rates_total || prev_calculated<0) to_copy=rates_total;
else
{
to_copy=rates_total-prev_calculated;
if(prev_calculated>0) to_copy++;
}
//---- get ma buffersif(CopyBuffer(ExtJawsHandle,0,0,to_copy,ExtJaws)<=0)
{
Print("getting ExtJawsHandle is failed! Error",GetLastError());
return(0);
}
if(CopyBuffer(ExtTeethHandle,0,0,to_copy,ExtTeeth)<=0)
{
Print("getting ExtTeethHandle is failed! Error",GetLastError());
return(0);
}
if(CopyBuffer(ExtLipsHandle,0,0,to_copy,ExtLips)<=0)
{
Print("getting ExtLipsHandle is failed! Error",GetLastError());
return(0);
}
//New MAif(CopyBuffer(ExtJawsHandle,0,0,to_copy,ExtClrBuyCr)<=0)
{
Print("getting ExtBuyCRHandle is failed! Error",GetLastError());
return(0);
}
//--- return value of prev_calculated for next callreturn(rates_total);
}
//+------------------------------------------------------------------+
Для авторизации и пользования сайтом MQL5.com необходимо разрешить использование файлов Сookie.
Пожалуйста, включите в вашем браузере данную настройку, иначе вы не сможете авторизоваться.
Вы вошли в аккаунт. Двухфакторная аутентификация отключена. Настройте её заново и отсканируйте новый QR-код или продолжите с отключённой двухфакторной аутентификацией.
Поставите курсор внутрь круглых скобок и нажмите ctrl+shift+пробел. Всë и увидите. Ну, или нажмите F1 на функции.
Спасибо
подскажите почему получение спреда настолько дольше ask или bid?
Test_1()] = 77 mсs
Test_2()] = 76 mсs
Test_4()] = 7716 mсs
коллеги помогите индик чтобы поддавался iCustom во вложении - такие значения надо чтобы принтовал с робота типа 205682
а он печатает (выдает через робота), 10, 11, какие то номера баров чтоли...???
красные линии это что он выдает (не правильно), зеленые стрелки это правильно то что надо чтобы он выдавал
вот обращение к iCustom
с робота
В чем может быть проблема?
коллеги помогите
В чем может быть проблема?
Но я же ее и создал специально, чтобы она отрисовывалась также, как и синяя линия аллигатора. Тогда на что ее изменить, чтобы не потерялся смысл?
Что линия цвета Аква была такая же, как и синяя?
Но я же ее и создал специально, чтобы она отрисовывалась также, как и синяя линия аллигатора. Тогда на что ее изменить, чтобы не потерялся смысл?
Что линия цвета Аква была такая же, как и синяя?
Вы не то буфер прописали.
Вы не то буфер прописали.
Увидел! Спасибо огромное!
пока все равно пишет 10 11 12