Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 578
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
Didn't come up with it myself"Just make sure you update the data in OnTimer() to make your code work. "
How should I do it?
Do you have an offline schedule?
Can you tell me how to get the bottom indicators from a timeframe other than the one the owl is hovering on?
1. Why did you hang the bird up? Isn't it a pity?
2. Have you ever opened the help? To receive indicator data in the Expert Advisor from any timeframe is not a problem at all because the first two parameters of functions of receiving indicator data are used to specify the symbol and period of the chart from which you want to receive values.
Indeed, even when you type the code in the editor, the list of formal variables of the function is opened, and a tooltip there shows the symbol and timeframe. Strange that you didn't pay attention to them.
Do you have an offline schedule?
No.
No.
Then why the constant refresh without need?
Do you need time? You can get the time of last tick: TimeCurrent(), or the last local time: Time Local().
If you get the time of the last tick at weekend, the timer will not help - the time will be the last tick on Friday, or the last tick of the last working day. And TimeLocal() will not give you server time - you need to recalculate it with an offset.
However, I don't know exactly what you want to get in the end.
1. Why did you hang the bird up? Isn't it a pity?
2. Have you ever opened the help? To receive indicator data in the Expert Advisor from any timeframe is not a problem at all because the first two parameters of functions of receiving indicator data are used to specify the symbol and period of the chart from which you want to receive values.
Indeed, even when you type the code in the editor, the list of formal variables of the function is opened, and a tooltip there shows the symbol and timeframe. Strange that you didn't pay attention to them.
2018.07.04 22:17:38.398 2016.11.10 13:00:00 Arap01 EURUSD,H1: Rounding 44.53781512605145 45.0 This is stochastic data in "normal" mode. ie:
2=iStochastic(NULL,0,K,D,slowing,Average_method,price_field,MODE_MAIN,2);
here I ask M5 2=iStochastic(NULL,5,K,D,slowing,Average_method,price_field,MODE_MAIN,2);
I get 2018.07.04 22:23:05.680 2016.11.10 13:00:00 Arap01 EURUSD,H1: Rounding 0.0 0.0
However, I don't know exactly what you want to end up with.
Alert, I want, two seconds before the bar closes. I won't be working over the weekend.
So I need an alert two seconds before the bar closes without a tick.
It is not easy to do, you need to run more accurate timer (at least 500 ms) and previously do synchronization of local time and server time.
I've already told you about this:
At the moment of tick arrival, count the difference TimeCurrent()-TimeLocal()
(this is done once to synchronize local and server time)
- This is the offset relative to the broker, if this offset changes later, the time should be recalculated;
- at the Expert Advisor start (orat appearance of barD1) we recalculate all the necessary times again, in the local time, taking into account the offset;
- We wait for what we "counted" in the timer, checking for desynchronization, loss of connection with the broker, translation of the local hands.
It's not easy to do, you have to run a more accurate timer (at least 500ms) and pre-synchronize the local time with the server time.
You can catch +/- 1 secondI've already told you about it:
Thank you. How to make the time in seconds, before the M5 bar closes. Right now it's displaying H1.