Common Prob #1: Time, DST, Broker Offset, Universal Chart

Post Reply
User avatar
ironrick
Trader
Posts: 85
Joined: Wed Nov 16, 2011 7:04 pm
Location: North Idaho Boy, USA

Common Prob #1: Time, DST, Broker Offset, Universal Chart

Post by ironrick »

Common Prob #1: Time, DST, Broker Offset, Universal Chart

We all know the frustrations of Empty4 and dealing with all the different:
-- World timezones
-- Daylight Savings Times (and dates) and
-- Criminal GMT Offsets
-- Differing New Bar (and especially Daily Bar) start times

Which of course lead to:

-- Strategies can't be tested/correlated with different Criminals
-- Strategies that use time based Breakouts or Market openings as part of the strategy get messed up
-- Backtesting (visual or ST) gets messed up because of time offsets, wrong DST, or wrong timezone
-- Maybe most important: different (read: inconsistent) New Bar start times (I know I repeated it)

And a host of other problems/challenges. This is only talking on the technical end of things -- now when we address the volume of posts on this forum related to questions and issues on the matter of time, hours, bars, GMT, etc... NOOBS or not! I would guess almost 1/10+ of the posts here are related to Empty4's handling of time.

NOW add on how many hours get wasted by tests we are all running on different EAs that end up being apples to oranges comparisons because a certain person is using a different broker/time/bar offset... or is one hour off in their calculation from GMT... (None of us is immune to simple human error.)

There HAS to be a unified solution. I want to hear yours. All ideas welcome.

I will propose mine below. Don't know if it is technically feasible... But we won't know unless we try.

Remember those Grey Cells!

Rick
"A problem well put is half solved."
User avatar
ironrick
Trader
Posts: 85
Joined: Wed Nov 16, 2011 7:04 pm
Location: North Idaho Boy, USA

Re: Common Prob #1: Time, DST, criminal Offset, Universal Ch

Post by ironrick »

My solution centers around 2 parts. Part 1 has many partial solutions and workarounds. Try to read all the way through so that you can see how both parts work together.


Part #1: Universal Time.

We need a way to get all of us ONTO GMT. No matter what our offset, everything that we code needs to be able to reference a universal time, independent of broker clocks and local timezone.

eg, A universal way to translate GMT --> through the broker timezone --> and/or broker offset --> through to Local timezone --> with correct DST and back through to GMT again.

If we can programatically do this so we can always reference a universal clock we can move on to....

Part #2: Universal Charts.

This is where things get interesting (at least in my head. Maybe it won't work...but I can always hope!) Is there a way that we can all be looking at the SAME Bars for EVERY timeframe that say and start at the SAME time? (Except for the differences between different broker feeds. I don't think we can fix that)

Is there a way that we can all be referrencing a universal chart -- a chart that always has it's daily bar start at 0:00 GMT with all other TF's bars based on that start time -- no matter what the broker offset is?

My understanding is that this can be done with "offline charts". However, I believe there are many indicators that don't run correctly with that mode.

Is there another solution? Khalid and George briefly discussed this here: http://www.stevehopwoodforex.com/phpBB3 ... 7169#p6477

and George pointed to this: http://forum.mql4.com/17169

This looks to be the best of both worlds. It is what really got me thinking in this direction.

If we can get a..."module"... that combines part 1 and part 2 so that we all see, trade, and test on a broker agnostic, universal chart -- holy smokes I think it would be a HUGE help to all of us!

ADDED BONUS: If we went this route we would be able to easily build out any other non-native TF that we need. Want an 8 hr bar? Poof. A 12 hr bar. No problem.

What do you think? Is it something doable? Have a better idea?

Sing out!

R
"A problem well put is half solved."
mbkennel
Trader
Posts: 29
Joined: Tue Dec 20, 2011 5:40 am

Re: Common Prob #1: Time, DST, criminal Offset, Universal Ch

Post by mbkennel »

I've already solved problem #1. Look for LibGMT.h, I posted it here.

For #2, the only real problem is 4H and 1D bars, week and month bars aren't really a big deal.
As you recognize, both can be synthesized from 1H bars.

For this issue you use #1, and program any internal computations to figure things out using the 1H timescale only.
"It is a capital mistake to theorize before one has data." Sir Arthur Conan Doyle.
"If your experiment needs statistics, you ought to have done a better experiment" Lord Rutherford.
User avatar
mobthehop
Trader
Posts: 362
Joined: Wed Nov 16, 2011 12:16 am

Re: Common Prob #1: Time, DST, criminal Offset, Universal Ch

Post by mobthehop »

Not sure to what extend this is applicable to what you like to achieve but here is a link to a dashboard that includes auto GMT offset - thought u might like to have a look at the code....

http://www.forexfactory.com/showthread. ... ost4719903
User avatar
ironrick
Trader
Posts: 85
Joined: Wed Nov 16, 2011 7:04 pm
Location: North Idaho Boy, USA

Re: Common Prob #1: Time, DST, criminal Offset, Universal Ch

Post by ironrick »

mbkennel wrote:I've already solved problem #1. Look for LibGMT.h, I posted it here.

For #2, the only real problem is 4H and 1D bars, week and month bars aren't really a big deal.
As you recognize, both can be synthesized from 1H bars.

For this issue you use #1, and program any internal computations to figure things out using the 1H timescale only.
In point of fact, it was also your library that got me thinking through this whole process -- I had meant to include a link and comment in the first post and simply forgot. I will update to reflect your contribution!

Part of my point and hope here is to increase visibility and unify some of the tools we already have to the point of having a complete and usable solution.

Thank you for your feedback and participation!

R
"A problem well put is half solved."
magft
Trader
Posts: 195
Joined: Tue Nov 15, 2011 9:59 pm
Location: East Midlands, UK

Re: Common Prob #1: Time, DST, criminal Offset, Universal Ch

Post by magft »

Does the inidicator in the link alllow EAs to run on offline charts? I had an older version that didnt work so i added the required code for the Fratelli EA. Cant test right now but i added the missing bit of code that is used to the updated version of the indicator.

Give it a try and let me know if there are any issues. I like this idea for testing EAs should help.

Mike
You do not have the required permissions to view the files attached to this post.
johnsmily
Posts: 2
Joined: Tue Mar 20, 2012 3:21 am

Re: Common Prob #1: Time, DST, criminal Offset, Universal Ch

Post by johnsmily »

And a host of other problems/challenges. This is only talking on the technical end of things -- now when we address the volume of posts on this forum related to questions and issues on the matter of time, hours, bars, GMT, etc... NOOBS or not! I would guess almost 1/10+ of the posts here are related to Empty4's handling of time !











-----------------------------------------------------------------------------
Trumpet Wedding Dresses|New Style Flower Girl Dresses|Wedding Dresses with Sleeves|New Style Wedding Dresses
User avatar
SteveHopwood
Owner
Posts: 9904
Joined: Tue Nov 15, 2011 8:43 am
Location: Misterton - an insignificant village in England. Very pleasant to live in.

Re: Common Prob #1: Time, DST, criminal Offset, Universal Ch

Post by SteveHopwood »

You are perhaps becoming to understand why I insist on using local time in all my time inputs.

So, a strategy depends on a specific start time, and there is an input StartTime.

Said start time is the London opening.

You live in India. Or Australia. Or Greenland. Or Mars.

You look at your clock when London opens, then enter into StartTime the time that shows on your clock in India. Or Australia. Or Greenland. Or Mars.

I have never understood why coders and traders have found this concept so hard to understand.

Beat yourself up over time zones and that is all you will ever achieve - beating yourself up. Every time you come up with the solution to some dimwit asking, £Eh, whut?" some other dimwit will come up with the same question.

:D
Read the effing manual, ok?

Afterprime is the official SHF broker. Read about them at https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?p=175790#p175790.

I still suffer from OCCD. Good thing, really.

Anyone here feeling generous? My paypal account is always in the market for a tiny donation. pianodoodler@hotmail.com is the account.

To see The Weekly Roundup of stuff you guys might have missed Click here

My special thanks to Thomas (tomele) for all the incredible work he does here.
mbkennel
Trader
Posts: 29
Joined: Tue Dec 20, 2011 5:40 am

Re: Common Prob #1: Time, DST, criminal Offset, Universal Ch

Post by mbkennel »

He he steve. If you used libGMT.h your EA would need no inputs if it were always 8AM London, and nobody bugging anybody with questions.

What would Steve Jobs say? Both Server Time and Local Time are wrong answers.

Since you don't like libraries you can even copy & paste the damn subroutines.
"It is a capital mistake to theorize before one has data." Sir Arthur Conan Doyle.
"If your experiment needs statistics, you ought to have done a better experiment" Lord Rutherford.
Post Reply

Return to “Coders Hangout”