Questions from Beginners MQL5 MT5 MetaTrader 5 - page 1551

 
Yuriy Bykov #:

Hello, Alexander.

There must be some reason for such behaviour. It is necessary to put forward hypotheses and test them sequentially. For example:

  • Is there a Russian letter ('s' or 'e') in some of the file names? You can take harsher names like "1.bin"
  • Is this the right data directory? Check if it is opened from the terminal menu or MetaEditor.
  • Does the script consider this particular directory as the current one? Add two commands to the beginning of OnStart(): open a new file with creation and close it. See that it appears in the expected directory
I haven't thought of anything else yet

Yuri, good evening!

Thanks for your advice. I will be more careful now.

My problems were solved with Alexander's help.

Besides, it turned out that it is necessary to close the file in time.

Here is the final fragment of the working code, it may be useful to someone.

   Now = TimeLocal();                                                  // Момент формирования имени для Settings
   TimeToStruct(Now,dt_struct);                                        // Разложение момента формирования
   string mnth = dt_struct.mon;                                        // Месяц, день
   int dyy = dt_struct.day;
   string dy = dt_struct.day;
   if(dyy <= 9)
      dy = "0" + dy;
   string LimPos = MTTESTER::GetValue(Settings,"LimitPosition");                    // LimitPosition считывается
   int PosVert = StringFind(LimPos,"|",0);
   string razn = StringSubstr(LimPos,PosVert,-1);
   StringReplace(LimPos,razn,"");
   string NameSettings = mnth+dy+"-"+LimPos+"-"+DoubleToString(ProfitNew,0)+".set"; // Формируется имя для Settings
   int file_handle=FileOpen("//"+NameSettings,FILE_READ|FILE_WRITE|FILE_CSV|FILE_ANSI);
   FileWriteString(file_handle,Settings+"\r\n");                                    // Записывается строка Settings в песочницу Files
   FileClose(file_handle);                                                          // Закрываем открытый файл, чтобы его можно было дальше перезаписывать

   if(!FileIsExist(NameSettings,0))                                                 // Проверка существования файла
      Print("Нет файла NameSettings!");
   string Path = TerminalInfoString(TERMINAL_DATA_PATH);
   string SrcPath = Path + "\\MQL5\\Files\\" + NameSettings;
   string DstPath = Path + "\\MQL5\\Profiles\\Tester\\" + NameSettings;
   ResetLastError();
   if(!kernel32::CopyFileW(SrcPath,DstPath,false))                                  // Переписываем Settings из песочницы Files в папку Tester
      PrintFormat("Error = %d",GetLastError());                                     // 4009  Неинициализированная строка
 

Again some problems with the demo server... It won't connect...


 
And MT5 for 32-bit Windows is not available at all ?
 
Mikhail Tkachev #:
And MT5 for 32-bit Windows is no longer available at all ?

That's right.

 
Aleksey Vyazmikin #:

That's right.

I need it very much, maybe there is an old version somewhere, I need it for mastering....

 
Please, I need help calculated lot size in grid orders

Example:
Initial range (pips) = 50 pips.
Multi range between orders = 2.
1st buy trade 0.1 lot;
2nd buy trade 0.2 lot opened below 50 pips on a new candle open. The indicators are still aligned;
3rd buy trade 0.4 lot opened below 100 pips on a new candle open. The indicators are still aligned;
      buy trade 0.8 lot skipped below 200 pips - The indicators NOT aligned;
      buy trade 1.6 lot skipped below 400 pips - The indicators NOT aligned;
4th buy trade 3.2 lot opened below 800 pips on a new candle open. The indicators are still aligned;

      buy trade 6.4 lot skipped below 1600 pips - The indicators NOT aligned;
5th buy trade calculated lot opened below 6400 pips on a new candle open. The indicators are still aligned;

please help me to create a formula for calculating the lot of the order, my brain is already broken

thanks

 
Mikhail Tkachev #:

Very necessary, maybe there is an old version somewhere, I need to learn....

Posted here

 
Mikhail Tkachev #:

Very necessary, maybe there is an old version somewhere, I need to learn....

The old version will not work with modern servers.

I switched from WXP to Linux a few years ago because of this.

 
Aleksey Vyazmikin #:

I posted it here

And here

 
Maybe someone has met a balance indicator that is based on a certain majic ?