You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
How can I clear/delete a txt file
Hi,
I am using this functions:
File Operations via WinAPI - MQL4 Articles
How should I clear the text in my csv-File?
Or how can I delete it?
To clear the file use _lcreat(simply create a new empty file)
To delete the file you could use DeleteFileAor DeleteFileWfunctions (they are not declared in that example but are in the same kernel32.dll library - both are having a single argument - a string containing the name and the path of the file to delete)
Hi,
I am using this functions:
File Operations via WinAPI - MQL4 Articles
How should I clear the text in my csv-File?
Or how can I delete it?and to make it withe colour rsi w/ alert?! color_rsi_with_allert.mq4
Hiyieldrater2
Here is this version. It is using a regular rsi not the one you proposed. There are a couple of reasons but the main reason is that Figuerelli rsi depends on the number of bars it is calculated on what result you are going to get. Here is a simple comparison of the same indicator calculated for 5000 bars (upper) and 1000 bars (lower)
Have a nice weekendfor rsi + pivots - #466
and to make it withe colour rsi w/ alert?! color_rsi_with_allert.mq4
Hi, thank you for your tipp,
but both functions
bool DeleteFileA(string buffer);
and
bool DeleteFileW(string buffer);
doesn't work :-(
I only got "false" als return value.
Do you have another tipp?!
Make sure that the file is closed (by any instance of code(s)) before you try to delete it. Other than that, if the path and the file name are correct, it should work
Hi, thank you for your tipp,
but both functions
bool DeleteFileA(string buffer);
and
bool DeleteFileW(string buffer);
doesn't work :-(
I only got "false" als return value.
Do you have another tipp?!...
Tried it and it works
Here is a working example (in which you can chose if you wish just to delete or you wish to delete and then immediately create an empty file - this example is an indicator that does it on every new bar, but it can work in any code)
//
//------------------------------------------------------------------
#property indicator_chart_window
#import "kernel32.dll"
int _lopen (string path, int of);
int _lcreat (string path, int attrib);
int _llseek (int handle, int offset, int origin);
int _lread (int handle, string buffer, int bytes);
int _lwrite (int handle, string buffer, int bytes);
int _lclose (int handle);
int DeleteFileA(string path);
#import
extern bool doCreate = true;
//------------------------------------------------------------------
//
//------------------------------------------------------------------
//
//
//
//
//
int init() { return(0); }
int start()
{
static datetime lastDeleted=0;
if (lastDeleted!=Time[0])
{
lastDeleted = Time[0]; int result = DeleteFileA("E:\\test\\testfile.txt"); Comment(result);
if (doCreate)
{
int handle = _lcreat("E:\\test\\testfile.txt",0); if (handle > -1) _lclose(handle);
}
}
return(0);
}Hi, thank you for your tipp,
but both functions
bool DeleteFileA(string buffer);
and
bool DeleteFileW(string buffer);
doesn't work :-(
I only got "false" als return value.
Do you have another tipp?!Hi,
lot's of thanks for your code-snippet!!!
It works also on my laptop, but when I want to change the time, so that the indicator has to create, write and delete a few times per minute (3x), it doesn't work anymore :-(
So I think I have to overwrite my old entries each time...
MT4 alert indicator only at certain time
Hi Mladen (and others), do you know of a price alert indicator that only checks price at a certain time?
time_vlines.mq4
Could someone change this indicator to show only one line (today) not for all days.
Anyone? Please.