I have an idea to write a function that will take and shift an array. The question is how to make this function so that it itself determines what type of array is one-dimensional or 2-dimensional, so that I don't have to specify in the arguments every time that the array is 2-dimensional or regular. At the same time, I want to apply a template, so that I don't have to specify the type of the array.
How can I make it so that I don't have to specify what type of array?
intOnCalculate (constint rates_total, // размер массива price[] constint prev_calculated, // обработано баров на предыдущем вызове constint begin, // откуда начинаются значимые данные constdouble& price[] // массив для расчета
);
Please explain the mechanics of variable begin
This link seems to have informationhttps://www.mql5.com/ru/docs/basis/function/events, but I either don't understand it or haven't found it. I can't understand what is the default value at the beginning and how it changes as the cycles in the indicators go through
For example I know that return() inside the function OnCalculate() assigns the return value to the variable prev_calculated and it will be used in calculations at next call of OnCalculate(), i.e. at next tick
Please describe in the same simple words the mechanics of the variable begin inside the function OnCalculate()
В языке MQL5 предусмотрена обработка некоторых предопределенных событий. Функции для обработки этих событий должны быть определены в программе MQL5: имя функции, тип возвращаемого значения, состав параметров (если они есть) и их типы должны строго соответствовать описанию функции-обработчика события. Именно по типу возвращаемого значения и по...
But how to makeloopingof conditions? For example, there are 3 indicators (we don't consider the selection of input parameters in the loop for simplicity) and they are 7 possible combinations of conditions/combinations
For example, the first three conditions have one indicator 1) if(indicator #1 ...) {...}; 2) if(indicator #2 ...) {...}; 3) if(indicator #3....) {...};
The second three conditions on two indicators are 4) if(#1 ... && #2 ...) {...}; 5) if(#1 ... && #3 ...) {...}; 6) if(#2 ... && #3 ...) {...};
And in the last seventh condition all three available indicators 7) if(#1 ... && #2 ... && #3 ...) { ...};
And if it is also possible, it would be good to loop the enumeration of logical conditions. For example, don't write && || > < == and so on, but loop
. It would be nice if we could write every possible variant manually and the EA would combine and check all possible variants of the input parameters, combined or individual indicators and logical conditions.
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
I have an idea to write a function that will take and shift an array. The question is how to make this function so that it itself determines what type of array is one-dimensional or 2-dimensional, so that I don't have to specify in the arguments every time that the array is 2-dimensional or regular. At the same time, I want to apply a template, so that I don't have to specify the type of the array.
How can I make it so that I don't have to specify what type of array?
Do overloading:
Overloading to do:
Can the second dimension be dynamic?
It's not dynamic, it's just written as a received argument, just put square brackets.
How can I implement in a loop (or some other way) the enumeration of possible condition variants?
For example, there are 2 indicators MA and MACD, i.e. they represent 3 possible condition variants:
1 option - if(iMA ...) {...};
2nd scenario - if(iMACD ...) {...};
variant 3 - if(iMA ... iMACD ...) {...};
It's easy to combine input parameters, but how do I combine conditions? This is especially useful if there are more than 2 indicators or formulas
Give links to examples if available
How to implement in a loop (or some other way) the enumeration of possible variants of conditions?
If I understand correctly, the answer can be found in the topic.
Hello again, again I don't understand something obvious.
So how to pass an array to a function after all?
Errors:
']' - expression expected
'b' - parameter conversion not allowed
Suppose I know how to eliminate the first error:
Func(b[3]);But in this case what, only the third element will be passed? It makes no sense.
How can I pass the array as a whole?
Thank you.
Hello again, again I don't understand something obvious.
So how to pass an array to a function after all?
Errors:
']' - expression expected
'b' - parameter conversion not allowed
Suppose I know how to eliminate the first error:
But in this case what, only the third element will be passed? It makes no sense.
How can I pass the array as a whole?
Thank you.
Please explain the mechanics of variable begin
This link seems to have informationhttps://www.mql5.com/ru/docs/basis/function/events, but I either don't understand it or haven't found it. I can't understand what is the default value at the beginning and how it changes as the cycles in the indicators go through
For example I know that return() inside the function OnCalculate() assigns the return value to the variable prev_calculated and it will be used in calculations at next call of OnCalculate(), i.e. at next tick
Please describe in the same simple words the mechanics of the variable begin inside the function OnCalculate()
Good afternoon.
Can you please tell me why the OnTick function doesn't write data to the file using this code:
//=== write data to file ===
h1=FileOpen("test_bar.csv",FILE_CSV|FILE_WRITE|FILE_READ,",");
FileSeek(h1, 0, SEEK_END);
FileWrite(h1, TimeToStr(Time[1],TIME_DATE|TIME_MINUTES),i,Open[1],High[1],Low[1],Close[1], Parabola57Up, ");
FileClose(h1);
And that is during history testing. When the Expert Advisor is working online, it keeps recording.
Thank you
How can I implement in a loop (or some other way) the enumeration of possible condition variants?
For example, there are 2 indicators MA and MACD, i.e. they represent 3 possible condition variants:
1 option - if(iMA ...) {...};
2nd scenario - if(iMACD ...) {...};
variant 3 - if(iMA ... iMACD ...) {...};
It's easy to combine input parameters, but how do I combine conditions? This is especially useful if there are more than 2 indicators or formulas
Give me some links to examples if you have them.
I want to make a self-optimization, but not only by input parameters of indicators. I understand it
But how to makeloopingof conditions? For example, there are 3 indicators (we don't consider the selection of input parameters in the loop for simplicity) and they are 7 possible combinations of conditions/combinations
For example, the first three conditions have one indicator
1) if(indicator #1 ...) {...};
2) if(indicator #2 ...) {...};
3) if(indicator #3....) {...};
The second three conditions on two indicators are
4) if(#1 ... && #2 ...) {...};
5) if(#1 ... && #3 ...) {...};
6) if(#2 ... && #3 ...) {...};
And in the last seventh condition all three available indicators
7) if(#1 ... && #2 ... && #3 ...) { ...};
And if it is also possible, it would be good to loop the enumeration of logical conditions. For example, don't write && || > < == and so on, but loop
. It would be nice if we could write every possible variant manually and the EA would combine and check all possible variants of the input parameters, combined or individual indicators and logical conditions.