![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
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
Just some observations....
The datetime declaration needs to be STATIC or make sure it's on the on the global scope. You don't need D'1970.01.01 00:00:00'. zero is fine and the same thing as that date. infact, you don't even need =0 as this is the default value for any declared variable. Also, assuming time_period=0 (which it needs to be), Time[0] is the same as iTime(NULL,time_period,0) and faster to type!
Hope that's of use
V
Oh... and
Thanks for SRC I was not aware will try next time
Just some observations....
The datetime declaration needs to be STATIC or make sure it's on the on the global scope. You don't need D'1970.01.01 00:00:00'. zero is fine and the same thing as that date. infact, you don't even need =0 as this is the default value for any declared variable. Also, assuming time_period=0 (which it needs to be), Time[0] is the same as iTime(NULL,time_period,0) and faster to type!
Hope that's of use
V
Oh... and
Hi
Why STATIC - it is working as I have it there - What problems can jump up that I am not aware of? I use iTime because I force differnet time frames and not just the current time frame of the current chart.
Thanks for the reply it always helps!!
Hi
Why STATIC - it is working as I have it there - What problems can jump up that I am not aware of? I use iTime because I force differnet time frames and not just the current time frame of the current chart.
Thanks for the reply it always helps!!
is inside start(), that means every tick current_bar_opentime will be set to ...well 0 and will therfore always be != iTime(NULL,time_period,0).
it's explained fully here ..https://book.mql4.com/variables/types
V
This happens because when EA is started New_Time is 0 and Function_New_Bar() returns true. You can avoid this with the following code:
My question might sound quite ridiculous, but I don't really know -even after analyzing mql4 documentation (https://docs.mql4.com/predefined/variables/volume) -what is that volume variable for. I know only, that if local history is empty, function returns 0. After writing script which writes down 50 last values of volume i got inputs which varies between 30 and 50. Does it denote any change of price in pips during single tick or it's any measure of volume of transactions made on forex market during every single tick - which btw would be sort of imponderabilia ? If it's so, then how is it evaluated- in brokers dealing rooms?
My question might sound quite ridiculous, but I don't really know -even after analyzing mql4 documentation (https://docs.mql4.com/predefined/variables/volume) -what is that volume variable for.
This happens because when EA is started New_Time is 0 and Function_New_Bar() returns true. You can avoid this with the following code:
Hi,
First off all thank you all for your posts and help in coding.
As in this topic in my opinion best works this:
And if you need different time frame use something like this:
instead Time[0].
This one is my first and shortest option.
Hi,
First off all thank you all for your posts and help in coding.
As in this topic in my opinion best works this:
And if you need different time frame use something like this:
instead Time[0].
This one is my first and shortest option.
Doesn't this do the same thing?
It is more concise and dispenses with the unnecessary variable New_Bar
Doesn't this do the same thing?
It is more concise and dispenses with the unnecessary variable New_Bar