Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 1254

 
Igor Makanu:

TimeCurrent()https://www.mql5.com/ru/docs/dateandtime/timecurrent

use the second version of this function's signature:


ZS: I will write at once - it works in MT4, I used it ;)

UPD: in MT4 I also used Hour() and Minute() - I don't use them for a long time, but they should give the last server time in hours and minutes

Thank you for answering the second part of my question. Minute () is a minute of an hour.
 

Can you advise or guide on how to make a template function with more than 10 input parameters of any type ?

 
Vladimir Pastushak:

Please advise or guide how to make a template function with more than 10 input parameters of any type ?

//+------------------------------------------------------------------+
#define  PRINT(VAL) Print(#VAL," = ",VAL)
template <typename T1, typename T2, typename T3, typename T4, typename T5,
          typename T6, typename T7, typename T8, typename T9, typename T10,typename T11>
void func(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5,
          T6 v6, T7 v7, T8 v8, T9 v9, T10 v10,T11 v11)
{
   PRINT(v1);
   PRINT(v2);
   PRINT(v3);
   PRINT(v4);
   PRINT(v5);
   PRINT(v6);
   PRINT(v7);
   PRINT(v8);
   PRINT(v9);
   PRINT(v10);
   PRINT(v11);
}
//+------------------------------------------------------------------+
void OnStart()
{
   func(1, 1.01, "qwerty", 3.1415 f, 777, 1, 1.01, "qwerty", 3.1415 f, 777,"Value_11");
}
//+------------------------------------------------------------------+

2020.09.13 08:33:57.508 tst (EURUSD,H1) v1 = 1

2020.09.13 08:33:57.508 tst (EURUSD,H1) v2 = 1.01

2020.09.13 08:33:57.508 tst (EURUSD,H1) v3 = qwerty

2020.09.13 08:33:57.508 tst (EURUSD,H1) v4 = 3.1415

2020.09.13 08:33:57.508 tst (EURUSD,H1) v5 = 777

2020.09.13 08:33:57.508 tst (EURUSD,H1) v6 = 1

2020.09.13 08:33:57.508 tst (EURUSD,H1) v7 = 1.01

2020.09.13 08:33:57.508 tst (EURUSD,H1) v8 = qwerty

2020.09.13 08:33:57.508 tst (EURUSD,H1) v9 = 3.1415

2020.09.13 08:33:57.508 tst (EURUSD,H1) v10 = 777

2020.09.13 08:33:57.508 tst (EURUSD,H1) v11 = Value_11

 

How to understand the following line, if(OrderSymbol()==Symbol()&& OrderMagicNumber()==MAGICMA

if(OrderSymbol()==Symbol() && OrderMagicNumber()==MAGICMA)

 
Igor Makanu:

cool

 
odyn:

how to understand

If the order symbol (EURUSD) is equal to the chart symbol and the order magik (12345) is equal to the EA magik, then.....

 
Aleksei Stepanenko:

If the order symbol (EURUSD) is equal to the chart symbol and the order magik (12345) is equal to the EA magik, then.....

thanks!!!

 
odyn:

How to understand the following line, if(OrderSymbol()==Symbol()&& OrderMagicNumber()==MAGICMA

if(OrderSymbol()==Symbol() && OrderMagicNumber()==MAGICMA)

SHAITANA_MA.

Sometimes people write such funny variables :)

 
Can you tell me what the condition is, if the chart went down by even one point, then all orders were closed?
 
SanAlex:

how do you know if the chart has moved? - Maybe the price has gone down. put a stop - really one point, it won't work.

If the chart went down, the pending orders have closed.