Questions from Beginners MQL5 MT5 MetaTrader 5 - page 935
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
This glitch seems to occur if there are other orders in the market but of a different size.
Suppose we have 4 sells of 1 lot and 4 buys of 1 lot. And 1 buy 0.5 lots.
How to avoid this? I think this function needs a loop.
This glitch seems to occur if there are other orders in the market but of a different size.
Suppose we have 4 sells of 1 lot and 4 buys of 1 lot. And 1 buy 0.5 lots.
How to avoid this? Perhaps, there should be a loop in this function.
I don't know where the "drubashka" is. It is his specialty to work through the standard library. I don't know what it's picking.
if(m_position.SelectByIndex(i))
And it would be too lazy to sort it out.
I would have approached the solution a little differently. I would create two arrays with Buy and Sell position tickets separately and close the positions in the second loop in pairs.
Or we may create one two-dimensional array. But one has to be very attentive in distributing the indexes. So that there are no gaps...
Somewhere the drummer has disappeared. It's his thing to work through the standard library. I don't know what he's choosing.
Yes, and I'm too lazy to work it out.
I would have approached the solution a little differently. I would create two arrays with Buy and Sell position tickets separately and close them in the second loop in pairs.
Or we can use one two-dimensional array. But I have to be very attentive in distributing the indexes. So that there are no gaps...
I've thought about it myself. Can you share the code with two arrays? I cannot do it myself.
As a temporary solution, I created a limited loop. I do not know if this code is correct or not, but it may be something. True, it closes strangely with splitting lots.
Apparently even the volumes of the counter should be compared to avoid splitting. I give up.
I myself have thought about it. Can you share the code with two arrays?
No, for several reasons.
1. I don't use counter closure myself.
2. There is no ready-made code, and there is no desire to write it specially.
3. Yesterday I had such an idea. Yesterday I had such an idea. Today I have another one, and tomorrow, God forbid, I will have another one. Consequently I only write what is in my mind at the moment.
And the main reason - I think that help and do someone else's work, it's two big differences.
I can only help. But I can't help you, I almost don't use standard library and to understand your code, I need to understand SB.
Hi All
Can you give me an example of an indicator or function that allows you to create an indicator that will only show the result on the chart in a certain range or area on the chart!
For example from 1:00 to 2:35 terminal time, And this choice should be made with the mouse directly on the chart.
I specifically need to count the number of bar or sell candles in the selected range.
Hi All
Can you give me an example of an indicator or function that allows you to create an indicator that will only show the result on the chart in a certain range or area on the chart!
For example from 1:00 to 2:35 terminal time, And this choice should be made with the mouse directly on the chart.
I specifically need to count the number of Buy or Sell candlesticks in the selected range.
The first thing that came to mind:
Hi All
Can you give me an example of an indicator or function that allows you to create an indicator that will only show the result on the chart in a certain range or area on the chart!
For example from 1:00 to 2:35 terminal time, And this choice should be made with the mouse directly on the chart.
I specifically need to count the number of Buy or Sell candlesticks in the selected range.
What is the problem?
In OnChartEvent () to two variables, in turn, the time of the mouse click in two points is assigned (not the current time, but the time of the bar, on which you have clicked) and, provided both variables are not zero, this range is calculated. After the output of these variables, they are reset to zero and wait for the next mouse click.
The only problem I see is if the first click is made by mistake, how to undo it. But, I think it is possible to come up with something carefully after reading the documentation. For example, pressing a key or scrolling the mouse wheel...
Please help!
Tired of fixing the script to take screenshots on history. The script is supposed to scroll to 8am each day and take a screenshot.
The script is not working as it should.
Please help!
Tired of fixing the script to take screenshots on history. The script is supposed to scroll to 8am each day and take a screenshot.
The script is not working as it should.
So far, the scrolling function is working erratically (or rather working unpredictably). The administrator is sorting it out.
So far, the scrolling function is malfunctioning (or rather working unpredictably). The administrator is sorting it out.
Thank you!