[ARCHIVE!] Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Can't go anywhere without you - 4. - page 502
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
It describes an option to stop the task running. I don't know if this will cause the platform to shut down, I'll give it a try.
" I want to do it in order not to get the same data in different f-functions. I do not think it is reasonable to calculate the same masks in 2 or more functions. It's easier to calculate once and that's it. Why waste additional resources on this?
Do as it says in the documentation and don't reinvent the wheel.
What does this cycle have to do with anything?
Go through the steps yourself, what happens when you exit it and what do you do with it next? It's nonsense.
You do it like in the tutorial - all trade signals in this definition definition of trade criteria - in series (you can wrap them in different functions and then work with them when checking whether these trade criteria work), then the conditions for their work.
Regarding the cycle, it is because I will check the intersection of indicator parameters. It's all elementary here. I read it and it is written the way I think it is.
The textbook in general https://book.mql4.com/ru/build/conditions is all bunched up. I've got MACD and stochastic in one function, I don't need it.
In fact, all of the indicator values in the link should be transferred to the appropriate functions. Why not? This is logical.
What you tell and what you "draw" - TWO BIG DIFFERENCES!!! :))
I'm getting a bit confused now. Here are 3 functions, each of which receives a specific signal for a specific indicator.
This function receives general signal from all indices and makes decision to BUY or SELL.
This is the main function that receives the general signal; here we get the values of indices through the loop to go through all the bars, of course... And then the obtained values are passed by reference to the appropriate functions where these values are needed, i.e. to the functions:
int GetCrossingMa(double& i_maFast1, double& i_maFast2, double& i_maSlow1, double& i_maSlow2)
int GetStochSignal(double& stochD1, double& stochD2, double& stochK1, double& stochK2)
void GetMomentumSignal() , in principle, can also be put there.
Thus, all the calculations of the indices will be in one main function of getting the signal. Everything here is logical.
Immediately after attachment to the chart the program starts the init() function. Function init() of attached Advisor or custom indicator starts immediately after client terminal start and loading (it concerns only advisors and not indicators) of historical data, after a change of symbol and/or chart period, after recompiling the program in MetaEditor, after a change of input parameters from the EA or custom indicator settings window. The Expert Advisor is also initialized after a change of account.
Can you explain how it works? In the background, or can this be tracked somehow? Or the init function in the indicator, when I start the terminal after a long idle time will not start at all?
Immediately after attachment to the chart the program starts the init() function. Function init() of attached Advisor or custom indicator starts immediately after client terminal start and loading (it concerns only advisors and not indicators) of historical data, after a change of symbol and/or chart period, after recompiling the program in MetaEditor, after a change of input parameters from the EA or custom indicator settings window. The Expert Advisor is also initialized after a change of account.
Can you explain how it works? In the background, or can this be tracked somehow? Or the init function in indicator at the start of the terminal will not start after a long idle time?
The init function is intended for storing data that will not be changed during the whole running of the EA. This can be some data that will be calculated only once after the program is loaded and no more re-calculations are needed. This is how I understand it.
And if values of variables need to be recalculated, for example, with each arrival of a new bar, then we shouldn't declare such variables in the init function, since they won't be recalculated there.
To make it easier to understand, this is what can and should be declared in init:
This is collection of data from the market, and this data is not changed. Although it's a question with Spread variable... if spread is not fixed, it's better to put it in separate functions.
The init function is used to store data that will not be altered during the lifetime of the EA...
You're answering off-topic, once again - the init() functionis started afterloadinghistorical data (this only applies to Expert Advisors, not to indicators) - how do you understand that (I want to feel it)?
Taking a pawn on a pass - I know there is such a rule, but I don't know how to apply it (it's clearer)?
Good day everyone. please help, i have a combination of candlesticks and i would like them to work on different time scales. By way of example
if(iHigh("EURUSD",PERIOD_M5,1)>iLow("EURUSD",PERIOD_M5,1)+8*kio*Point)
{
go_s=true;
}
I thought I could bind my combination using iHigh, iLow, iOpen, etc. But when tested on M5 it shows one result but on other timeframes another. Please help what i am doing wrong. Thank you!
...
The textbook https://book.mql4.com/ru/build/conditions is all bunched up. It has MACD and stochastic in one function, and I don't need it that way.
And in fact, all of the indicator values by the link should be passed to the appropriate functions. Why not? This is logical.
Thus, it turns out that all of the calculations of indices will be in one main f-function of getting the signal. It all makes sense.
Sorry, but it looks like you are still at the very beginning of the food chain, that's exactly where "everything is logical". :-)
Make it like a STUDY BOOK and DOCI, and then wrap it in separate functions and get a trading criterion in the result.
In the tutorial - all is at once registered in the resultant, you can register your f-i-tions - separately, and the RESULTING is drawn as in the tutorial! No loop or parameter value transfer by reference is needed here!
P.S. And in general, first disassemble the code expos - all in the tutorial and a few in kodobase - just everything falls into place.