Questions from Beginners MQL5 MT5 MetaTrader 5 - page 575
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
Here is my variant of solving the repetition search problem:
For the script to work, the Dictionary file must be copied into MQL5\Include
The search is performed in the one-pass for loop highlighted in yellow. The resulting list contains no repetitions (if A repeats B and B repeats A, one set {A, B} will be output instead of two {A, B} and {B, A}). ).
The output of this script showed the following:
From the reference:
Here is my version of the solution to the repetition search problem:
Please help me find a function to calculate the standard RSI, the requirements are simple:
1. Return RSI value at a given bar
2. Calculate index only for those bars (if necessary), which are requested (desirable)
3. To be able to calculate on the specified TF
4. Works at the expense of point 2 faster than the indicator
I want to integrate the function into the Expert Advisor, if anyone has a ready one, please share it with me.
I am asking as the indicator is very common and is not a mystery.
Please help me find a function to calculate the standard RSI, the requirements are simple:
1. Return RSI value at a given bar
2. Calculate index only for those bars (if necessary), which are requested (desirable)
3. To be able to calculate on the specified TF
4. Works at the expense of point 2 faster than the indicator
I want to integrate the function into the Expert Advisor, if anyone has a ready one, please share it with me.
I am asking as the indicator is very common and is not a mystery.
What's wrong with the standard iRSI? Not secret enough?
There are my changes that I will need to make to the function...
Take a ready-made one then and modify it according to your requirements:
Take a ready-made one then and modify it according to your requirements:
Here is my variant of solving the problem of searching for repetitions:
Vasily, when I open#include <Dictionary.mqh>, it opens the same as in the EA body. It should be like this, or there should be some other code inside?
Because in the code, that I see, it's not clear how it searches for repetitions ((
Am I correct in assuming this is a typo? It should be 0 instead of 1.
like this:int searchPeriod=(Search_Period<1)?0:Search_Period;
and further in the executable script:
int copy_bars=(int)fmin(Search_Period,Bars(Symbol(),Period())); // the number of candles to copy
In this case, we should probably already use a variable: searchPeriod. right?
------
Another question, what does this line do? I found that each element of the structure resets to zero. And I don't understand what we are zeroing here if we seem to have just written this data and should use it further.
ZeroMemory(dataCandle); // Zeroing data in the structure
Am I correct in assuming this is a typo? It should be 0 instead of 1.
like this:int searchPeriod=(Search_Period<1)?0:Search_Period;
and further in the executable script:
int copy_bars=(int)fmin(Search_Period,Bars(Symbol(),Period())); // the number of candles to copy
In this case, we should probably already use a variable: searchPeriod. right?
------
Another question, what does this line do? I found that each element of the structure resets to zero. And I don't understand what we are zeroing here if we seem to have just written this data and should use it further.
ZeroMemory(dataCandle); // clearing the data in the structure
"like this:int searchPeriod=(Search_Period<1)?0:Search_Period;"
No, it's not. This is how you have it (literally): if Search_Period set by the user in the settings is less than one, then searchPeriod will be equal to zero; otherwise, searchPeriod will be equal to the value of Search_Period set by the user in the settings. This is not correct. We don't need a search range that equals zero. So, if this range is set by the user to 0 or less than zero (less than one), then we'll set this range equal to the minimum - one.
"int copy_bars=(int)fmin(Search_Period,Bars(Symbol(),Period())); // number of candlesticks to copy
here we should already use the variable: searchPeriod. right? "
Yes, that's right, there's a typo.
"Another question, what does this line do? What is it for? I found that it resets each element of the structure to zero. And here I cannot understand why and what we are zeroing if we have just written this data and should use it further. ZeroMemory(dataCandle); // Zeroing the data in the structure".
We do this before filling the structure with data. First we zero it, and then we fill it. Look - we zero it before the loop. And then in the loop we fill the structure with data.