collapse

Author Topic: Record spreads  (Read 3320 times)

Offline "Ancient Mariner"

  • Jr. Member
  • **
  • Posts: 80
Record spreads
« on: July 09, 2009, 03:41:47 PM »
Is there any way to record the spread, of a particular currency pair, that was existing at the time of a trade? Maybe something undocumented in MT4.
"Ancient Mariner"

Offline rickyc2511

  • Sr. Member
  • ****
  • Posts: 641
Re: Record spreads
« Reply #1 on: July 12, 2009, 09:03:41 AM »
Is there any way to record the spread, of a particular currency pair, that was existing at the time of a trade? Maybe something undocumented in MT4.


I'm sure there is a simple answer within metatrader,or a MT plugin to do this. There are third party programmes that record spreads from a set start period to a set finish period, eg: 0001-2400.

I have a cunning trick that i use to see what sort of variations are happening during the fapt trading period, and thats setting up a 2nd chart with a different magic number and setting my "max spread" to 0.01- and as long as the ea is up, it will try every 1 minute(in normal conditions) to open a trade and will fail because of invalid spread. I then just import that data from the experts/journal part of terminal and into excel and you end up with a tabulated spreadsheet of several hundred spread figures, from lowest to highest or by time-whatever you prefer.

regards
rickyc

Offline "Ancient Mariner"

  • Jr. Member
  • **
  • Posts: 80
Re: Record spreads
« Reply #2 on: July 13, 2009, 04:02:17 PM »
I guess I wasn't clear enough. I am not looking for spreads through out the day, only the spreads of a trade when it was opened. I would use this, along with other criteria, to adjust settings
"Ancient Mariner"

Offline rickyc2511

  • Sr. Member
  • ****
  • Posts: 641
Re: Record spreads
« Reply #3 on: July 14, 2009, 11:43:55 AM »
I guess I wasn't clear enough. I am not looking for spreads through out the day, only the spreads of a trade when it was opened. I would use this, along with other criteria, to adjust settings


Ok, here's a wee program that should do the trick for you, This is a small EA that writes to a file in directory /experts/files how much the spread is for the currency pair the EA is attached to.

regards
rickyc

Offline bart

  • Full Member
  • ***
  • Posts: 293
Re: Record spreads
« Reply #4 on: July 14, 2009, 12:16:51 PM »
I copied it into the "experts" map. Is there something else I must do, like attach it to the EA? If so, how do I do that?
« Last Edit: July 14, 2009, 04:28:20 PM by bart »

Offline rickyc2511

  • Sr. Member
  • ****
  • Posts: 641
Re: Record spreads
« Reply #5 on: July 14, 2009, 01:17:02 PM »
I copies it into the "experts" map. Is there something else I must do, like attach it to the EA? If so, how do I do that?

Yes, extract it to your metatrader/experts folder of your chosen account.
Restart metatrader and you will see it with all your other ea's.
You will see it active with a smiley face in the top right hand corner of whatever chart you choose to attach it to.

To read the log, go to your metatrader expert/files directory and you will see "eur/gbp.csv" or whatever currency chart you attached the ea to.
Simply right-click on it and choose "open with" notepad or word or whatever.

And you will see a list like this:

Day;Month;Hour;Minute;Seconds;Current Spread
14;7;14;2;47;2.7
14;7;14;2;53;2.6
14;7;14;2;53;2.7
14;7;14;2;55;2.6
14;7;14;2;55;2.6
14;7;14;3;0;2.3
14;7;14;3;1;2.8
14;7;14;3;1;2.6
14;7;14;3;2;2.6
14;7;14;3;10;2
14;7;14;3;11;1.8
14;7;14;3;11;2.6

Its a great wee ea, and it will keep logging spreads for as long as it's attached to your chart and you are up and running.

regards
rickyc
« Last Edit: July 14, 2009, 01:19:06 PM by rickyc2511 »

Offline "Ancient Mariner"

  • Jr. Member
  • **
  • Posts: 80
Re: Record spreads
« Reply #6 on: July 14, 2009, 03:59:31 PM »
Ricky,
I think I am missing something here. When I attach the "spreadlogger" to a chart the EA that is already there disappears. I want to be able to log the spreads with my EA also operating. In other word, I want to continue my EA trading while logging spreads.
I could open a parallel chart with the same parameters and attach the logger to it and then compare the spreads for a trade. Is this what I must do?
Bill
"Ancient Mariner"

Offline "Ancient Mariner"

  • Jr. Member
  • **
  • Posts: 80
Re: Record spreads
« Reply #7 on: July 14, 2009, 08:21:41 PM »
I have also  noticed that the logger sometimes does not record every second and at other times it may record the same second more than once.If I am to build on the data to determine what the spread was when a particular trade took place I must have every second recorded or it must be triggered by  the EA when it opens a trade. The latter would be preferable. Maybe putting part of the code  in a script would work.
"Ancient Mariner"

Offline rickyc2511

  • Sr. Member
  • ****
  • Posts: 641
Re: Record spreads
« Reply #8 on: July 14, 2009, 09:25:28 PM »
I have also  noticed that the logger sometimes does not record every second and at other times it may record the same second more than once.If I am to build on the data to determine what the spread was when a particular trade took place I must have every second recorded or it must be triggered by  the EA when it opens a trade. The latter would be preferable. Maybe putting part of the code  in a script would work.

There are always packets of data missing from every internet connection and therefore you won't find anything that is 100% accurate in it's recordings ALL the time.
Plus, it's only recording the data coming through to metatrader, which is only as reliable as your brokers servers/connection also-and spreads don't necessarily change every second-you may get several seconds without change...

Unless you can google up another similar script,and I'm sure there must be many of them out there.
Or you could get a small script coded for yourself for a reasonable fee from many ea coding sites.
Or perhaps someone here on the forum?

Here's a site that I have looked at myself,as I try to get an exit strategy for some of my own manual trading automated-they do custom programming for forex traders, retail or private individual;
http://www.onestepremoved.com/code/forexmt4.html

regards
ricky
« Last Edit: July 14, 2009, 09:32:27 PM by rickyc2511 »

 

browse forum