Errors, bugs, questions - page 1718

 
How do I disable Unicode saving in the meta-editor? It needs ANSI.
 
fxsaber:
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.

 
Alexey Da:

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 have several indicators with the same strings
#property indicator_separate_window

#property indicator_plots 1
#property indicator_buffers 1

#property  indicator_type1 DRAW_LINE
#property  indicator_style1 STYLE_SOLID
#property  indicator_color1 clrRed

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

 
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.
 
Alexey Da:

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.

 
Ilyas:
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.

 
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;      // Флаг нового бара
                 
const long            chart_ID=0;        // ID графика 
const string          nname="TrendLine";  // имя линии 
const int             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;                             // Поймался новый бар
     }
  }


//=============================================================================================================
int OnInit()
  {
    
   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                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {  
   ObjectsDeleteAll(0," ",-1,-1);
   Print("------------Работа эксперта завершена!------------"); 
  
  }
//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick()
  {
 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; 
     } 


} 
 //--------------------------------------------------------------------------------


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).

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 ?

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.


ж

 
Alexey Kravchenko:

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.
Reason: