Download MetaTrader 5

Indicators: Spread Data Logger

To add comments, please log in or register
MQL5 Cloud Network is a distributed computing network. Just give it a try!
MetaQuotes Software Corp.
Moderator
181212
MetaQuotes Software Corp. 2011.01.31 08:37 

Spread Data Logger:

Collect and analyze real-time spread data.

Author: alexander supertrade

MQL4 Comments
16319
MQL4 Comments 2011.01.31 12:18  
I'm new to this! how do "attach" these???
MQL4 Comments
16319
MQL4 Comments 2011.01.31 15:58  

I am now confused by tick/spread write to CSV file.

Could you please explain what is the function of if(Volume[0]==1) ?


alexander supertrade
286
alexander supertrade 2011.02.01 06:34  
sergery:

I am now confused by tick/spread write to CSV file.

Could you please explain what is the function of if(Volume[0]==1) ?



This statement ensures that data is written only once per bar, for the very first tik of a new bar rather than for every tik. While this is less accurate than collecting spread data for each tik, my feeling is that the difference in accuracy is marginal when using the indicator on the 1-minute chart and it leads to a much smaller data file to read. When writing the indicator I decided spread data for each tik is an unnecessary degree of accuracy and that per minute is more than sufficient to get meaningful results. I am aware of the possibility of this line causing a bug when a bar opens with volume immediately >1 but in my testing this never seemed occur so I did not address it.
alexander supertrade
286
alexander supertrade 2011.02.01 06:40  
151948:
I'm new to this! how do "attach" these???
"Attach" simply means to open them on a chart in MT4. Download the file, open it in MetaEditor, then click "Compile". This should create an .ex4 file which you can "attach" to a chart in MetaTrader. Go to Insert > Indicators > Custom > ...you should see the indicator name in the drop-down menu.. you may have to scroll down some.
alexander supertrade
286
alexander supertrade 2011.02.01 06:44  
151948:
I'm new to this! how do "attach" these???


I've uploaded the .ex4 versions.

Just save these in the ...\experts\indicators folder & it should show up under Insert > Indicators > Custom

MQL4 Comments
16319
MQL4 Comments 2011.02.01 07:49  
supertrade:
sergery:

I am now confused by tick/spread write to CSV file.

Could you please explain what is the function of if(Volume[0]==1) ?



This statement ensures that data is written only once per bar, for the very first tik of a new bar rather than for every tik. While this is less accurate than collecting spread data for each tik, my feeling is that the difference in accuracy is marginal when using the indicator on the 1-minute chart and it leads to a much smaller data file to read. When writing the indicator I decided spread data for each tik is an unnecessary degree of accuracy and that per minute is more than sufficient to get meaningful results. I am aware of the possibility of this line causing a bug when a bar opens with volume immediately >1 but in my testing this never seemed occur so I did not address it.

Thank you for your detailed explaination !
brewmanz
486
brewmanz 2011.02.02 01:56  

This is a good idea. However, should this program start to be widely used, brokers will catch on & give the FIRST quote of the minute a good spread, and make it worse for others.

I would suggest tracking Minimum, Maximum, Average & Std Dev for each minute. Whether Average & SD is by number or 'time active' is debatable

alexander supertrade
286
alexander supertrade 2011.02.06 00:45  
brewmanz:

This is a good idea. However, should this program start to be widely used, brokers will catch on & give the FIRST quote of the minute a good spread, and make it worse for others.

I would suggest tracking Minimum, Maximum, Average & Std Dev for each minute. Whether Average & SD is by number or 'time active' is debatable


I agree. I wrote this program for personal use just to get some rough numbers so I didnt put much effort to getting very high accuracy or efficiency. Certainly, tik data would be the most reliable and impossible for brokers to skew. The main barrier to writing such a program for tik data is the massive data files that would be created. Im not a professional programmer, thus my algorithms for analyzing the data are probably relatively inefficient and resource-consuming (Ive done no research at all on which algorithms would be best for this application) and thus analysis is slowed down considerably with more data points. For instance, I left this indicator running almost the whole of last week which resulted in 6737 datapoints. When I loaded the data in Spread Logger Read, it took about 30 seconds to analyze the data..at first I thought it had crashed metatrader. Nonetheless the results were good! For those of you interested, the mean spread for Forex.com during last week (1/31/11 - 2/4/11) was 2.2 with the mode being 2. Imagine though, if I had tik data.. Id have at least 100,000 data points... possibly 5 minutes of computation assuming the computation-time relationship is linear.. in all practicality it will freeze the MT terminal if not crash it. I'll work on a tik data version nonetheless when I have some time.
MQL4 Comments
16319
MQL4 Comments 2013.07.27 17:36  
can be very usefull for scalpers
Max Pena
2703
Max Pena 2013.08.02 19:04  

Hello and thanks Can you explain this number 1375468560? can you add this function time and datum? How can prove to my broker the spread at any specific time and date?

this is the results

1375468560;0.7

1375468620;1.2

1375468680;1.8
1375468680;1.8
1375468740;1.3
1375468740;1.3
1375468860;0.8
1375468860;0.8
1375468920;0.9
1375468920;0.9
1375468980;1.1
1375468980;1.1
1375469040;1.3
1375469040;1.3
1375469100;1
1375469100;1
1375469160;1.2
1375469160;1.2
1375469280;0.6
1375469280;0.6
1375469340;1.1
1375469340;1.1
1375469400;0.8
1375469400;0.8
1375469520;0.7
1375469520;0.7
1375469580;0.7
1375469580;0.7
1375469640;0.6
1375469640;0.6

12
To add comments, please log in or register