2 questions, please help

 
Hi

I'm hoping someone can help me with these two issues:

1. How do I find Time[0] for 1H timeframe if my indicator is running in 5M timeframe for example?

2. Is there a function that finds whether a particular file exists in a particular directory? Sort of like Dir?

Thank you in advance

M
 
 
Marty73 wrote:

2. Is there a function that finds whether a particular file exists in a particular directory? Sort of like Dir?


Use FileOpen with FILE_READ parameter. If FILE_READ does not combine with FILE_WRITE, the file will be opened only if it already exists.
 
RickD wrote:
Marty73 wrote:

2. Is there a function that finds whether a particular file exists in a particular directory? Sort of like Dir?


Use FileOpen with FILE_READ parameter. If FILE_READ does not combine with FILE_WRITE, the file will be opened only if it already exists.

Rick

What I've been doing so far is using FileOpen and if the handle number returns less than 0 then the file doesn't exist. I think you're suggesting a similar solution. It works but it's sloppy because it runs a nice string of error msgs in the debugger.
 

There is another way. Use Win32API FindFirstFile/FindNextFile.

Reason: