Please explain what could be wrong with this function? - page 2

 
Alexey Viktorov:
All the answers are in the post above.

Forum on trading, automated trading systems and strategy testing

Please explain what can be wrong with this function?

Karputov Vladimir, 2016.06.23 20:42

Since the author is unwilling, I'll try:

...

It remains to decide, what structure "mqlDateTime" is and where to declare variables "oldDay" and "oldHour"...

The code should compile. At the same time it should have a minimal look.
 
Karputov Vladimir:
The code must compile. It should have a minimal look and feel.

What's the problem? The code compiles.

https://www.mql5.com/ru/forum/89213#comment_2597888

Sorry, in the code the line

if((int)mqlDateTime.hour == 21)

has been changed to.

if((int)mqlDateTime.hour == 0)

21 was put to check at the moment, not working with a value of 0.

 
Alexey Viktorov:

What's the problem? The code compiles.

https://www.mql5.com/ru/forum/89213#comment_2597888

Didn't notice... Two posts at once one after the other. It happens.
 
What does "#property strict" have to do with it? Please post the mql5 code. With name and extension. Respect the forum members. No one should speculate.
 
Karputov Vladimir:
Didn't notice... Two posts at once one after the other. It happens.
It also happens, while there is no reply, the post is modified. Please note.
 
Karputov Vladimir:
What does "#property strict" have to do with it? Could you please post the mql5 code? With name and extension. Respect the forum members. No one should speculate.

1. Does "#property strict" harm code performance? In what cases should it be present?

2. Well, everyone may give a name to a test Expert Advisor at his own discretion. But I will not argue.

Files:
00.mq5  3 kb
 

Can you find out which server and access point was connected to up to this point?

PM      1       02:13:39.422    Network '3265046': connection to MetaQuotes-Demo lost
GF      2       02:13:39.582    MQL5.community  authorization failed
DO      2       02:13:39.682    MQL5.community  authorization failed
IP      2       02:13:40.052    MQL5.community  authorization failed
PK      0       02:13:43.252    Network '3265046': authorized on MetaQuotes-Demo through Access Point RU Moscow (ping: 117.48 ms)
DI      0       02:13:43.252    Network '3265046': previous successful authorization performed from 31.173.80.184 on 2016.06.21 14:55:11

?

 
Karputov Vladimir:

Can you find out which server and access point was connected to up to this point?

?

Apparently this

NF      0       14:55:07.839    Terminal        MetaTrader 5 build 1347 started (MetaQuotes Software Corp.)
MH      0       14:55:07.839    Terminal        Windows 7 Home Premium (x64 based PC), IE 11.00, UAC, AMD FX-4170 Quad-Core Processor , RAM: 10709 / 12255 Mb, HDD: 58156 / 244198 Mb, GMT+03:00
RK      0       14:55:07.839    Terminal        D:\MetaTrader 5\MetaTrader 5
MP      0       14:55:08.459    Experts expert Toad Green (EURUSD,M15) loaded successfully
CQ      0       14:55:09.109    Network '3265046': authorized on MetaQuotes-Demo through Access Point EU Frankfurt (ping: 121.73 ms)
OJ      0       14:55:09.109    Network '3265046': previous successful authorization performed from 31.173.80.155 on 2016.06.21 07:48:23
LI      0       14:55:09.269    Network '3265046': terminal synchronized with MetaQuotes Software Corp.
OD      0       14:55:09.269    Network '3265046': trading has been enabled - hedging mode
RL      0       16:51:10.491    Trades  '3265046': deal #73382846 buy 0.01 EURUSD at 1.12462 done (based on order #87977999)
FN      0       16:51:10.511    Trades  '3265046': deal #73382847 buy 0.01 EURUSD at 1.12462 done (based on order #87978000)
CI      0       17:09:19.793    Network '3265046': scanning network for access points
MI      0       17:09:33.773    Network '3265046': scanning network finished
GN      0       20:31:34.122    Experts expert Toad Green (USDJPY,M15) loaded successfully
OD      0       23:09:20.196    Network '3265046': scanning network for access points
NR      0       23:09:33.496    Network '3265046': scanning network finished
 

This is what I am currently observing...

At 0:00 EA was on EURUSD and USDJPY orders did not open. After removal of the EA and resetting it on the charts the orders opened.

Around 10:00 I left only one EA on my account with orders opening at 10:00... The orders opened.

Then I started experimenting with the test EA I posted here. I placed it on EURUSD and USDJPY opening at 11:00 and got results.

2016.06.24 11:00:07.225 00 (USDJPY,M15) Ордер должен откыться. 
2016.06.24 11:00:07.225 00 (USDJPY,M15) ***** newHour true
2016.06.24 11:00:07.225 00 (USDJPY,M15) USDJPY m_tOld 1970.01.01 00:00:00 tNew 2016.06.24 11:00:00
2016.06.24 11:00:07.225 00 (USDJPY,M15) ***** newDay true mqlDateTime.hour 11
2016.06.24 11:00:07.225 00 (USDJPY,M15) USDJPY m_tOld 1970.01.01 00:00:00 tNew 2016.06.24 00:00:00
2016.06.24 11:00:05.722 00 (EURUSD,H1)  ***** newHour true
2016.06.24 11:00:05.722 00 (EURUSD,H1)  EURUSD m_tOld 2016.06.24 10:00:00 tNew 2016.06.24 11:00:00

EURUSD didn't work...

My question is: WHY?

Now I've changed the opening time to 12:00 and let's see what will happen.

I'm going to delete Expert Advisors from charts and rebuild them to make my experiment clean.

 
Alexey Viktorov:

This is what I am currently observing...

At 0:00 EA was on EURUSD and USDJPY orders did not open. After removal of the EA and resetting it on the charts the orders opened.

Around 10:00 I left only one EA on my account with orders opening at 10:00... The orders opened.

Then I started experimenting with the test EA I posted here. I placed it on EURUSD and USDJPY opening at 11:00 and got results.

EURUSD didn't work...

My question is: WHY?

Now I've changed the opening time to 12:00 and let's see what will happen.

I'm going to delete Expert Advisors from charts and rebuild them to make my experiment clean.

You are trying to get data from an alien symbol? Without checking?(Organisation of data access)
Reason: