int GetCrossingMa(double& i_maFast1, double& i_maFast2, double& i_maSlow1, double& i_maSlow2) function gets the crossing signal.
intGetStochSignal(double& stochD1, double& stochD2, double& stochK1, double& stochK2) function receives signal from stochastic.
The void GetMomentumSignal() function gets the value of momentum.
The int GetSignal() will get the general signal based on the previous 3 functions and not only them. The question is this. Since theint GetSignal() function is the main one, so to speak, and it gets the main signal, I get all the values of the flaps(i_maFast1,i_maFast2, i_maSlow1 andi_maSlow2) and stochastics(stochD1,stochD2,stochK1,stochK2)
I don't like poking around in left-hand code, but it immediately struck my eye why there is an & (!) after double in functions. This is what causes errors!
To avoid explaining the code in details, I will explain it briefly.
There are 3 functions:(int GetCrossingMa, int GetStochSignal and intGetSignal())
The int GetSignal() function gets values of flaps and other indicators which are passed by referenceto non-core functions(int GetCrossingMa andint GetStochSignal) to get corresponding signals in them. I want to do it to avoid getting the same data in different functions. I don't think it's wise to calculate the same mask in 2 or more functions. It's easier to just calculate it once, and that's it. Why waste additional resources on this?
So it makes sense. It means transferring parameters via links.
To avoid explaining the code in details, I will explain it briefly.
There are 3 functions:(int GetCrossingMa, int GetStochSignal and intGetSignal())
The int GetSignal() function gets values of flaps and other indicators which are passed by referenceto non-core functions(int GetCrossingMa andint GetStochSignal) to get corresponding signals in them. I want to do it to avoid getting the same data in different functions. I don't think it's wise to calculate the same masks in 2 or more functions. It's easier to just calculate it once, and that's it. Why waste additional resources on this?
int GetCrossingMa(double& i_maFast1, double& i_maFast2, double& i_maSlow1, double& i_maSlow2) function gets the crossing signal.
intGetStochSignal(double& stochD1, double& stochD2, double& stochK1, double& stochK2) function receives signal from stochastic.
The void GetMomentumSignal() function gets the value of momentum.
The int GetSignal() will get the general signal based on the previous 3 functions and not only them. The question is this. Since theint GetSignal() function is the main one, so to speak, and it gets the main signal, I get all the values of the flaps(i_maFast1,i_maFast2, i_maSlow1 andi_maSlow2) and stochastics(stochD1,stochD2,stochK1,stochK2)
Was I correct in optimizing the code?
Of course, all parameters obtained in the functionGetSignal() are passed by reference to the corresponding functions.
But here this fragment
there is an error during compilation:
Why?
This may be a variant of signal search on the bar we need:
//+---------------------------------------------------------------------------------------+//| Проверка пересечения скользящих средних |//+---------------------------------------------------------------------------------------+int GetCrossingMa (int fi_Bar = 1)
{
double i_maFast1 = iMA (Symbol(), i_TF, i_maFastPeriod, i_maFastShift, i_maFastMethod, 0, fi_Bar), // Вычисляем быстрые скользящие..
i_maFast2 = iMA (Symbol(), i_TF, i_maFastPeriod, i_maFastShift, i_maFastMethod, 0, fi_Bar + 1), //..средние
i_maSlow1 = iMA (Symbol(), i_TF, i_maSlowPeriod, i_maSlowShift, i_maSlowMethod, 0, fi_Bar), // Вычисляем медленные скользящие..
i_maSlow2 = iMA (Symbol(), i_TF, i_maSlowPeriod, i_maSlowShift, i_maSlowMethod, 0, fi_Bar + 1); //..средние//----if (i_maFast2 < i_maSlow2) if (i_maFast1 > i_maSlow1) // Если быстрая скользящая пересекла медленную снизу вверх..return (CROSSINGTOUP); //.. значит, - пересечение вверхif (i_maFast2 > i_maSlow2) if (i_maFast1 < i_maSlow1) // Если быстрая скользящая средняя пересекла медленную сверху вниз..return (CROSSINGTODOWN); //..значит, - пересечение вниз//----return (CROSSINGWAIT); // Ожидаем пересечения
}
//+---------------------------------------------------------------------------------------+//| Получение сигнала от Стохастика |//+---------------------------------------------------------------------------------------+int GetStochSignal (int fi_Bar = 1)
{
double stochD1 = iStochastic (Symbol(), i_TF, i_stoch_D, i_stoch_K, i_stoch_slowing, 0, 0, 1, fi_Bar), // Вычисляем значения сигнальной линии..
stochD2 = iStochastic (Symbol(), i_TF, i_stoch_D, i_stoch_K, i_stoch_slowing, 0, 0, 1, fi_Bar + 1), //..стохастика
stochK1 = iStochastic (Symbol(), i_TF, i_stoch_D, i_stoch_K, i_stoch_slowing, 0, 0, 0, fi_Bar), // Вычисляем значения главной линии..
stochK2 = iStochastic (Symbol(), i_TF, i_stoch_D, i_stoch_K, i_stoch_slowing, 0, 0, 0, fi_Bar + 1); //..стохастика//----if (stochD2 < stochK2) if (stochD1 > stochK1) // Если сигнальная линия пересекла главную снизу вверх..return (CROSSINGTOUP); //..значит, - пересечение вверхif (stochD2 > stochK2) if (stochD1 < stochK1) // Если сигнальная линия пересекла главную сверху вниз..return (CROSSINGTODOWN); // ..значит, - пересечение вниз
}
//----return (CROSSINGWAIT); // Ожидаем пересечения
}
//+---------------------------------------------------------------------------------------+//| Получение сигнала от Моментума |//+---------------------------------------------------------------------------------------+double GetMomentumSignal (int fi_Bar = 0)
{return (iMomentum (Symbol(), i_TF, i_momPeriod, 0, fi_Bar));}
//+---------------------------------------------------------------------------------------+//| Получение общего сигнала для входа в рынок |//+---------------------------------------------------------------------------------------+int GetSignal (int fi_Bar = 1)
{
int li_Signal;
//----double ld_SignalMomentum = GetMomentumSignal (fi_Bar);
int li_SignalStoch = GetStochSignal (fi_Bar),
li_CrossingMA = GetCrossingMa (fi_Bar);
//----return (li_Signal);
}
And in the last function GetSignal() you make "adding" of all signals (by yourself).
P.S. There is a "delicate" moment in getting the signal from the indicator. For example, you can fix the fact of finding maSlow over / under maFast, or you can "catch" the moment of their intersection. The approach and the code are different.
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.
More is possible for 32. Only the motherboard limits this. It seems that up to 200 GB can be connected. I saw a table somewhere.
You can Google "Windows Task Scheduler". You can check it out here.
Do you need to create separate programmes (tasks) to disable enabled terminals?
Here's my test raw owl tutorial:
int GetCrossingMa(double& i_maFast1, double& i_maFast2, double& i_maSlow1, double& i_maSlow2) function gets the crossing signal.
intGetStochSignal(double& stochD1, double& stochD2, double& stochK1, double& stochK2) function receives signal from stochastic.
The void GetMomentumSignal() function gets the value of momentum.
The int GetSignal() will get the general signal based on the previous 3 functions and not only them. The question is this. Since theint GetSignal() function is the main one, so to speak, and it gets the main signal, I get all the values of the flaps(i_maFast1,i_maFast2, i_maSlow1 andi_maSlow2) and stochastics(stochD1,stochD2,stochK1,stochK2)
Was I correct in optimizing the code?
Of course, all parameters obtained in the functionGetSignal() are passed by reference to the corresponding functions.
But here this fragment
there is an error at compilation:
Here's my test raw owl tutorial:
an error pops up when compiling:
Because:
I don't like digging in custom code, but I immediately noticed why there is & (!) after double in functions. This is what causes errors!
So it makes sense. It means transferring parameters via links.
To avoid explaining the code in details, I will explain it briefly.
There are 3 functions:(int GetCrossingMa, int GetStochSignal and int GetSignal())
The int GetSignal() function gets values of flaps and other indicators which are passed by referenceto non-core functions(int GetCrossingMa andint GetStochSignal) to get corresponding signals in them. I want to do it to avoid getting the same data in different functions. I don't think it's wise to calculate the same mask in 2 or more functions. It's easier to just calculate it once, and that's it. Why waste additional resources on this?
So it makes sense. It means transferring parameters via links.
To avoid explaining the code in details, I will explain it briefly.
There are 3 functions:(int GetCrossingMa, int GetStochSignal and int GetSignal())
The int GetSignal() function gets values of flaps and other indicators which are passed by referenceto non-core functions(int GetCrossingMa andint GetStochSignal) to get corresponding signals in them. I want to do it to avoid getting the same data in different functions. I don't think it's wise to calculate the same masks in 2 or more functions. It's easier to just calculate it once, and that's it. Why waste additional resources on this?
Have you programmed in a language other than µl4?
Here's my test raw owl tutorial:
int GetCrossingMa(double& i_maFast1, double& i_maFast2, double& i_maSlow1, double& i_maSlow2) function gets the crossing signal.
intGetStochSignal(double& stochD1, double& stochD2, double& stochK1, double& stochK2) function receives signal from stochastic.
The void GetMomentumSignal() function gets the value of momentum.
The int GetSignal() will get the general signal based on the previous 3 functions and not only them. The question is this. Since theint GetSignal() function is the main one, so to speak, and it gets the main signal, I get all the values of the flaps(i_maFast1,i_maFast2, i_maSlow1 andi_maSlow2) and stochastics(stochD1,stochD2,stochK1,stochK2)
Was I correct in optimizing the code?
Of course, all parameters obtained in the functionGetSignal() are passed by reference to the corresponding functions.
But here this fragment
there is an error during compilation:
This may be a variant of signal search on the bar we need:
And in the last function GetSignal() you make "adding" of all signals (by yourself).
P.S. There is a "delicate" moment in getting the signal from the indicator. For example, you can fix the fact of finding maSlow over / under maFast, or you can "catch" the moment of their intersection. The approach and the code are different.
Have you programmed in a language other than µl4?