Errors, bugs, questions - page 2194

 
Dmytro Zelenskyy:

Serious approach))

Well then, on the one you want to screen, run a small script on it once, which gives id in a global variable (preferably a temporary global variable).

And your script screens by id.

Clever move!

Thank you!
 
Dmytro Zelenskyy:

Even if you calculate the exact width of the screen in pixels, the screen will partially cover the price column.

And on different screen resolutions it is different, with me (1280x1024) from 50 to 60 depending on the number of digits of the currency. On the other screen will be different.

That's how to figure out what the width of the column, to add these pixels to the width of the screen? (open in the screenshot what the column has closed)


Hi from fxsaber:

//+------------------------------------------------------------------+
#define  TOSTRING(A) #A + " = " + (string)(A) + "\n"
// Ширина вертикальной шкалы графика
int GetWidthScale(const long chartID=0)
  {
   const string Name=__FUNCTION__+(string)MathRand();

   ObjectCreate(chartID,Name,OBJ_CHART,0,0,0);
   ObjectSetInteger(chartID,Name,OBJPROP_XDISTANCE,-1 e3);

   const long chart=ObjectGetInteger(chartID,Name,OBJPROP_CHART_ID);

   const int Res=(int)(ChartGetInteger(chart,CHART_WIDTH_IN_PIXELS) -
                  (ChartSetInteger(chart,CHART_SHOW,false) ? ChartGetInteger(chart,CHART_WIDTH_IN_PIXELS) : 0));

   ObjectDelete(chartID,Name);

   return(-Res);
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
void OnStart()
  {
   Print(TOSTRING(GetWidthScale()));
  }
//+------------------------------------------------------------------+
 
Artyom Trishkin:

Greetings from fxsaber:

The case beats the master!!!

Cool!

 
Artyom Trishkin:

Hello from fxsaber:

The code is certainly very interesting, but it turns out it doesn't solve the problem...

 
The problem is that it is not clear how to get a universal function (working with any zoom and different scale widths) that can be used to determine the number of pixels up to and including a specific bar.
 
Aleksey Vyazmikin:
The problem is that it's not clear how to get a universal function (that works with any zoom and different scale widths) that can be used to determine the number of pixels up to and including a specific bar.

Come on. All the clues are there.
Bar width only accepts the values 1,2,4,8,16,32

Oddly, the CHART_POINTS_PER_BAR identifier does not work.

But the width of the bar in pixels can easily be calculated:

int WidthBar=int(1<<ChartGetInteger(0,CHART_SCALE));
The left bar is always drawn from the centre, the right bar as desired. Therefore, the origin of coordinates is at zero (left).
 
Nikolai Semko:

Come on. All the picks are here.
Bar width only accepts values of 1,2,4,8,16,32

Oddly, the CHART_POINTS_PER_BAR identifier does not work.

But the width of the bar in pixels can easily be calculated:

The left bar is always drawn from the centre, the right bar as desired. Therefore, the origin of coordinates is at zero (left).

This is a theory, so far the best (more accurate) version is this:

pp=(double)ChartGetInteger(handle,CHART_WIDTH_IN_PIXELS)/(double)ChartGetInteger(handle,CHART_WIDTH_IN_BARS)*((Shift_Start-Shift_Stop)*(-1)+2)+Schkala+3;

but it also fails in a couple of ways.

 
Aleksey Vyazmikin:

This is a theory, so far the best (more accurate) option is this:

but it also fails in pairs.

:))
Formulate the problem clearly. What value do you want to get?
 
Nikolai Semko:
:))
State the problem clearly. What value do you want to get?

I need to make a screenshot from date A to date B inclusive. And the function should work correctly at any zoom.

 

Based on the screenshot I made a separate thread where I described the problem and posted the code I have - please help!

https://www.mql5.com/ru/forum/237291

Организация пакетной обработки задачи по снятия изображений с экрана графика
Организация пакетной обработки задачи по снятия изображений с экрана графика
  • 2018.04.15
  • www.mql5.com
Встала у меня задача доработать скрипт https://www.mql5.com/ru/code/936 , который делает скрины...
Reason: