- Помогите бесплатно переделать индикатор с открытым кодом из МТ5 в МТ4
- Робот из МТ4 на МТ5
- Любые вопросы новичков по MQL4 и MQL5, помощь и обсуждение по алгоритмам и кодам
Начал потихоньку править сам вышеуказанный индикатор.
При компиляции ругается "'IntegerToString' - wrong parameters count cm_ind_candle_Signal.mq5 36 58"
SetIndexBuffer(2, BufCol, INDICATOR_COLOR_INDEX); SetIndexBuffer(2, BufCol, INDICATOR_COLOR_INDEX);
?
При компиляции ругается "'IntegerToString' - wrong parameters count cm_ind_candle_Signal.mq5 36 58"
Читаем что означает эта функция и какие параметры у нее должны быть https://www.mql5.com/ru/docs/convert/integertostring
- www.mql5.com
?
//+------------+-----------------------------------------------------+ //| v.1.10.20 | ArrZZx2.mq5 | //+------------+ Изменёння версия индикатора ArrZZx2.mq5 (автор | //|------------| индикатора ArrZZx2.mq4 Юзефович Андрей Георгиевич) | //| | ( автор скончался) | //+------------+-----------------------------------------------------+ #property copyright " Изменёння версия индикатора ArrZZx2.mq4 под МТ5 " #property link "http://www.goga342@yandex.ru" #property indicator_chart_window #property indicator_buffers 8 #property indicator_plots 1 #property indicator_color1 Yellow #property indicator_type1 DRAW_ARROW #property indicator_color2 RoyalBlue #property indicator_type2 DRAW_ARROW #property indicator_color3 Blue #property indicator_type3 DRAW_ARROW #property indicator_color4 Blue #property indicator_type4 DRAW_ARROW #property indicator_color5 Blue #property indicator_type5 DRAW_ARROW #property indicator_color6 Red #property indicator_type6 DRAW_ARROW #property indicator_color7 Blue #property indicator_type7 DRAW_ARROW #property indicator_color8 Red #property indicator_type8 DRAW_ARROW //#define SH_BUY 1// справочник mql5 //#define SH_SELL -1// справочник mql5 //---- indicator parameters extern int SR = 3; extern int SRZZ = 12; extern int MainRZZ = 20; extern int FP = 21; extern int SMF = 3; extern int PriceConst = 0; extern bool alertsOn = false; extern bool alertsOnCurrent = false; extern bool alertsMessage = true; extern bool alertsSound = false; extern bool alertsNotify = false; extern bool alertsEmail = false; extern bool DrawZZ = false; extern bool First = true; // int LTF[6] = { 0,0,0,0,0,0 }; int STF[5] = { 0,0,0,0,0 }; int MaxBar, nSBZZ, nLBZZ, SBZZ, LBZZ; int prevBars=0,MainCalculation,IndicatorCounted; int whichBar; //---- indicator buffers double Lmt[]; double LZZ[]; double SA[]; double SM[]; double Up[]; double Dn[]; double pUp[]; double pDn[]; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ void OnInit() { // SetIndexBuffer(0,Lmt);SetIndexStyle(0,DRAW_ARROW,EMPTY,2);SetIndexArrow(0,251); SetIndexEmptyValue(0,0.0); SetIndexBuffer(0, Lmt, INDICATOR_DATA); PlotIndexSetInteger(0,PLOT_COLOR_INDEXES,2);PlotIndexSetInteger(0, PLOT_ARROW, 251); PlotIndexSetDouble(DRAW_NONE,PLOT_EMPTY_VALUE, EMPTY_VALUE);//Устанавливает значение пустой величины для линии индикатора. // SetIndexBuffer(1,LZZ); SetIndexBuffer(1, LZZ, INDICATOR_DATA); // SetIndexBuffer(2,SA); SetIndexBuffer(2, SA, INDICATOR_DATA); // SetIndexStyle(2,DRAW_NONE); PlotIndexSetInteger(2,PLOT_COLOR_INDEXES,0,DRAW_NONE); // SetIndexBuffer(3,SM); SetIndexStyle(3,DRAW_NONE); SetIndexBuffer(3,SM);PlotIndexSetInteger(3,PLOT_COLOR_INDEXES,0,DRAW_NONE); // SetIndexBuffer(4,Up); SetIndexStyle(4,DRAW_ARROW,EMPTY,1); SetIndexArrow(4,233); SetIndexEmptyValue(4,0.0); SetIndexLabel(4,"trend UP"); SetIndexBuffer(4,Up);PlotIndexSetInteger(4,PLOT_COLOR_INDEXES,1);PlotIndexSetInteger(4, PLOT_ARROW, 233);PlotIndexSetDouble(DRAW_NONE,PLOT_EMPTY_VALUE, EMPTY_VALUE);PlotIndexSetString(4,PLOT_LABEL,"trend UP"); // SetIndexBuffer(5,Dn); SetIndexStyle(5,DRAW_ARROW,EMPTY,1); SetIndexArrow(5,234); SetIndexEmptyValue(5,0.0); SetIndexLabel(5,"trend DOWN"); SetIndexBuffer(5,Dn);PlotIndexSetInteger(5,PLOT_COLOR_INDEXES,1);PlotIndexSetInteger(5, PLOT_ARROW, 234);PlotIndexSetDouble(DRAW_NONE,PLOT_EMPTY_VALUE, EMPTY_VALUE);PlotIndexSetString(4,PLOT_LABEL,"trend Dn"); // SetIndexBuffer(6,pUp); SetIndexStyle(6,DRAW_ARROW); SetIndexArrow(6,217); SetIndexEmptyValue(6,0.0); SetIndexBuffer(6,pUp);PlotIndexSetInteger(6,PLOT_COLOR_INDEXES,1);PlotIndexSetInteger(6, PLOT_ARROW, 217);PlotIndexSetDouble(DRAW_NONE,PLOT_EMPTY_VALUE, EMPTY_VALUE); // SetIndexBuffer(7,pDn); SetIndexStyle(7,DRAW_ARROW);SetIndexArrow(7,218); SetIndexEmptyValue(7,0.0); SetIndexBuffer(7,pDn);PlotIndexSetInteger(7,PLOT_COLOR_INDEXES,1);PlotIndexSetInteger(7, PLOT_ARROW, 218);PlotIndexSetDouble(DRAW_NONE,PLOT_EMPTY_VALUE, EMPTY_VALUE);
После компиляции выдаёт
';' - unexpected end of program ARRZZX2.mq5 84 173 '{' - unbalanced parentheses ARRZZX2.mq5 65 1
Появился ещ1ё один вопрос.
Допустим у оригинала (индикатор на mql4) есть строки
SetIndexEmptyValue(0,0.0);................SetIndexEmptyValue(4,0.0);команду( на mql4 ) SetIndexEmptyValue я заменил на команду mql5 PlotIndexSetDouble
PlotIndexSetDouble(DRAW_NONE,PLOT_EMPTY_VALUE, EMPTY_VALUE);
Вопрос? что делать с параметрами команды SetIndexEmptyValue если данная команда у меня повторяется N количество раз и меняется только 1 параметр
Читаем что означает эта функция и какие параметры у нее должны быть https://www.mql5.com/ru/docs/convert/integertostring
спасибо
спасибо
PlotIndexSetDouble(0,PLOT_EMPTY_VALUE, 0.0);.....................PlotIndexSetDouble(5,PLOT_EMPTY_VALUE, 0.0);
Вот что у меня получилось.
При компиляции 2 блока
int OnCalculate(const int rates_total,
const int prev_calculated,
const datetime &time[],
const double &open[],
const double &High[],
constdouble &Low[],
const double &Close[],
const long &tick_volume[],
const long &volume[],
const int &spread[])
{
int counted_bars=IndicatorCounted();
if(counted_bars<0) return(-1);
if(counted_bars>0) counted_bars--;
if(First==true)
{
if(SR<2) SR=2;
if(Bars<=2*(MainRZZ+FP+SR+2)) return(-1);
if(SRZZ<=SR) SRZZ=SR+1;
MaxBar = Bars -(MainRZZ+FP+SR+2);
LBZZ = MaxBar;
SBZZ = LBZZ;
prevBars=Bars;
First=false;
}
if(prevBars!=Bars)
{
SBZZ = Bars - nSBZZ;
LBZZ = Bars - nLBZZ;
prevBars= Bars;
}
if (alertsOn)
{
if (alertsOnCurrent)
int whichBar = 0;
else whichBar = 1;
static string type1 = "";
static datetime time1 = 0;
if (Up[whichBar] > 0) Alert(type1,time1, " trend changeed to UP");
if (Dn[whichBar] > 0) Alert(type1,time1, " trend changeed ro DOWN");
static string type2 = "";
static datetime time2 = 0;
if (Lmt[whichBar]!= 0) Alert(type2,time2, " Exit");
}
}
ругается на: int counted_bars=IndicatorCounted();
')' - expression expected ARRZZX2.mq5 113 38
а также ругается на математические знаки и многое другое:
'<=' - open parenthesis expected ARRZZX2.mq5 121 14 '-' - open parenthesis expected ARRZZX2.mq5 123 24 ';' - open parenthesis expected ARRZZX2.mq5 126 23 ')' - open parenthesis expected ARRZZX2.mq5 130 22 '-' - open parenthesis expected ARRZZX2.mq5 132 25 '-' - open parenthesis expected ARRZZX2.mq5 133 25 ';' - open parenthesis expected ARRZZX2.mq5 134 24 declaration of 'whichBar' hides global variable ARRZZX2.mq5 140 14 see previous declaration of 'whichBar' ARRZZX2.mq5 51 5
Люди "пините" меня в нужном направлении, я что то не вижу ошибок. всё сам подправлю.
- Бесплатные приложения для трейдинга
- 8 000+ сигналов для копирования
- Экономические новости для анализа финансовых рынков
Вы принимаете политику сайта и условия использования