Read file for start/stop time? DLL interface or csv/txt?

 

We're all familiar with the option to start or stop our EA's based on a time frame.

ie:

extern string StartTradeTime = "07:00";

extern string StopTradeTime = "22:00";[/CODE]

I've read several items in TSD and ForexFisherman relating to open/close files and calling dll's for read and writing to txt and csv's

I've also seen a link that shows how to read from a file and display indicators that show text along lines: https://www.mql5.com/en/articles/1382

1st question:

How could I modify to have "closing" lines for those indicator lines, such as

a shaded section of time that marks from the "start" to x amount of time after that point (variable 30,60,90 minutes)

What I'm really looking for is a way to read a line from a file like the lines below:

[CODE]date;newStopTime;newStartTime;ReasonCode;CountryOfOrigin

15.05.2006;8:55;9:30; Industrial Production M.M ;Japan;

15.05.2006;16:30;16:45; New York Fed Survey ;USA;

15.05.2006;17:00;17:15; Netto Capital Flow ;USA;

16.05.2006;12:30;12:45; HICP Y.Y ;U.K.;

16.05.2006;13:00;13:15; ZEW Economic Sentiment;Germany;

16.05.2006;16:00;16:15; Wal-Mart Stores Report;USA;

16.05.2006;16:30;16:45; PPI M.M ;USA;

And in reading these lines, updating the :

extern string StartTradeTime = "07:00";

extern string StopTradeTime = "22:00";

or possibly just temporarily stopping the automated trading of the EA during the read times.

I understand I have some time zone issues to address, but can always edit the data file with the necessary timezone data as well. I just want to read the file in such a way that it can be aware of when to stop trading while allowing autotrade to be temporaily turned off, then back on unattended.

Any suggestions?

 

Use the parmonworktime code, it shades teh screen for specific session. You can us ethe code for what you want to do.

====

Here the indicator, it should give you an idea how to mark the charts for a specific time frame.

Files:
 

That's great ET!

This will let me be aware of timeframes that I do want to be more wary of trading on the fundamentals.

Only problem is that this is hardcoded time frames as far as I can tell. (Too much Russian for me to fully understand it yet, give me time)

Ideally, I want to read timeframes from a file and pause/disable the auto-trading EA during those times. My EA currently does sufficiently well unattended autotrading when it stays away from those timeframes, but there are hundreds throughout the year and I may add/modify/delete from the data file as I feel some reports have less effect on my EA then expected. It's tough to stay in front of the screen non-stop.

 

I have some others, will try to locate it, but its tough since I do not recall the name of it. Try this one, it may help...

 
et_phonehome_2:
I have some others, will try to locate it, but its tough since I do not recall the name of it. Try this one, it may help...

Thanks again, ET!

The latest is a modified version of the first, also very useful. Most useful, I think, for those who trade manually since it can alert them to possible fluctuations to look out for.

My main issue is I rarely trade manual and need to read from the file so that I can pull a "Ronco" (That's "Set-it-and-forget-it")

Currently I only check on my EA about 2 times a day, and most of my losses come from those time frames which I am trying to avoid.

I appreciate you looking into these possibilities. Too bad there isn't some sort of naming convention standards that more people adhere too when creating these.

 

As far as I know, there is no way an EA can call another EA, but you may be able to do it with iCustom. This news file that you are reading, is it the same one as posted in the FF forum?

 
et_phonehome_2:
As far as I know, there is no way an EA can call another EA, but you may be able to do it with iCustom. This news file that you are reading, is it the same one as posted in the FF forum?

This isn't trying to call on another EA, just trying to read a line item from a file. The previous link https://www.mql5.com/en/articles/1382 actually reads from a file and displays an indicator for that. I can use that info and combine it with your "shading" iCustom's to get a great effect. I only need 1 EA and I can incorporate almost everything I need in that except for this potentially variable/edited data. I could hardcode the timeframes but that would be less useful to someone else wanting to re-use the coding to pull from an external file.

Essentially though here's the need:

1) Start my EA.

Normal code would be:

extern string StartTradeTime = "07:00";

extern string StopTradeTime = "22:00";[/CODE]

2) EA reads current time

Time is:

> StartTradeTime

< StopTradeTime[/CODE]

3) EA reads external file for next STOP/START time.

File reads:

[CODE]15.05.2006;8:55;9:30; Industrial Production M.M ;Japan;

string StopTradeTime = "08:55";

string StartTradeTime = "09:30";

4) Because these are not daily occurences, but one-time occurrences for each week, or month, or quarter, or year, I need only create the data file to have them listed in order by date/time for the code to read each line consecutively (Next START/STOP time after current time

5) Once the new "StartTradeTime triggers again, it will read the next line in the data file:

[CODE]string StopTradeTime = "11:25";

string StartTradeTime = "11:55";

I honestly don't care if I visually see the indicator of this or not. I just want the EA autotrading to take a break in those timeframes.

Again, ET, I really appreciate your looking into this. I hope your posted indicators have been helpful to other forum members as well.

Reason: