Script to (ATTEMPT) Force Download of historical data

NicoScholtz
Posts: 4
Joined: Thu Nov 17, 2011 5:44 am

Re: Script to (ATTEMPT) Force Download of historical data

Post by NicoScholtz »

Thank you very much! This is most useful! 8-)
Success is a marathon, not a sprint
User avatar
SteveHopwood
Owner
Posts: 9754
Joined: Tue Nov 15, 2011 8:43 am
Location: Misterton - an insignificant village in England. Very pleasant to live in.

Re: Script to (ATTEMPT) Force Download of historical data

Post by SteveHopwood »

mbkennel wrote:
SteveHopwood wrote:Fantastic again Matt. Many thanks.

I am busy catching up following my internet downtime and have not looked at the code. Is it easily added to our shell code and other EA's such as Graeme, or does it need a lot of adapting?

Cheers Matt. I believe I have mentioned occasionally that you are a star?

:D
It should be easy to add (it is mostly modularized in subroutines), but it can take quite a while to execute.

It tries to download all timeframes. If the EA doesn't use all timeframes, it would take too much time.
And if it is not multipair then it doesn't need to test the other pairs.

And it can fail, or appear to fail, and the next time you run it succeeds as Empty4 and your crims internet catches up. Or doesn't.

We could design a 'library' (I know you hate using real libraries vs cut and paste)

bool attemptDownloadSymbol(string symbol, int time_frame)
if symbol is StringLength()==0, do all, if time_frame is 0, do all. returns true if successful, false otherwise. This could be put into various EA's init().
I have been thinking about this and decided against an implementation in my EA's, for now at least.

Most of them these days include a TradingTimeFrame that allows users to specify a single tf to trade off whilst allowing them to change chart tf's to view a higher picture. This defaults to 0, meaning the current chart, which will change if the user changes the chart tf.

Instead, I shall direct users here and tell them to run the script after starting a new platform. Pity you cannot be paid by the download. :lol:

: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. [email protected] 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.
User avatar
SteveHopwood
Owner
Posts: 9754
Joined: Tue Nov 15, 2011 8:43 am
Location: Misterton - an insignificant village in England. Very pleasant to live in.

Re: Script to (ATTEMPT) Force Download of historical data

Post by SteveHopwood »

I started a new demo today and used the script. It appeared to work a treat.

: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. [email protected] 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.
RockyJ
Trader
Posts: 84
Joined: Sun Dec 18, 2011 3:44 am
Location: Denver Colorado

Re: Script to (ATTEMPT) Force Download of historical data

Post by RockyJ »

Matt, this is truly a most helpful script. Many thanks... 8-)
MiTija

Re: Script to (ATTEMPT) Force Download of historical data

Post by MiTija »

mbkennel wrote:
<snip>

We could design a 'library' (I know you hate using real libraries vs cut and paste)

bool attemptDownloadSymbol(string symbol, int time_frame)
if symbol is StringLength()==0, do all, if time_frame is 0, do all. returns true if successful, false otherwise. This could be put into various EA's init().
Hi Mbkennel,

The last time I looked, Libraries are just not the great in Empty4. It has been a few years since I looked into this, someone might want to do a re-test.

It is my understanding is that all library code gets loaded into memory each time a new EA is loaded. So if you have three (3) EAs running that utilize the same library, then you will find three (3) complete copies of the library in memory. Even though they should be dynamically linked and shared.

So for me, since it is all going to be loaded anyway and to simplify the number of files to track / install, I just put all the code in one *.mqh file that gets included in the program.

I would like to suggest that instead of doing libraries, that a set of common mqh files are created that are included in the EA??? For example, Hanover.mqh, cbi.mqh, trend.mqh, etc... This would create one copy of all the common code in one location. It would greatly simplify code readability and maintenance.

The downside to this method is that it requires a well thought out, squeaky clean interfaces (API). Should an interface be change it might break a different program. This could be resolved by creating wrapper functions to support previous versions of the interface.

Best Regards,


MiTija
johnsmily
Posts: 2
Joined: Tue Mar 20, 2012 3:21 am

Re: Script to (ATTEMPT) Force Download of historical data

Post by johnsmily »

Also, the call to iBars triggers a download, but doesn't wait. So for the first call, it will return zero bars, but it will have queued a request to download the information.!











-----------------------------------------------------------------------------
Trumpet Wedding Dresses|New Style Flower Girl Dresses|Wedding Dresses with Sleeves|New Style Wedding Dresses
User avatar
fxozgirl
Trader
Posts: 1176
Joined: Wed Nov 16, 2011 9:16 am
Location: Melbourne, Australia

Re: Script to (ATTEMPT) Force Download of historical data

Post by fxozgirl »

I have not really used scripts before, so I have a seriously Dummy question regarding this particular script!!

I have upgraded Empty4 to build 427 and since then v1k of Shelley EA is opening/closing trades instantly.
Steve has indicated that this is the sort of problem that occurs if this script is not run when a new platform is installed.

So, I decided to install a brand new platform, and placed the script in the experts/script folder.
When I opened Empty4, I attached the script to the chart and nothing happened. I right clicked on the chart and a message came up asking if I wanted to stop running the script.
So the assumption is it is working.

My question is: assuming what I have done above is correct, do I need to attach the script to every chart I want to trade on?
Also after a minute or so an error message popped up:

Failed: AUDJPY( 1440 10080) AUDUSD( 1440 10080) CADJPY( 1440 10080) CHFJPY( 1440 10080) EURAUD( 1440 10080) EURCAD( 1440 10080) EURCHF( 1440 10080) EURGBP( 1440 10080) EURJPY( 1440 10080) EURNZD( 1440 10080) EURUSD( 1440 10080) GBPCHF( 1440 10080) GBPJPY( 15 60) GBPUSD( 15 30 60) USDCAD( 15 30 60 240 43200) USDJPY( 5 15 30 43200)

There is no tick data for any of these pairs in the timeframes indicated.

Also, I attached the EA again and still opened/closed trades immediately.

Any guidance here will be appreciated!

Thanks
mbkennel
Trader
Posts: 29
Joined: Tue Dec 20, 2011 5:40 am

Re: Script to (ATTEMPT) Force Download of historical data

Post by mbkennel »

You have to run it on only one chart.

Often, not all the data loads on the first attempt. It's not the fault of the script.
Wait a minute, and try it again.

Often, not all the data loads on the second attempt. Or the third attempt. It's not the fault of the script.
Wait a minute, or an hour, or a day or a fortnight, and try it again. Or choose a new criminal and bask in new, foolish innocence for a moment, and repeat.

8-)

In other words. It's not you, it's me. :)

It is also very easy to write an EA which opens and then immediately closes a trade without any bad or missing data. It's known as a bug, e.g. If your conditions to open a trade are not mutually exclusive from your conditions to close a trade. Fixing this requires a full understanding of the method and the code.

Even if you have mutually exclusive conditions, if the conditions flip within a bar when price changes by a pip or two, you can also get the same problem.

As Barbie said "programming class is hard!" +
"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
fxozgirl
Trader
Posts: 1176
Joined: Wed Nov 16, 2011 9:16 am
Location: Melbourne, Australia

Re: Script to (ATTEMPT) Force Download of historical data

Post by fxozgirl »

mbkennel wrote:You have to run it on only one chart.

Often, not all the data loads on the first attempt. It's not the fault of the script.
Wait a minute, and try it again.

Often, not all the data loads on the second attempt. Or the third attempt. It's not the fault of the script.
Wait a minute, or an hour, or a day or a fortnight, and try it again. Or choose a new criminal and bask in new, foolish innocence for a moment, and repeat.

8-)

In other words. It's not you, it's me. :)

It is also very easy to write an EA which opens and then immediately closes a trade without any bad or missing data. It's known as a bug, e.g. If your conditions to open a trade are not mutually exclusive from your conditions to close a trade. Fixing this requires a full understanding of the method and the code.

Even if you have mutually exclusive conditions, if the conditions flip within a bar when price changes by a pip or two, you can also get the same problem.

As Barbie said "programming class is hard!" +
Thanks for your quick response...the data has now loaded.

I was more not sure if I was actually attaching it correctly, it was more ignorance rather than impatience.
User avatar
SteveHopwood
Owner
Posts: 9754
Joined: Tue Nov 15, 2011 8:43 am
Location: Misterton - an insignificant village in England. Very pleasant to live in.

Re: Script to (ATTEMPT) Force Download of historical data

Post by SteveHopwood »

Matt, the more often I start a new platform and use your script, the more indispensable it becomes.

Would you consider adding some chart feedback that shows what the script is getting up to whilst it is running? Please? Pretty please? With bright yellow wellies? :lol:

: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. [email protected] 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.
Post Reply

Return to “Coders Hangout”