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
Hi @Carl Schreiber
Is the DealWithTime.mqh have problem working on weekend, even in StrategyTester?
It is returning following error:
You have really made a very useful utility, however complexities involved to implement it in an Indicator or an EA, are outweighing against its benefits. (Or may be my skills are not yet upto mark) :(
Regards
Could it be that you broker does not offer quotes for that and previous times? Have you checked that?
Beside that the time around Christmas (~Dec.20 .. Jan. 8) are not the best for backtests!Hi @Carl Schreiber
Sorry for my above comment, please ignore it. I was really frustrated, as I was having so many challenges for my project VolumeProfile Indicator.
I have tried to incorporate following methods into your code and somehow succeeding to get results. Will keep you posted on developments.
The Constructor method ...
The Support Methods OnTick and IsNewBarH01 ...
With this I am able to run the code without error Assigning the broker offset went wrong - somehow.
Additional fine tuning is still on to make it a workable solution.
Could it be that you broker does not offer quotes for that and previous times? Have you checked that?
Beside that the time around Christmas (~Dec.20 .. Jan. 8) are not the best for backtests!Hi Carl
Thanks for taking off time to reply me.
With the changes as mentioned above, I am able to run it without error in EA. So the Broker is providing data for these days.
Yeh you have a valid point that " Beside that the time around Christmas (~Dec.20 .. Jan. 8) are not the best for backtests!" :)
However, since it is not strategy BackTest, but just to make sure that my VolumeProfile OOP Class is working well and returning correct Session Times.
Have a nice weekend and take care.
Amazing job! Thank you!
:)
Very inspiring library!
a little suggestion about macro expansions
t needs to be enclosed in parentheses to avoid side effects inside these macros DoWi, SoW, rndHoT, BoW.
without the small fix, the above prints 1, 5
Very inspiring library!
a little suggestion about macro expansions
t needs to be enclosed in parentheses to avoid side effects inside these macros DoWi, SoW, rndHoT, BoW.
without the small fix, the above prints 1, 5
Thanks, I hadn't thought of such an application, will change that...
Forum on trading, automated trading systems and testing trading strategies
Libraries: Dealing with time (2) functions
Anil Varma, 2024.02.10 10:39
Hi @Carl Schreiber
Is the DealWithTime.mqh have problem working on weekend, even in StrategyTester?
It is returning following error:
You have really made a very useful utility, however complexities involved to implement it in an Indicator or an EA, are outweighing against its benefits. (Or may be my skills are not yet upto mark) :(
Regards
I also found the same error today (Saturday) when testing the library.
The BoW(t) macro has a bug.
If (t) is anytime in Saturday, BoW(t) calculates the beginning of the NEXT WEEK (wrong ?!), not current week.
This is a fixed version of BoW()
#include "DealingWithTime.mqh" // to use BoW(t) -- !!! Note: if (t) is Saturday, BoW(t) returns the begining of the NEXT WEEK (wrong ?!), not current week. #define BoW_fixed(t) ((t)-((t)+345600)%604800)
Thanks @amrali to point out the bug.
Will incorporate into my revised version of the Class.
I also found the same error today (Saturday) when testing the library.
The BoW(t) macro has a bug.
If (t) is anytime in Saturday, BoW(t) calculates the beginning of the NEXT WEEK (wrong ?!), not current week.
This is a fixed version of BoW()
Hi @amrali
I was trying to run it again today (my CurrentTime 17-Feb-2024 15:47 UTC+5.30) which is Saturday.
Facing error ... Assigning the broker offset went wrong - somehow. Error occurring in checkTimeOffset() and I have tried to put do..while loop to allow 10 attempts to setBrokerOffset().
The error happened with BoW as well as BoW_fixed variable. I am getting same datetime value with both of them.
Worst thing is there is no Error message, even in the debugging mode, as why it failed to set.
got totally different results in another run :( ... this time it did setBroker which lead to correct time calculation for Asian/LON/NYC session time in my Broker's Server time. This matched with times at https://www.babypips.com/tools/forex-market-hours. I did used variable ... BoW_fixed (Though BoW and BoW_fixed returned same value)
when set this setting on ...
2024.02.17 16:52:15.694 2024.02.01 01:01:00 CDealWithTime::checkTimeOffset: TimeCurr[2024.02.01 01:01] BoW[2024.01.28 00:00] BoW_fixed[2024.01.28 00:00] setBokerOffset attempt[1] isTimeSet[true]
2024.02.17 16:52:15.694 2024.02.01 01:01:00 DealWithTimeV2.03.mqh[513] OffsetBroker.set[true]
seems more testing is required :)