Download MetaTrader 5

Initialization problem - page 2

To add comments, please log in or register
All activity at MQL5.community is clearly visible. Have a look at the Wall!
Gordon Gekko
622
Gordon Gekko 2016.09.29 22:33  

jjc, agreed.

FMIC, I think that an official documentation should be exact and clear, without the needing of "deducible" things/extrapolations.

JC
1456
JC 2016.09.29 22:36  
FMIC:
  • Disable Auto Trading when the account has been changed

I don't see how that's relevant.

If you have a copy of MT4 which has never been connected to a broker, and there is no account to change, then OnInit() is called if you - somehow - have an EA in that installation of MT4 and drop it on a chart. If you then restart that same copy of MT4 with the EA attached to a chart, still with no account details or broker connection, then OnInit() is not called. 

The inconsistent behaviour of OnInit() is not determined by the options you are citing. 

JC
1456
JC 2016.09.29 22:39  
FMIC:

Please note that this thread is about Indicators and the OnCalculate() and not about EA's and OnTick().

You have said that people should refer to the documentation. There is a single page of documentation covering all the events: OnTick(), OnCalculate(), OnStart() etc. By omission, I would say that it is implying continuity and consistency between them. For example, the following description of OnInit() completely fails to describe the different behaviour of EAs and indicators:

The Init event is generated immediately after an Expert Advisor or an indicator is downloaded

 If someone is used to writing EAs - which might or might not apply to the OP - then the different behaviour of OnInit() in an indicator might very reasonably come as a surprise.

The thread cannot just be "about Indicators" because the documentation - which you are referring people to - is not just "about Indicators".

Fernando Carreiro
2346
Fernando Carreiro 2016.09.29 22:41  
jjc:

I don't see how that's relevant.

If you have a copy of MT4 which has never been connected to a broker, and there is no account to change, then OnInit() is called if you - somehow - have an EA in that installation of MT4 and drop it on a chart. If you then restart that same copy of MT4 with the EA attached to a chart, still with no account details or broker connection, then OnInit() is not called. 

The inconsistent behaviour of OnInit() is not determined by the options you are citing. 

If an MT4 has never been connected to a Broker EVER, then it will also not have any valid Market or Symbol data to offer either, rendering the exercise moot.

JC
1456
JC 2016.09.29 22:46  
FMIC:

If an MT4 has never been connected to a Broker EVER, then it will also not have any valid Market or Symbol data to offer either, rendering the exercise moot.

It's not moot. It's a scenario which you have to know about, and cater for, if you are writing EAs for anything other than your own personal use. You have to plan for OnInit() being called in different scenarios on computers other than yours.
Fernando Carreiro
2346
Fernando Carreiro 2016.09.29 22:49  
jjc:
You have said that people should refer to the documentation. There is a single page of documentation covering all the events: OnTick(), OnCalculate(), OnStart() etc. By omission, I would say that it is implying continuity and consistency between them. The differences are hidden behind obscure uses of words such as "usually", as I have already quoted.

Look, we are arguing semantics, and I have already stated that neither of us is going to change our opinions because we are both hard heads.

So, lets just stop this, because the fact of the matter, is that for OnCalculate(), is called even when there is no tick data or connection in order to process any history data that is present. That is a fact and our opinions about whether it is deducible or not, or if it makes sense or not is irrelevant and won't change that fact.

Our arguing is only going to escalate into a bickering flame war, and that is of no use to anyone, especially the OP.

I repeat, lets agree to disagree and move on!

Fernando Carreiro
2346
Fernando Carreiro 2016.09.29 22:53  
jjc:
It's not moot. It's a scenario which you have to know about, and cater for, if you are writing EAs for anything other than your own personal use. You have to plan for OnInit() being called in different scenarios on computers other than yours.
As I have stated, this thread is about Indicators and not EA's. So, lets move on. If you want to start a new thread about the many facets of the OnInit() personality, please do so, but lets not confuse the OP any more on this thread.
JC
1456
JC 2016.09.29 23:00  
FMIC:
As I have stated, this thread is about Indicators and not EA's.

Yes, let's move on. It's anyway time for my annual visit to this forum to end.

I can't resist saying goodbye without pointing out that an OP with 1,200+ posts on this forum probably knows something about both EAs and indicators. It's not unreasonable in that context to raise the significant differences between EAs and indicators. It's very possible that such an OP may be more used to EAs, and expecting EA behaviour from indicators.

Gordon Gekko
622
Gordon Gekko 2016.09.30 09:08  

Yes, I wrote countless stuff in MQL4, and sometimes I used to get interesting things.

FMIC, just one thing: remember this thread.

I think ArrayFill(..) should work with WHOLE_ARRAY (why not?!), logically and based on extrapolation (aka "deducible" things). But it doesn't work.

So, a documentation has to be exact.

Fernando Carreiro
2346
Fernando Carreiro 2016.09.30 11:53  
ggekko:

Yes, I wrote countless stuff in MQL4, and sometimes I used to get interesting things.

FMIC, just one thing: remember this thread.

I think ArrayFill(..) should work with WHOLE_ARRAY (why not?!), logically and based on extrapolation (aka "deducible" things). But it doesn't work.

So, a documentation has to be exact.

All, I have to say is the following. I learned to code in MQL4 and MQL5 from the Official documentation. I use no other system, and the only I times I placed a question on the forum, was twofold - once about the site functionality itself and once with respect to the Strategy Tester and how many bars back it generated.

So, I ask you, how is it that I have gained the knowledge I have and have "deduced all this common sense stuff", when my only source of info is the official Documentation?

For me there is only two reasons and they may be a combination of both:

  1. The Official Documentation is more than adequate for the task
  2. My previous knowledge and experience in other programing languages, such as C and C++ (since the age of 15 back in 1983), helped with the "natural deduction" and "common sense".

Maybe it is just that my own knowledge and experience in coding compilers, makes me more in tune with how MQL works! However, I am not the only one! I have seen several other users here on the forum, that also achieved their own understanding of MQL with only the official documentation.

My conclusion, is that not all brains are wired the same, so one persons documentation will be good for some but not all, and if one should change the documentation to adapt to the other group of people, then the first group will no longer understand it.

In Portuguese we have a saying - It is not always possible to please both Greeks and Trojans at the same time.

12
To add comments, please log in or register