Thanks nezinu.
Thanks!
You all are welcome
The expert can be attached to more than one instrument. For example if you want to log EURUSD, GBPUSD, GBPCHF spreads at the same time, then you must attach the expert to EURUSD, GBPUSD, GBPCHF graphs. Expert will create files for all three currency pairs. For EURUSD it will create EURUSD.csv, for GBPUSD it will create GBPUSD.csv, .... .
One more thing. There is some mystical space in line
if(FileSeek(out,0,SEEK_END)) FileWrite(out,Day(),Month(),Hour(),Minute(),Second s(),CurrentSpread);
Please replace Second s() with Seconds()
why not just paste it
to avoid it mashing up and errors occuring. or even just attach the code file
why not just paste it
You are absolutely right. I am sorry, because mislooked this option.
Hello Nezinu,
I know, very old thread but I've been looking for such EA recently, very useful (some more spaces to remove in the code ) but it has been working really great.
I'm a newbie in this langage so maybe other people can help me.
I first would like to have in teh CSV the Currency pair and the Broker Name (to comile all CSV files in one big database for analyze)
Then I've an issue with some broker, I' think I know why : FXCBS and OpentradeFX have as currencies EURUSD.. or EURUSD. , not the ".." and ".", it's probably screwing the xls file naming, so maybe some substring at 6 digit would help ?
It's maybe not that but maybe ..
Cheers,
GE
MT5 indicator
Hi guys, do you know something similar but on MT5 and of course for every tick?
...
Check out this one : https://www.mql5.com/en/forum/181297/page14
Maybe that is what will fit your needs
Hi guys, do you know something similar but on MT5 and of course for every tick?
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Small description of expert:
The user can set extern variable SpreadToCheck. If current spread will be wider than SpreadToCheck, then expert will record current time and current spread in *.csv file.
For example: The EURUSD default spread at your broker is 3 pips, but sometimes it becomes wider. If you want to find out how often. You can attach Spread check.mq4 expert to EURUSD chart and find out.
If you will attach expert to EURUSD chart then expert will log results in EURUSD.csv file. It will create it under \experts\files directory.
Here will be the expert code or you can download it from our Forex web site. Click Lejupielādēt.
//+------------------------------------------------------------------+
//| Spread check.mq4 |
//| coded by Rolands Auza |
//| www.rm-forex.lv |
//+------------------------------------------------------------------+
#property copyright "coded by Rolands Auza"
#property link " www.rm-forex.lv "
//+------------------------------------------------------------------+
//| expert initialization function |
//+------------------------------------------------------------------+
extern int SpreadToCheck=0;
int prevBars,out;
double standSpreads;
string Currency,file;
int init()
{
int handle;
int size;
//----
prevBars=Bars;
Currency=Symbol();
file=Currency+".csv";
out=FileOpen(file,FILE_CSV|FILE_READ|FILE_WRITE,';');
handle=FileOpen(file, FILE_BIN|FILE_READ);
if(handle>0)
{
size=FileSize(handle);
FileClose(handle);
}
if(size<3)
{
out=FileOpen(file,FILE_CSV|FILE_READ|FILE_WRITE,';');
if(out<1)
{
Print("File not found, the last error is ", GetLastError());
return(0);
}
if(FileSeek(out,0,SEEK_END)) FileWrite(out,"Day","Month","Hour","Minute","Seconds","Current Spread");
FileClose(out);
}
//----
return(0);
}
//+------------------------------------------------------------------+
//| expert start function |
//+------------------------------------------------------------------+
int start()
{
//----
double CurrentSpread=MarketInfo(Currency, MODE_SPREAD);
if(CurrentSpread>SpreadToCheck)
{
out=FileOpen(file,FILE_CSV|FILE_READ|FILE_WRITE,';');
if(out<1)
{
Print("File not found, the last error is ", GetLastError());
return(0);
}
if(FileSeek(out,0,SEEK_END)) FileWrite(out,Day(),Month(),Hour(),Minute(),Seconds(),CurrentSpread);
FileClose(out);
}
return(0);
}
//+------------------------------------------------------------------+