Good afternoon, please help, there is a simple idea to implement an Alert() call when three MAs intersect. Description of the intersection in the program. It seems to work, but not as it should. I am rounding the variables to one digit so that will catch the intersection. And this Alert() drums me as long as the means are at the same position. How do I make it get called once, well up to 5 times.
//+------------------------------------------------------------------+ //| Начало программы | //+------------------------------------------------------------------+
intinit(){return(0);} intEURUSD() {
if(SMA_Green_EURUSD == SMA_Orange_EURUSD && SMA_Blue_EURUSD > SMA_Orange_EURUSD) { // Если зеленая МА пересекает оранжевую МА и при этом синяя МА выше - сигнал к покупке. Alert("Cигнал на ПОКУПКУ паре EURUSD"); return(11); // 11 - на первой паре сигнал на покупку. }
if(SMA_Green_EURUSD == SMA_Orange_EURUSD && SMA_Blue_EURUSD < SMA_Orange_EURUSD) { // Если зеленая МА пересекает оранжевую МА и при этом синяя МА ниже - сигнал к продаже. Alert("Cигнал на ПРОДАЖУ паре EURUSD"); return(10); // 20 - на первой паре сигнал на продажу. } } int start()
{
//+------------------------------------------------------------------+ //| Блок работы с EURUSD | //+------------------------------------------------------------------+ if(EURUSD() != 11 || EURUSD() != 10) { // Если функция EURUSD() не зафиксировала ни один из сигналов, обрабатываем данные дальше. MA_Blue_EURUSD = iMA("EURUSD",PERIOD_H1,Period_MA_Blue,0,MODE_EMA,PRICE_CLOSE,0); MA_Green_EURUSD = iMA("EURUSD",PERIOD_H1,Period_MA_Green,0,MODE_EMA,PRICE_CLOSE,0); MA_Orange_EURUSD = iMA("EURUSD",PERIOD_H1,Period_MA_Orange,0,MODE_EMA,PRICE_CLOSE,0);
SMA_Blue_EURUSD = MA_Blue_EURUSD; // Преобразование int в string SMA_Blue_EURUSD = StringSetChar(SMA_Blue_EURUSD, 6, ''); // Округление до х.хххх SMA_Green_EURUSD = MA_Green_EURUSD; // Преобразование int в string SMA_Green_EURUSD = StringSetChar(SMA_Green_EURUSD, 6, ''); // Округление до х.хххх SMA_Orange_EURUSD = MA_Orange_EURUSD; // Преобразование int в string SMA_Orange_EURUSD = StringSetChar(SMA_Orange_EURUSD, 6, ''); // Округление до х.хххх
}
}
int deinit(){return(0);}
If it's all wrong on the root, suggest methods to track the intersection. Thanks.
Zherart: Good afternoon, please help, there is a simple idea to implement an Alert() call when three MAs intersect. Description of the intersection in the program. It seems to work, but not as it should. I am rounding the variables to one digit to to catch the intersection. And this Alert() drums up to me as long as the means are at the same position. How do I make it get called once, well up to 5 times.If it's not right at the root, suggest methods to track the intersection. Thank you.
//+------------------------------------------------------------------+//| Глобальные переменные |//+------------------------------------------------------------------+externint Period_MA_Blue = 4; // Период 4-х расчётной синей МА (4 часа)externint Period_MA_Green = 13; // Период 13-ти расчётной зеленой МА (13 часов)externint Period_MA_Orange = 50; // Период 50-ти расчётной оранжевой МА (2 дня 2 часа)double MA_Blue_EURUSD, MA_Green_EURUSD, MA_Orange_EURUSD;
string SMA_Blue_EURUSD,SMA_Green_EURUSD,SMA_Orange_EURUSD;
int БАРАБАНИТЬ = 1; // Сколько раз подавать сигналint ПОКУПКА=0,ПРОДАЖА=0;
//+------------------------------------------------------------------+//| Начало программы |//+------------------------------------------------------------------+int init(){return(0);}
int EURUSD()
{
if(SMA_Green_EURUSD == SMA_Orange_EURUSD && SMA_Blue_EURUSD > SMA_Orange_EURUSD)
{
// Если зеленая МА пересекает оранжевую МА и при этом синяя МА выше - сигнал к покупке.if(ПОКУПКА<БАРАБАНИТЬ) {Alert("Cигнал на ПОКУПКУ паре EURUSD");ПОКУПКА++;}
return(11); // 11 - на первой паре сигнал на покупку.
}
else ПОКУПКА=0;
if(SMA_Green_EURUSD == SMA_Orange_EURUSD && SMA_Blue_EURUSD < SMA_Orange_EURUSD)
{
// Если зеленая МА пересекает оранжевую МА и при этом синяя МА ниже - сигнал к продаже.if(ПРОДАЖА<БАРАБАНИТЬ) {Alert("Cигнал на ПРОДАЖУ паре EURUSD");ПРОДАЖА++;}
return(10); // 20 - на первой паре сигнал на продажу.
}
else ПРОДАЖА=0;
}
Either I'm stupid or there's something wrong with the terminal. I wanted to optimise an EA, but there is no "input parameters" tab in the EA properties. Help.
prom18: Either I'm stupid or there's something wrong with the terminal. I wanted to optimise an EA, but there is no "input parameters" tab in the EA properties. I've been trying to optimise my EA, but there is no "input parameters" tab in its properties.
The parameters to be passed are indicated in parentheses after the name of the function to be called and are listed, separated by commas. The number of parameters passed to a function must not exceed 64. The function may also not use the passed parameters. In this case, an empty parameter list is indicated, i.e. opening and closing parentheses are placed immediately after the function name.
The number, type and order of the parameters passed in the function call must coincide with the number, type and order of formal parameters, specified in the function description (exception is the call of a function, which has default parameters - see Function call and Function description and return operator). If there is no such coincidence, the MetaEditor will output an error message. Constants, variables, expressions and arrays can be used as passed parameters. "
The parameters to be passed are indicated in parentheses after the name of the function to be called, and are listed separated by commas. The number of parameters passed to the function must not exceed 64. The function may also not use the passed parameters. In this case, an empty parameter list is indicated, i.e. opening and closing parentheses are placed immediately after the function name.
The number, type and order of the parameters passed in the function call must coincide with the number, type and order of formal parameters, specified in the function description (exception is the call of a function, which has default parameters - see Function call and Function description and return operator). If there is no such coincidence, the MetaEditor will output an error message. Constants, variables, expressions and arrays can be used as passed parameters. "
Read the textbook before writing, see underline, but failed to implement in practice - writes about incompatible type.
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.
Description of the intersection in the program. It seems to work, but not as it should. I am rounding the variables to one digit so that
will catch the intersection. And this Alert() drums me as long as the means are at the same position. How do I make it get called once, well up to 5 times.
//| Глобальные переменные |
//+------------------------------------------------------------------+
extern int Period_MA_Blue = 4; // Период 4-х расчётной синей МА (4 часа)
extern int Period_MA_Green = 13; // Период 13-ти расчётной зеленой МА (13 часов)
extern int Period_MA_Orange = 50; // Период 50-ти расчётной оранжевой МА (2 дня 2 часа)
double MA_Blue_EURUSD, MA_Green_EURUSD, MA_Orange_EURUSD;
string SMA_Blue_EURUSD,SMA_Green_EURUSD,SMA_Orange_EURUSD;
//+------------------------------------------------------------------+
//| Начало программы |
//+------------------------------------------------------------------+
int init(){return(0);}
int EURUSD()
{
if(SMA_Green_EURUSD == SMA_Orange_EURUSD && SMA_Blue_EURUSD > SMA_Orange_EURUSD)
{
// Если зеленая МА пересекает оранжевую МА и при этом синяя МА выше - сигнал к покупке.
Alert("Cигнал на ПОКУПКУ паре EURUSD");
return(11); // 11 - на первой паре сигнал на покупку.
}
if(SMA_Green_EURUSD == SMA_Orange_EURUSD && SMA_Blue_EURUSD < SMA_Orange_EURUSD)
{
// Если зеленая МА пересекает оранжевую МА и при этом синяя МА ниже - сигнал к продаже.
Alert("Cигнал на ПРОДАЖУ паре EURUSD");
return(10); // 20 - на первой паре сигнал на продажу.
}
}
int start()
{
//+------------------------------------------------------------------+
//| Блок работы с EURUSD |
//+------------------------------------------------------------------+
if(EURUSD() != 11 || EURUSD() != 10)
{
// Если функция EURUSD() не зафиксировала ни один из сигналов, обрабатываем данные дальше.
MA_Blue_EURUSD = iMA("EURUSD",PERIOD_H1,Period_MA_Blue,0,MODE_EMA,PRICE_CLOSE,0);
MA_Green_EURUSD = iMA("EURUSD",PERIOD_H1,Period_MA_Green,0,MODE_EMA,PRICE_CLOSE,0);
MA_Orange_EURUSD = iMA("EURUSD",PERIOD_H1,Period_MA_Orange,0,MODE_EMA,PRICE_CLOSE,0);
SMA_Blue_EURUSD = MA_Blue_EURUSD; // Преобразование int в string
SMA_Blue_EURUSD = StringSetChar(SMA_Blue_EURUSD, 6, ''); // Округление до х.хххх
SMA_Green_EURUSD = MA_Green_EURUSD; // Преобразование int в string
SMA_Green_EURUSD = StringSetChar(SMA_Green_EURUSD, 6, ''); // Округление до х.хххх
SMA_Orange_EURUSD = MA_Orange_EURUSD; // Преобразование int в string
SMA_Orange_EURUSD = StringSetChar(SMA_Orange_EURUSD, 6, ''); // Округление до х.хххх
}
}
int deinit(){return(0);}
If it's all wrong on the root, suggest methods to track the intersection. Thanks.
Good afternoon, please help, there is a simple idea to implement an Alert() call when three MAs intersect.
Description of the intersection in the program. It seems to work, but not as it should. I am rounding the variables to one digit to
to catch the intersection. And this Alert() drums up to me as long as the means are at the same position. How do I make it get called once, well up to 5 times.If it's not right at the root, suggest methods to track the intersection. Thank you.
Somewhere like this at a glance...
Either I'm stupid or there's something wrong with the terminal. I wanted to optimise an EA, but there is no "input parameters" tab in the EA properties. I've been trying to optimise my EA, but there is no "input parameters" tab in its properties.
https://forum.mql4.com/ru/46980/page417#702426
https://www.mql5.com/ru/forum/138609/page417#702426
Is it possible to use an array in the parameters of a function? For example, I want to create a function that handles information in an array:
Is it possible to use an array in the parameters of a function? For example, I want to create a function that handles information in an array:
What does the tutorial say here?
"
The parameters to be passed are indicated in parentheses after the name of the function to be called and are listed, separated by commas. The number of parameters passed to a function must not exceed 64. The function may also not use the passed parameters. In this case, an empty parameter list is indicated, i.e. opening and closing parentheses are placed immediately after the function name.
The number, type and order of the parameters passed in the function call must coincide with the number, type and order of formal parameters, specified in the function description (exception is the call of a function, which has default parameters - see Function call and Function description and return operator). If there is no such coincidence, the MetaEditor will output an error message. Constants, variables, expressions and arrays can be used as passed parameters. "
Is it possible to use an array in the parameters of a function? For example, I want to create a function that handles information in an array:
Try this:
https://docs.mql4.com/ru/basis/variables/formalSame goes for Close - iClose, Open - iOpen, Time - iTime Volume - iVolume etc.
And the indicator can draw up to 8 lines from 0 to 7 https://docs.mql4.com/ru/customind/indicatorbuffers
thanks a lot :) the indicator is still not drawn, i got spikes in lines like price=iL[k]; where iL is my iLow...former Low
Anyway, I found out a lot of useful stuff...but I won't dig any further...
there is a simpler method to visualise the redrawing...without a custom indicator.
What does the textbook say here?
"
The parameters to be passed are indicated in parentheses after the name of the function to be called, and are listed separated by commas. The number of parameters passed to the function must not exceed 64. The function may also not use the passed parameters. In this case, an empty parameter list is indicated, i.e. opening and closing parentheses are placed immediately after the function name.
The number, type and order of the parameters passed in the function call must coincide with the number, type and order of formal parameters, specified in the function description (exception is the call of a function, which has default parameters - see Function call and Function description and return operator). If there is no such coincidence, the MetaEditor will output an error message. Constants, variables, expressions and arrays can be used as passed parameters. "