Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 6. - page 969

 

The indicator does not work correctly. When it is removed from the graph, the text does not disappear.

I'm not strong in programming, so I'm appealing to experts. Please correct the turkey, I would be grateful.

And the default indicator colour is black, it is desirable to change it.

I would also like to be able to install it in any place on the chart.

Thank you.

Files:
 
PozitiF:
You can remember the visible prices and times on the chart and compare them as soon as the chart is stretched or whatever and the visible areas decrease or increase. You can place invisible labels on the chart at a certain distance, memorize the distance, and compare.
It's easier to compare by Mashkeh values, comparing by pips*Point, defined by optimization!
 
borilunad:
Easier by Mach values, comparing by pips*Point, defined by optimisation!
Completely agree.
 
Is it possible to correct the quotes in the online chart file on the fly? The idea is to hardwire the opening price of a bar to the closing price of the previous bar.
 
SunnYtheDreamer:
Function: ChartTimePriceToXY
https://docs.mql4.com/ru/chart_operations/charttimepricetoxy

Pass the MA values into it, get the pixel coordinates relative to the chart window, and then write an algorithm for calculating the distance between the two points.


Thank you!
 
Alligator:

The indicator does not work correctly. When it is removed from the graph, the text does not disappear.

I'm not strong in programming, so I'm appealing to experts. Please correct the turkey, I would be grateful.

And the default indicator colour is black, it is desirable to change it.

I would also like to be able to install it in any place on the chart.

Thank you.

Try fixing it yourself. The colour of the objects is set in the line
extern color ExtColor=Black;

I.e. you can change the colour yourself when calling the indicator in the input parameters, or, assign another colour in the programme, by default.

The program does not remove objects when the indicator is removed from the chart. This is the line in deinit()

   if(windex>0) ObjectsDeleteAll(windex);

You should remove the check if(windex>0). Leave only deletion of all objects.

 
Mislaid:
Try to correct it yourself. The colour of objects is set in the line

I.e., you can change the colour yourself when calling the indicator in the input parameters, or, assign a different colour in the programme, by default.

The programme does not remove objects when the indicator is removed from the chart. This is the line in deinit()

You should remove the check if(windex>0). Leave only deletion of all objects.

Thank you, good man! I practically did it. I have removed the checkif(windex>0), but when I remove an indicator

itdeletes all graphical objects that draw other indicators, which at the same time are on the chart.

What can I do?

Thank you again.

 
Alligator:

Thank you, kind man! It almost worked, I removed the checkif(windex>0), but now when I remove the indicator

all graphical objects that draw other indicators, which at the same time are hanging on the chart, are deleted.

What can I do?

Thank you again.

In this case the deletion of objects should be as follows

   ObjectsDeleteAll(0, "Head_", 0, OBJ_LABEL);
 
AlexeyVik:

In this case, deleting objects should be

It did not help.

Only the indicator header (uppermost line) is deleted, the captions in the second line on the chart remain.

 
Alligator:

It didn't help.

Only the indicator header (uppermost line) is deleted, the captions in the second line on the chart remain.

Right... I didn't look carefully. Add another line

   ObjectsDeleteAll(0, "Line_", 0, OBJ_LABEL);
Reason: