[ARCHIVE] Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 3. - page 183
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
Hello.
Can you please tell me if it's possible to calculate the distance in points between two mashes.
My variant is given below, but it doesn't work as originally intended.
Thank you in advance.
My variant is given below, but it doesn't work as originally intended.
Found a mistake. Here's a working version:
Afternoon....
How to transfer the close price value of an order from one terminal to another, trading on the same currency pair ?
Good afternoon....
How to transfer the close price value of an order from one terminal to another, trading on the same currency pair ?
If you are asking such a question then i don't think you can do it yourself.
Good evening everyone!
The following question about arrays arises.
Suppose we need to analyze n bars for a certain fluctuation, select it, put it into an array and work with this...
Below is some code; I think the comments will explain everything.
The logic is as follows:
1. We set the necessary number of bars.
2. Loop through the whole thing in the loop.
Look for fulfillment of the specified condition(close_1>close_2&close_2<close_3).
4. If the condition is met, then we calculate the difference diff between the closing price close_1 and close_2.
And then the questions themselves:
1. How to correctly form an array and write there values of diff (of course, the dimensionality of the array is determined depending on the number of obtained values)?
2. Calculate and display the number of elements in the array ???
3. Select e.g. 3, 6, 7 elements and calculate their sum ???
4. And finally, e.g., to Print/Alert directly to output the entire array instead of individual elements ???
And here is a picture to make it clear, which condition we process. : ))Good evening everyone!
The following question about arrays has arisen.
Suppose we want to analyze n bars for a particular oscillation, select it, store in an array and work with this...
Laugh after the word indicator.
It's easier to create an indicator, it already has eight buffer arrays, put all the logic on it and then address the required elements through iCustom
In print/alert the whole array is somewhat unreadable, but through enumeration and creating a long string in the loop is quite possible.
3. Select e.g. 3, 6, 7 elements and calculate their sum ???
Either don't joke about this or read the documentation.
double Summa=Mas[3]+Mas[6]+Mas[7];
Recommended reading https://book.mql4.com/ru/variables/arrays
https://docs.mql4.com/ru/array
Laugh after the word indicator.
It's easier to create an indicator, it already has eight buffer arrays, transfer all logic to it, and then address the necessary elements via iCustom
In print/alert the whole array is a bit unreadable, but through enumeration and creating a long string in the loop is quite possible.
Either don't mess around like this, or read the documentation.
double Summa=Mas[3]+Mas[6]+Mas[7];
Recommended reading https://book.mql4.com/ru/variables/arrays
https://docs.mql4.com/ru/array
Yes, you don't need to ask about summa). And it's not about the indicator here. It is rather an example so that I could understand arrays properly.
I have already seen the recommended article but it did not help me to handle this question.
So my question is still relevant... How to build an array in this example? I would be very grateful if you could give me the code for clarity. It's easier to understand what we're talking about.
better to smoke indicators, all calculations are linked to bars, and the numbering of bars starts from zero and the array is shifted at each new bar. Using an indicator will allow you to transfer the logic of working with arrays to the system, plus it will add visual capabilities, plus easy use from an EA.
Make an indicator, otherwise it is very difficult to link the calculated elements of the array to the bars on the chart.
better to smoke indicators, all calculations are linked to bars, and the numbering of bars starts from zero and the array is shifted at each new bar. Using an indicator will allow you to transfer the logic of working with arrays to the system, plus it will add visual capabilities, plus easy to use from an EA.
Make the indicator, otherwise it will be very difficult to bind the calculated elements of the array to the bars on the chart.
Ok, I understand, it's better to read everything in the indicator and send values to the Expert Advisor.
But the issue here is a little different, I cannot fill the array with data, it displays zeros. I want to understand it.
Again, using this example. Binding to bars I have, just sequentially go to i and work out the right condition close_1>close_2&close_2<close_3 (just for example).
And now the most interesting thing is that we have calculated diff=close_1-close_2. How to put this value of diff into array?
I think with size we can make additional variable int n and increase it by 1 (n++) in if condition, we'll get how many times the condition worked and take this number as size.
But still, how to put the diff value into an array???
I understand, it's better to read everything in the indicator and send the values to the Expert Advisor.
But the question is a bit different, I cannot fill the array with data, it outputs zeros to me. I want to understand it.
Again, using this example. Binding to bars I have, just sequentially go to i and work out the right condition close_1>close_2&close_2<close_3 (just for example).
And now the most interesting thing is that we have calculated diff=close_1-close_2. How to put this value of diff into array?
I think with size we can make additional variable int n and increase it by 1 (n++) in if condition, we'll get how many times the condition worked and take this number as size.
But still, how to put diff value into array???
Look, I'm probably a caper right now, but I take it you're baffled that I'm using a script in this example. Did you mean it when you wrote about the indicator? If I did, then I make all dynamic calculations in an indicator or in an Expert Advisor directly. I have just launched it once, looked at it and then corrected the code))).
The previous question is still relevant. The subject of the array is not solved).