Forex
Google
New signals service!

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


Register in Forex TSD!
Trading Systems Leaders in this forum (automated trading systems) are winning more than 3000 pips in a month (30000$ investing one lot every time).
Click here to register and get more information

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 01-24-2007, 01:23 PM
nezinu's Avatar
Junior Member
 
Join Date: Nov 2006
Location: Latvia
Posts: 26
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!
Reply With Quote
  #2 (permalink)  
Old 01-24-2007, 02:20 PM
Administrator
 
Join Date: Sep 2005
Posts: 16,268
Blog Entries: 106
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!
Reply With Quote
  #3 (permalink)  
Old 01-24-2007, 02: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!
Reply With Quote
  #4 (permalink)  
Old 01-24-2007, 03:03 PM
nezinu's Avatar
Junior Member
 
Join Date: Nov 2006
Location: Latvia
Posts: 26
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!
Reply With Quote
  #5 (permalink)  
Old 01-24-2007, 03:09 PM
Senior Member
 
Join Date: Dec 2005
Posts: 144
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!
Reply With Quote
  #6 (permalink)  
Old 01-24-2007, 06:39 PM
nezinu's Avatar
Junior Member
 
Join Date: Nov 2006
Location: Latvia
Posts: 26
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!
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

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 33 08-25-2008 11:37 PM
Meh Spread Indicator lowphat Indicators - Metatrader 4 12 07-28-2008 05:48 PM
Spread monitoring james2ko Indicators - Metatrader 4 9 01-17-2008 09:41 AM
Checking the Spread dwmcqueen Metatrader 4 7 02-02-2007 10:42 AM
MT4 : Spread Betting smeden General Discussion 1 11-25-2006 03:02 PM


All times are GMT. The time now is 01:04 AM.



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