Indicators: Spread Data Logger

 

Spread Data Logger:

Collect and analyze real-time spread data.

Author: alexander supertrade

 
I'm new to this! how do "attach" these???
 

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

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


 
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.
 
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.
 
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

 
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 !
 

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

 
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.
 
can be very usefull for scalpers
 

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

Reason: