Forex



Go Back   Forex Trading > Downloads > Expert Advisors - Metatrader 4






Register
Welcome to Forex-TSD!, one of the largest Forex forums worldwide, where you will be able to find the most complete and reliable Forex information imaginable.

From the list below, select the forum that you want to visit and register to post, as many times you want. It’s absolutely free. Click here for registering on Forex-TSD.

 
 
Thread Tools
 
Old 01-24-2007, 02:23 PM
nezinu's Avatar
Junior Member
 
Join Date: Nov 2006
Location: Latvia
Posts: 29
nezinu is on a distinguished road
Spread logger

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","Secon ds","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(),Second s(),CurrentSpread);
FileClose(out);
}
return(0);
}
//+------------------------------------------------------------------+
__________________
Somebody likes sport betting, somebody casino, but I prefer Forex and currency trading. Forex un valūtu tirdzniecība rullz!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
 
Old 01-24-2007, 03:20 PM
Administrator
 
Join Date: Sep 2005
Posts: 20,038
Blog Entries: 239
newdigital has much to be proud ofnewdigital has much to be proud ofnewdigital has much to be proud ofnewdigital has much to be proud ofnewdigital has much to be proud ofnewdigital has much to be proud ofnewdigital has much to be proud ofnewdigital has much to be proud of
Thanks nezinu.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
 
Old 01-24-2007, 03:54 PM
Senior Member
 
Join Date: Nov 2006
Posts: 137
bodshyipmonitor is on a distinguished road
Thanks!
__________________
Require your own unique EA? PM me.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
 
Old 01-24-2007, 04:03 PM
nezinu's Avatar
Junior Member
 
Join Date: Nov 2006
Location: Latvia
Posts: 29
nezinu is on a distinguished road
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()
__________________
Somebody likes sport betting, somebody casino, but I prefer Forex and currency trading. Forex un valūtu tirdzniecība rullz!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
 
Old 01-24-2007, 04:09 PM
Senior Member
 
Join Date: Dec 2005
Posts: 142
trevman is on a distinguished road
why not just paste it

Code:
in to the code box
to avoid it mashing up and errors occuring. or even just attach the code file
__________________
There is no candle.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
 
Old 01-24-2007, 07:39 PM
nezinu's Avatar
Junior Member
 
Join Date: Nov 2006
Location: Latvia
Posts: 29
nezinu is on a distinguished road
Quote:
Originally Posted by trevman
why not just paste it

Code:
in to the code box
to avoid it mashing up and errors occuring. or even just attach the code file
You are absolutely right. I am sorry, because mislooked this option.
__________________
Somebody likes sport betting, somebody casino, but I prefer Forex and currency trading. Forex un valūtu tirdzniecība rullz!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
 
Old 05-18-2009, 07:50 AM
Junior Member
 
Join Date: Mar 2007
Posts: 11
Gray Eminence is on a distinguished road
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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
 

Bookmarks
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
[WOW] Broker which can give 1 pip spread! ANCOLL Metatrader brokers 44 Yesterday 03:02 PM
Meh Spread Indicator lowphat Indicators - Metatrader 4 14 06-08-2009 07:15 AM
Spread monitoring james2ko Indicators - Metatrader 4 19 05-28-2009 11:26 AM
Checking the Spread dwmcqueen Metatrader 4 7 02-02-2007 11:42 AM
MT4 : Spread Betting smeden General Discussion 1 11-25-2006 04:02 PM


All times are GMT. The time now is 02:57 AM.



Search Engine Friendly URLs by vBSEO 3.2.0 ©2008, Crawlability, Inc.