Questions from a "dummy" - page 94

 
sergeev:
in pixels
that's clear, but how do you get those pixels?
 
sergey1294:
I see, but how do I get these pixels?
#import "user32.dll"
        bool GetWindowRect(int h, int& pos[4]);
#import
//------------------------------------------------------------------ GetPixLength
double GetPixLength(datetime dt, double dp) // db - distance by X (time) dp - distance by Y (price)
{
        int hWnd=WindowHandle(Symbol(), Period());
        int rect[4]; GetWindowRect(hWnd, rect); // take pixel size
        double wW=rect[2]-rect[0]; double wH=rect[3]-rect[1]; // take height and width in pixel
        double H=(WindowPriceMax()-WindowPriceMin()); double W=WindowBarsPerChart(); // translate to chart
        double lengthW=wW/W*MathAbs(dt); // width in pix; wW/W = 1 bar in pix
        double lengthH=wH/H*MathAbs(dp); // height in pix; wH/H = 1 point in pix
        return(MathSqrt(MathPow(lengthW, 2)+MathPow(lengthH, 2)));
}

This code is for MQL4.

I think you can easily transfer it to MQL5

 
sergeev:

This code is for MQL4.

I think you can easily transfer it to MQL5

Thank you, I need it for MQL4
 
Please advise, in my EA, the indicator updates the value in the tester only with a new bar, that is, if the expert is running on the hourly chart - it will be updated once an hour, on the minute - once a minute. The Expert Advisor works through the onTimer function, the timer is set for 10 seconds. What may be the problem? I want it to update by timer. The iMA indicator
Документация по MQL5: Технические индикаторы / iMA
Документация по MQL5: Технические индикаторы / iMA
  • www.mql5.com
Технические индикаторы / iMA - Документация по MQL5
 

Can you please tell me what's wrong.

In the main loop of indicator calculation, where buffer[]is indicator buffer, there is a loop (code lines 3-6). If this cycle is present, the indicator values are not calculated, but if it is absent, they are calculated.

1 for(bar = first; bar < rates_total; bar++)
2 {
3 for(int j=0;j<10;j++)
4 {
5 array[j]=price[bar];
6 }
7 buffer[bar] = 2;
8 }

Документация по MQL5: Основы языка / Функции / Функции обработки событий
Документация по MQL5: Основы языка / Функции / Функции обработки событий
  • www.mql5.com
Основы языка / Функции / Функции обработки событий - Документация по MQL5
 
Is it possible to programmatically save these resources to disk only by means of MQL5, by the very program that contains the resources?
 
In which thread can I ask questions about MT5?
 
tor30515:

Where can I ask questions about MT5?
here
 
tol64:
Is it possible to programmatically save these resources to disk only by means of MQL5, by the very program that contains the resources?

a very good question and suggestion.

 
sergeev:

A very good question and suggestion.

Thank you. I'll duplicate it in the "Wishes for MT5" thread.

P.S. And to servicedesk))