[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 503
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
Immediately after attachment to the chart the program starts the init() function. Function init() of attached Advisor or custom indicatorstarts immediately after client terminal start andloading (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 you start the terminal after a long idle time, it will not start at all?
I'm not sure what you want. In your description of init() there are some not quite correct "points" highlighted in red. For example, the client terminal's start is accompanied by loading of historical data and it is incorrect to highlight the word "loading" - it's not the process which starts initialization.
And not everything in life can be touched: at most - to contemplate. :)))) You want to fix the initialization process, i.e. start the init() function - print a notification line inside this function.
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 is logical in this case...
Victor! You have logic, but not enough knowledge. The first, if you do not give it up, will help you go further than a textbook, and to "win" the second - you should start with the same (from a textbook) yet. You are not ready (yet) to build your own logical code structure, go back to the alphabetical version.
P.S. What "catches the eye" in your code:
In the function GetSignal() for search of crossing of two lines the for loop MAY be used, but it is better to use while loop, although this is personal preference. To start with, you need to move a parenthesis like in "Execution cannot be pardoned" to make your code execute what you just said. For some reason, this (result) function lacks results of two functions: GetStochSignal() and GetMomentumSignal() - this is slightly inconsequential.
in functions GetCrossingMa() and GetStochSignal() there is NO point in passing parameters by references, because it would make sense, if these variables inside the function CHANGE their values.
The void GetMomentumSignal() function returns NOTHING.
Although I admit that it's "worse to see" from the outside... :)))
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!
Try this:
To paste the code nicely on the forum press SRC and then there code.
I have a cent account (not a cent light) and 100 Ue in a veshchet and the leverage of 1:500 how do I calculate what the maximum lot I can put? Help! I know that on the price is possible to put a maximum lot of 100, I want to know when I put a lot and me says not enough money something like this)))
hello !!! after upgrading the termenal mt4 the advisor starts working the way it wants ----- maybe there is a way to fix it ??? thanks in advance for the answer !
hello !!! after upgrading the termenal mt4 the advisor starts working the way it wants ----- maybe there is a way to fix it ??? thanks in advance for the answer !
of course there is.
there are cases like thishere.
Please advise how best to truncate the array, so that the values remain.
Suppose we have an array of 16 elements, we need to cut it down by 13 elements, so that the remaining elements 14, 15, 16 with preserved values in them but the array size was 3, not 16, and so the indexes were 14 has become 0, 15 has become 1, 16-2.
Please advise how best to truncate the array, so that the values remain.
Suppose we have an array of 16 elements, we need to cut it down by 13 elements, so that the remaining elements 14, 15, 16 with preserved values in them but the array size was 3, not 16, and so the indexes were 14 became 0, 15-stayed 1, 16-2.
You can do the following: