| New signals service! | |
|
|||||||
| 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 |
|
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
||||
|
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!
|
|
||||
|
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!
|
|
|||
|
why not just paste it
Code:
in to the code box
__________________
There is no candle. |
|
||||
|
Quote:
__________________
Somebody likes sport betting, somebody casino, but I prefer Forex and currency trading. Forex un valūtu tirdzniecība rullz!
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|
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 |