stevehopwoodforex.com
https://www.stevehopwoodforex.com/phpBB3/
Print view

Script to (ATTEMPT) Force Download of historical data
https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?t=254
Page 2 of 6
Author:  NicoScholtz [ Wed Jan 18, 2012 6:34 am ]
Post subject:  Re: Script to (ATTEMPT) Force Download of historical data

Thank you very much! This is most useful! 8-)
Author:  SteveHopwood [ Thu Jan 19, 2012 11:38 pm ]
Post subject:  Re: Script to (ATTEMPT) Force Download of historical data

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
Author:  SteveHopwood [ Tue Jan 24, 2012 5:00 pm ]
Post subject:  Re: Script to (ATTEMPT) Force Download of historical data

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

:D
Author:  RockyJ [ Fri Jan 27, 2012 6:02 pm ]
Post subject:  Re: Script to (ATTEMPT) Force Download of historical data

Matt, this is truly a most helpful script. Many thanks... 8-)
Author:  MiTija [ Tue Feb 07, 2012 1:48 am ]
Post subject:  Re: Script to (ATTEMPT) Force Download of historical data

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
Author:  johnsmily [ Tue Mar 20, 2012 3:37 am ]
Post subject:  Re: Script to (ATTEMPT) Force Download of historical data

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
Author:  fxozgirl [ Tue May 29, 2012 7:27 am ]
Post subject:  Re: Script to (ATTEMPT) Force Download of historical data

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
Author:  mbkennel [ Tue May 29, 2012 7:34 am ]
Post subject:  Re: Script to (ATTEMPT) Force Download of historical data

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!" +
Author:  fxozgirl [ Tue May 29, 2012 8:18 am ]
Post subject:  Re: Script to (ATTEMPT) Force Download of historical data

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.
Author:  SteveHopwood [ Sun Jul 08, 2012 9:50 pm ]
Post subject:  Re: Script to (ATTEMPT) Force Download of historical data

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
All times are UTC Page 2 of 6