and what do you mean by initialise))))) it's kind of unclear to the person)))))
Good evening, Valery! We open the article proposed to the person and find there first a brief description:
Далее идет функция инициализации советника. Это функция вызывается первой после запуска советника или смены графика и вызывается только один раз.
Этот раздел - лучшее место для проведения проверок, чтобы убедиться в правильности работы нашего советника.
Например, можно проверить, достаточно ли баров на графике для работы нашего советника и т.п.
Также это лучшее место для получения хэндлов технических индикаторов, которые будут использоваться (в нашем случае это индикаторы ADX и Moving Average).
and then a more detailed one:
intOnInit()
{
//--- Получить хэндл индикатора ADX
adxHandle=iADX(NULL,0,ADX_Period);
//--- Получить хэндл индикатора Moving Average
maHandle=iMA(_Symbol,_Period,MA_Period,0,MODE_EMA,PRICE_CLOSE);
//--- Нужно проверить, не были ли возвращены значения Invalid Handleif(adxHandle<0 || maHandle<0)
{
Alert("Ошибка при создании индикаторов - номер ошибки: ",GetLastError(),"!!");
}
In general, he should at least read this article first. ))
The script was supposed to draw a trend line as a segment. To do this, I set the initial and the second point to draw this segment. The documentation also says that you need two anchor points to create a trend line. I think I have done everything as it should be done. In my understanding, the second point is also an extreme point, but for some reason it is drawn not a segment, but a ray.
which are initialised, but nothing was assigned to them further. I.e. everything works as written - no miracles.
Hello, Alexander. That's where I was stumped. What should be assigned? I think the Calc_Pos(count_buy, countsell) function should work, or do I misunderstand?
Hello, Alexander. That's where I got stumped. What should be assigned? I think the function Calc_Pos(count_buy, countsell) should work, or do I misunderstand?
Regards, Vladimir.
1. You declare and initialise two variables.
uint count_buy=0, count_sell=0;
2. You pass their values to the function.
Calc_Pos(count_buy,count_sell);
It is not quite clear why this is done. Then you output the values of these variables. But they have not been changed anywhere, respectively, and zeros are printed. Everything works as written.
P.S. Trying to figure out your plan: you can declare these two variables global. For example, like this:
It is not quite clear why this is done. Then output the values of these variables. But they have not been changed anywhere, respectively and are printed with zeros. Everything works as written.
P.S. Trying to figure out your plan: you can declare these two variables global. For example, like this:
Thank you very much, Alexander. Your correction made the code work. To be honest, I realised that I was confused in three pines myself. I need to study passing arguments to a function again. Apparently, I have a complete misunderstanding here.
Thank you very much, Alexander. Your correction made the code work. To be honest, I realised that I was confused in three pine trees myself. I need to study passing arguments to a function again. Apparently, I have a complete misunderstanding here.
Regards, Vladimir.
Outputting variables to the global area is not passing arguments to a function...
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.
and what do you mean by initialise))))) it's kind of unclear to the person)))))
Good evening, Valery! We open the article proposed to the person and find there first a brief description:
and then a more detailed one:
In general, he should at least read this article first. ))
Regards, Vladimir.
Good day everyone!
I am continuing my self-study and again encountered a confusion. Here is the script code:
The script was supposed to draw a trend line as a segment. To do this, I set the initial and the second point to draw this segment. The documentation also says that you need two anchor points to create a trend line. I think I have done everything as it should be done. In my understanding, the second point is also an extreme point, but for some reason it is drawn not a segment, but a ray.
Could you please tell me where I am mistaken?
Regards, Vladimir.
MrBrooklin #:
Thank you, Artyom! Man, I didn't have enough intelligence to understand such a simple and obvious thing. God bless you!
Regards, Vladimir.
Good morning and good mood, everyone!
That's it! "I'm coming, your roof!" That's me. I run the script:
and I get this:
and there should be two short positions. Could you please tell me where I have made a mistake?
Regards, Vladimir.
Good morning and good mood, everyone!
That's it! "I'm coming, your roof!" That's me. I'm running the script:
and I get this:
and there should be two short positions. Could you please tell me where I've made a mistake?
Regards, Vladimir.
The last two prints
are outputting the value of variables
which are initialised, but nothing was assigned to them further.
I.e. everything works as written - no miracles.
The last two prints
outputs the value of variables
which are initialised, but nothing was assigned to them further.
I.e. everything works as written - no miracles.
Hello, Alexander. That's where I was stumped. What should be assigned? I think the Calc_Pos(count_buy, countsell) function should work, or do I misunderstand?
Regards, Vladimir.
Hello, Alexander. That's where I got stumped. What should be assigned? I think the function Calc_Pos(count_buy, countsell) should work, or do I misunderstand?
Regards, Vladimir.
1. You declare and initialise two variables.
2. You pass their values to the function.
It is not quite clear why this is done.
Then you output the values of these variables. But they have not been changed anywhere,
respectively, and zeros are printed. Everything works as written.
P.S. Trying to figure out your plan: you can declare these two variables global.
For example, like this:
1. You declare and initialise two variables.
2. You pass their values to the function.
It is not quite clear why this is done.
Then output the values of these variables. But they have not been changed anywhere,
respectively and are printed with zeros. Everything works as written.
P.S. Trying to figure out your plan: you can declare these two variables global.
For example, like this:
Thank you very much, Alexander. Your correction made the code work. To be honest, I realised that I was confused in three pines myself. I need to study passing arguments to a function again. Apparently, I have a complete misunderstanding here.
Regards, Vladimir.
Thank you very much, Alexander. Your correction made the code work. To be honest, I realised that I was confused in three pine trees myself. I need to study passing arguments to a function again. Apparently, I have a complete misunderstanding here.
Regards, Vladimir.
Outputting variables to the global area is not passing arguments to a function...
Put & before variable names at the input to the function and all the problems will be solved.