Questions from Beginners MQL5 MT5 MetaTrader 5 - page 470

 
Artyom Trishkin:

Why is your hair frizzy? Maybe it's the wrong shampoo? ;)

What's wrong, anyway? Three buffers, each responsible for a different period of calculation.

What's wrong with it?

https://www.mql5.com/ru/forum/1111/page1442#comment_2012053 - described in detail there. :)
About the hair - it's almost gone. :)))
 
Mike:
https://www.mql5.com/ru/forum/1111/page1442#comment_2012053 - described everything there in detail. :)
About the hair - it's almost gone. :)))

First: do all parameters of the separated MAIs in one window coincide with parameters of MAIs created by one indicator with three buffers?

Second: when you have superimposed MAIs in one window on each other, in the parameter "Apply to" (or something like that - I do not remember exactly) what have you selected?

The cat says he can share his hair - he doesn't mind ;)

 

The MQL5 Reference Guide documentationLanguage FundamentalsVariablesInput variables

is given as an example:


#property script_show_inputs 

//--- input parameters
input dayOfWeek swapday=W;

//--- day of week
enum dayOfWeek 
  {
   S=0,     // Sunday
   M=1,     // Monday
   T=2,     // Tuesday
   W=3,     // Wednesday
   Th=4,    // Thursday
   Fr=5,    // Friday,
   St=6,    // Saturday
  };

//Вставляю в советник, только без #property script_show_inputs
//Компилятор ругается:
//'dayOfWeek' - declaration without type   54   7

//Испавляю на:
input int dayOfWeek swapday=W;
//Компилятор пишет шибку:
//'swapday' - semicolon expected                   54   21

Can you please tell me what the problem is?


 
Leo59:

The MQL5 Reference Guide documentationLanguage FundamentalsVariablesInput variables

is given as an example:

Can you please tell me what the problem is?

enum dayOfWeek should be above input dayOfWeek. The second spelling is not correct at all. Plus a piece of advice - don't write such enumeration, the W modifier will be extremely hard to find later.
 
Vasiliy Sokolov:
enum dayOfWeek should be higher than input dayOfWeek. The second variant of writing is not correct at all. Plus a tip - don't write such enumeration, modifier W will be extremely difficult to find later.
THANKS A LOT!!!!
And I ....., out of my simplicity, raised this line above.
Thank you!
 

Comrades, help with the alert please.

I wanted to make that if the previous bar is more than 250 pips, then a notification pops up and a beep appears, the problem is that it chimes every 2-3 seconds... How can we make the indicator wait for 10 minutes, or an alert until the next signal

input int Bar     = 1;
input int pips    = 250;
input bool alert  = true;
input bool sound  = true;
//+------------------------------------------------------------------+
//| expert initialization function                                   |
//+------------------------------------------------------------------+

//+------------------------------------------------------------------+
//| expert start function                                            |
//+------------------------------------------------------------------+


int start()
  {
  //alert criteria
int buy_o, sell_o, buy_go=0, sell_go=0;

int dig;
if (Digits==3)(dig=100);
if (Digits==5)(dig=10000);

double buy_bar=(High[Bar]-Low[Bar]);if(buy_bar>0 && Open[Bar]>Close[Bar]){buy_o=buy_bar*dig;}
if(buy_o>pips){buy_go=1;}

double sell_bar=(High[Bar]-Low[Bar]);if(sell_bar>0 && Open[Bar]<Close[Bar]){sell_o=sell_bar*dig;}
if(sell_o>pips){sell_go=1;}
Comment (buy_o,"_",sell_o);   
 if (buy_go==1) //Signal Buy
 {

if(alert==TRUE){Alert("Покупка: ",Symbol(),", Пунктов:" ,buy_o);}
if(sound==TRUE){PlaySound("alert.wav");} Comment("buy");
 }
 if (sell_go==1) //Signal Sell
 {
if(alert==TRUE){Alert("Продажа: ",Symbol(),", Пунктов:" ,sell_o);}
if(sound==TRUE){PlaySound("alert.wav");} Comment ("sell");
 }




//----------
return(0);
  }
 

Can you tell me how to correctly pass arrays by reference into a function?

#define   SIZE     50 
double   MACD[SIZE];         // Статический массив

int start()
   {
    Fun(     );
   }

int Fun(const double &MACD[    ])
   {
    for(int i=1; i<SIZE; i++)
        {
         if(MACD[i]>MACD[i-1] && MACD[i]>MACD[i+1])
              return(1);
        }
   }
 
Leo59:

Can you tell me how to correctly pass arrays by reference into a function?

#define   SIZE     50 
double   MACD[SIZE];         // Статический массив

int start()
   {
    // Необходимо перед вызовом функции заполнить массив данными
    Fun(MACD);
   }

int Fun(const double & _array[])
   {
    for(int i=1; i<ArraySize(_array)-1; i++)
        {
         if(_array[i]>_array[i-1] && _array[i]>_array[i+1])
              return(1);
        }
   return(0);
   }
You can do it like this
 
Victor Nikolaev:
You can go like this.
Thank you!!!!
 
Artyom Trishkin:

First: do all parameters of the separated MAIs in one window coincide with parameters of MAIs created by one indicator with three buffers?

Second: when you overlaid MAHs in one window, what did you choose in "Apply to" parameter (or something similar - I don't remember exactly)?

The cat says he can share his hair - he doesn't mind ;)

1. All match.
2. There is no such parameter.
I was told in another thread that this problem is unsolvable in MT4. :(
Reason: