MQL5 question: why using scripts / OnStart?

 

Hello, please can somebody help me with a basic question.

Just for the background: I am able to create quite complex programs in MQL5, I think I have understood (most of the) basics.

But I do not understand why I would be using "scripts" and the "OnStart" function?


is this a way to make MQL5 programs more modular?

or are scripts only used to be attached to a chart to do some things only once?


I don't get the concept.


If I do write an Expert Advisor, is there still a need to work with scripts?

Many of the examples in the documentation refer to "scripts" and "OnStart", so I would really like to understand how this is supposed to work.

thanks a lot in advance!!!

 
vAbsKXMS9Q3Q2TQD: or are scripts only used to be attached to a chart to do some things only once?

Correct. (Once when attached.)

 

thanks a lot! 

I wonder why this is not explained in a more obvious way in the documentation?

However, thanks for clarifying it here to me.

Reason: