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

 
Aleksey Vyazmikin:

What is it for, in terms of intermediate points between the bars, purely for aesthetics?

I don't need intermediate points, only points on bars.

Aleksey Vyazmikin:

I would create a buffer (for the top and the bottom of the channel) for each bar, where I would place extrema of all circles on the bar, the window for testing, judging by the figure, would be max 10 bars and then I would create this indicator, of course, the last bars may overdraw.

How do I draw these extrema from all circles on a bar?

 
Can you draw a line from the bottom upwards and fix a point where it hits the first object it encounters?

 
multiplicator:

You don't need intermediate points. Only points on the bar.

But how should I define extrema from all circles on the bar?

You have to translate the circles into pixels, apparently... and then it's just a matter of technique.

Of course, you could get twisted and go through all the objects on the bar looking for the maximum/minimum point, why not.

 
multiplicator:

Now I need to draw 2 red lines along the top edge of the ellipses and along the bottom edge of the ellipses (as I have shown in the picture).



Does anyone know how to do this?

Study CCanvas

 
Aleksey Vyazmikin:

We need to convert the circles into pixels.

is it possible?

Aleksey Vyazmikin:

Of course, you could get twisted, and go through all the objects on the bar looking for the maximum/minimum point, why not.

is it possible to search all objects that fall on this bar?
The thing here is that circles of neighbouring bars may enter this bar and they may form highs/minimums.



Maybe we should build circles from small lines, as recommended here. then there will be all points.
 
Artyom Trishkin:

Study CCanvas

Is it possible to define the coordinates of the line intersection with a graphical object? (like here )
 
multiplicator:

Is that possible?

Can you go through all the objects that fall on this bar?
The point is that the circles of neighbouring bars may enter this bar and they may form maxima/minima.



I may have to build circles out of small lines, as recommended.

It is possible to convert to pixels, I don't see any obstacles, but I haven't done it myself.

I was thinking, your width is always a multiple of the adjacent bar times, then the variant I originally suggested should work. Maybe I do not understand something, but I have all the data, because you have built circles yourself. Perhaps it will be necessary to calculate through a proportion, presenting the time as a fraction of the radius.

 

The CTrade class has two methods PositionOpen and Buy, which duplicate each other, but neither of them has a slippage setting.

Why is it done that way? As far as I understand this parameter can be used only through OrderSend, or there is a simpler variant?

 
psyman:

The CTrade class has two methods PositionOpen and Buy, which duplicate each other, but neither of them has a slippage setting.

Why is it done that way? As far as I understand this parameter can be used only through OrderSend, or there is a simpler variant?

Документация по MQL5: Стандартная библиотека / Торговые классы / CTrade / SetDeviationInPoints
Документация по MQL5: Стандартная библиотека / Торговые классы / CTrade / SetDeviationInPoints
  • www.mql5.com
Стандартная библиотека / Торговые классы / CTrade / SetDeviationInPoints - справочник по языку алгоритмического/автоматического трейдинга для MetaTrader 5
 
psyman:

The CTrade class has two methods PositionOpen and Buy, which duplicate each other, but neither of them has a slippage setting.

Why is it done that way? As far as I understand, this parameter can be used only through OrderSend or there is a simpler variant?

It appears that before sending a trade request you set the necessary slippage in the class instance. Or at once at initialization of the Expert Advisor - if you are not going to change the value of the allowable slippage from time to time. If you want to change it before sending request or after receiving error, you set new slippage with this class method.

Why is it done so ... Well, you may guess many things here. For instance, you declare multiple instances of CTrade and there is a different instance for each character. Of course, it may happen that for each symbol to set its own size of allowable slippage - after creating an instance, you will set the required size of slippage to each symbol. This will be enough in most cases.

Reason: