Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 1241

 
igrok333:
it took the price before when the ask was still old,
and then only refreshrates changed the ask, right?

yes

the code execution logic is linear - a command is executed, changes are made, then the next command is executed

so it's the same in your code, you made an assignment, and the price update is already below the code

do a cena calculation in the loop and update quotes.... before the calculation don't forget to normalize cena if it's a calculation, otherwise your next question will be why it's not working now)))

 
Igor Makanu:

yes

the code execution logic is linear - a command is executed, changes are made, then the next command is executed

so it's the same in your code, you made an assignment, and the price update is already below the code

do a cena calculation in the loop and update quotes.... before the calculation don't forget to normalize cena if it's a calculation, otherwise your next question will be why it's not working now)))


now it is clear how to check.

double cena=Ask;

for (int i=0; i<=10; i++)
   {
   RefreshRates();   
   Alert(cena);
   Sleep(3000);
   }

and

for (int i=0; i<=10; i++)
   {   
   RefreshRates();   
   double cena=Ask;
   Alert(cena);
   Sleep(3000);
   }
 
Hello. There is a WinApi folder in the standard library. It would be good if the MQL5 Reference appeared with the description of its contents. In the meantime, could you suggest a method to read and write the field of the forward-optimization start date in the tester? Or maybe even add a new proportion like 1/5?
 
Good Beer:
Hello. There is a WinApi folder in the standard library. It would be good if the MQL5 Reference has the description of its contents. In the meantime, could you suggest a method to read and write the field of the forward-optimization start date in the tester? Or maybe even add a new proportion like 1/5?

It has nothing to do with mql.

https://docs.microsoft.com/en-us/windows/win32/apiindex/windows-api-list

Good luck.

Windows API index - Win32 apps
  • 2018.05.31
  • GrantMeStrength
  • docs.microsoft.com
A list of the reference content for the Windows API.
 
Good Beer:
isn't there a method there to read and write the forward start date field in the tester?

I won't say how it is in a five, it's like that in a four:

extern datetime dtDateBegin   = D'2008.12.01';
extern datetime dtDateEnd     = D'2009.01.01';

#import "user32.dll"
   int SendMessageA(int hWnd, int Msg, int wParam, int lParam[]);
   int GetAncestor(int hWnd, int gaFlags);
   int GetDlgItem(int hDlg, int nIDDlgItem);
   int FindWindowExA(int hWndParent, int hWndChildAfter, string lpszClass, string lpszWindow);
#import

#define  DTM_SETSYSTEMTIME      0x1002

void start()
{
   int hTerminalWnd, hTesterWnd, hDateTimeBegin, rglSysTime[4];
   
// определяем системный дескриптор окна тестера
   
   hTerminalWnd = GetAncestor(WindowHandle(Symbol(), Period()) ,2);
   hTesterWnd = GetDlgItem(hTerminalWnd, 0xE81E);
   hTesterWnd = GetDlgItem(hTesterWnd, 0x53);
   hTesterWnd = GetDlgItem(hTesterWnd, 0x81BF);

// устанавливаем дату начала  оптимизации\тестирования

   hDateTimeBegin = FindWindowExA(hTesterWnd, GetDlgItem(hTesterWnd, 0x3FF), "SysDateTimePick32", "");
   ArrayInitialize(rglSysTime, 0);
   
   rglSysTime[0] = (TimeMonth(dtDateBegin) << 16) | TimeYear(dtDateBegin);
   rglSysTime[1] = (TimeDay(dtDateBegin)   << 16) | TimeDayOfWeek(dtDateBegin);
   
   SendMessageA(hDateTimeBegin, DTM_SETSYSTEMTIME, 0, rglSysTime);
}
 

Why none of the provided examples of ready code from mql4 tutorial compiles?

I tried to write something and faced with the fact that the OnTick function switches to .mqh function, but other .mqh functions are called from this function and the compiler doesn't see them and I don't understand how to do it. I have downloaded the ready codes used in the tutorial and even they don't work. I was afraid that my program no no no yes appears 5-7 errors, but when I ran the downloaded from the official library so there a hell of a lot... 60-80-90 errors. Compiled without errors only file Variables.mqh, everything else burns brightly. Where is the actual material on this language? All these video tutorials, how old are they? It doesn't work, just what it says - do it and you will get results.

Документация по MQL5: Основы языка / Функции / Функции обработки событий
Документация по MQL5: Основы языка / Функции / Функции обработки событий
  • www.mql5.com
В языке MQL5 предусмотрена обработка некоторых предопределенных событий. Функции для обработки этих событий должны быть определены в программе MQL5: имя функции, тип возвращаемого значения, состав параметров (если они есть) и их типы должны строго соответствовать описанию функции-обработчика события. Именно по типу возвращаемого значения и по...
 
Denis Diakonov:

Why none of the provided examples of ready code from mql4 tutorial compiles?

I tried to write something and faced with the fact that the OnTick function switches to .mqh function, but other .mqh functions are called from this function and the compiler doesn't see them and I don't understand how to do it. I have downloaded the ready codes used in the tutorial and even they don't work. I was afraid that my program no no no yes appears 5-7 errors, but when I ran the downloaded from the official library so there a hell of a lot... 60-80-90 errors. Compiled without errors only file Variables.mqh, everything else burns brightly. Where is the actual material on this language? All those video tutorials are from when? It doesn't work, just what it says - do it and you'll get results.

Honestly, it's a stream of consciousness :)

And no specifics.

 
how to log in
 
Artyom Trishkin:

Stream of consciousness to be honest :)

And no specifics.

A copy from another thread.


Please advise. I have user-defined functions in separate .mqh files and I have them written through #include. When start is changed to one function, then program needs to call another .mqh file (for example, to get a value of order volume) and it's not working. If I write everything in one sheet, it works or if I write the formula to calculate the lot directly in the order opening parameters. I looked through the MQL4 lessons and read the program documentation but did not find anything. I don't really understand why one .mqh function cannot interact with another .mqh function within calculations. Or, should we make the program return to start if we faced such a necessity - it would return the result to start and then start with this calculation would go back to the function opening an .mqh order? This is something rubbish... Or maybe we should somehow declare all of the existing functions in a different way so that they interact together? Thanks

 
Artyom Trishkin:

Stream of consciousness to be honest :)

And no specifics.

It's not a stream, it's a drain.

Reason: