fxsaber: I have several indicators contain the same strings
Decided to put them in mqh and link them to "save". It turns out that this cannot be done - #property can be set only in source mq5-file.
Why such a restriction?
In fact, these properties are properties of an MQL indicator project.
At the moment, the project file of an MQL program is the *.mq5(4) source file. In addition, users can use third-party *.mqh files that may contain these properties.
Karputov Vladimir: When we have an example, we will combine everything in one post: problem, example, data of operating system and terminal.
Done ! I'm under Win764bit now, but the problem is the same. In realtime everything is as it should be, but in the tester in the visualization the left point of the line sticks firmly and the right one moves.
datetime prevtime=0,
time_last_bar[1]={0};
bool New_Bar=false; // Флаг нового бараconstlong chart_ID=0; // ID графика conststring nname="TrendLine"; // имя линии constint sub_window=0; // номер подокна datetime time1=0; // время первой точки double price1=0; // цена первой точки datetime time2=0; // время второй точки double price2=0; // цена второй точки datetime prevbar=0;
double cclose[];
datetime ttime[];
//--------------------------------------------------------------------void Fun_New_Bar() // Ф-ия обнаружения ..
{ // .. нового бара
New_Bar=false; // Нового бара нетCopyTime(Symbol(),Period(),0,1,time_last_bar);
if(time_last_bar[0] != prevtime) // Сравниваем время
{
prevtime = time_last_bar[0]; // Теперь время такое
New_Bar=true; // Поймался новый бар
}
}
//=============================================================================================================intOnInit()
{
CopyTime(Symbol(),Period(),0,1,time_last_bar);
prevtime = time_last_bar[0];
ArraySetAsSeries(cclose,true);
ArraySetAsSeries(ttime,true);
ArrayResize(cclose,5);
ArrayResize(ttime,5);
return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+//| Expert deinitialization function |//+------------------------------------------------------------------+voidOnDeinit(constint reason)
{
ObjectsDeleteAll(0," ",-1,-1);
Print("------------Работа эксперта завершена!------------");
}
//+------------------------------------------------------------------+//| Expert tick function |//+------------------------------------------------------------------+voidOnTick()
{
Fun_New_Bar(); // Обращение к ф-ииif (New_Bar==false) // Если бар не новый..return; // ..то уходимPrint("новый бар !");
ObjectsDeleteAll(0," ",-1,-1);
ArrayInitialize(cclose,0);
ArrayInitialize(ttime,0);
CopyTime(Symbol(),0,1,2,ttime);
CopyClose(Symbol(),0,1,2,cclose);
price1=cclose[1];
time1=ttime[1];
price2=cclose[0];
time2=ttime[0];
Print("price1=",price1," time1=",time1," price2=",price2," time2=",time2);
//--- создадим трендовую линию по заданным координатам if(!ObjectCreate(chart_ID,nname,OBJ_TREND,sub_window,time1,price1,time2,price2))
{
Print(__FUNCTION__,
": не удалось создать линию тренда! Код ошибки = ",GetLastError());
return;
}
}
//--------------------------------------------------------------------------------
I draw a normal TrendLine between close points of two previous bars (on each new bar).
ObjectsDeleteAll(0," ",-1,-1);
ArrayInitialize(cclose,0);
ArrayInitialize(ttime,0);
CopyTime(Symbol(),0,1,2,ttime);
CopyClose(Symbol(),0,1,2,cclose);
price1=cclose[1];
time1=ttime[1];
price2=cclose[0];
time2=ttime[0];
Print("price1=",price1," time1=",time1," price2=",price2," time2=",time2);
//--- создадим трендовую линию по заданным координатам if(!ObjectCreate(chart_ID,nname,OBJ_TREND,sub_window,time1,price1,time2,price2))
{
Print(__FUNCTION__,
": не удалось создать линию тренда! Код ошибки = ",GetLastError());
return;
}
Everything works fine in realtime. But in the visualization mode in the tester, the left point of the line is attached to the start of the reference and does not move at all. What is the problem ?
ZY. In any case, okrozme those manipulations that I gave above, nothing else is done. When a new bar is detected, everything is erased and a new line is drawn. But a complete example to compile I will do.
Done ! I'm under Win764bit now, but the problem is the same. In realtime everything is as it should be, but in the tester in the visualization the left point of the line sticks firmly and the right one moves.
Acknowledgement. There's some nastiness in the tester.
How do I disable Unicode saving in the meta-editor? It needs ANSI.
Why this need?
The editor automatically saves files in Unicode if the text contains characters from the 128-255 range.
Why this need?
The editor automatically saves files in Unicode if the text has characters in the 128-255 range.
I have all files now twice as big. I save them in notepad in ANSI - ok. I open in meta editor after that and save - unicode again.
Try opening and saving this attached file.
I decided to put them in mqh and link them to "save". It turns out that this cannot be done - #property can be set only in source mq5-file.
Why such a restriction?
I can't attach attachments in private messages.
At least ex4 of 4.9 Mb
I have several indicators contain the same strings
Decided to put them in mqh and link them to "save". It turns out that this cannot be done - #property can be set only in source mq5-file.
Why such a restriction?
At the moment, the project file of an MQL program is the *.mq5(4) source file.
In addition, users can use third-party *.mqh files that may contain these properties.
Why this need?
The editor automatically saves files in Unicode if the text contains characters from the 128-255 range.
This is something new. Why not take the encoding for single-byte characters from the system settings? This has been the default until now.
Again, an option could be made so that those who need it could enable the two-byte format.
In addition, users can use third-party *.mqh files, which may contain these properties.
It is possible to set them in mqh, but they will not be read as if they do not exist.
When we have an example, we will combine everything in one post: problem, example, data of operating system and terminal.
Done ! I'm under Win764bit now, but the problem is the same. In realtime everything is as it should be, but in the tester in the visualization the left point of the line sticks firmly and the right one moves.
Forum on trading, automated trading systems and strategy testing
Bugs, bugs, questions
Alexey Kravchenko, 2016.10.04 09:09
Hello !
I have a problem that I don't understand.
I draw a normal TrendLine between close points of two previous bars (on each new bar).
Everything works fine in realtime. But in the visualization mode in the tester, the left point of the line is attached to the start of the reference and does not move at all. What is the problem ?
Z.U. I don't seem to have this problem with MT4.
Forum on trading, automated trading systems and strategy testing
Bugs, bugs, questions
Alexey Kravchenko, 2016.10.04 09:57
There's a problem with the example. There bolt shell itself takes several files. I'll make a simpler one in the evening when I get home.
WinXP SP3. Build 1434
LE 0 14:55:39.873 Terminal MetaTrader 5 build 1434 started (MetaQuotes Software Corp.)
DI 0 14:55:39.889 Terminal Microsoft Windows XP (X86 based PC), IE 08.00, Intel Pentium Dual E2200 @ 2.20GHz, RAM: 1150 / 2037 Mb, HDD: 74562 / 152625 Mb, GMT+07:00
LJ 0 14:55:39.889 Terminal C:\Program Files\MetaTrader 5
ZY. In any case, okrozme those manipulations that I gave above, nothing else is done. When a new bar is detected, everything is erased and a new line is drawn. But a complete example to compile I will do.
ж
Done ! I'm under Win764bit now, but the problem is the same. In realtime everything is as it should be, but in the tester in the visualization the left point of the line sticks firmly and the right one moves.