Indicators: Spread Tracker

 

Spread Tracker:

Tracking Variable Spreads with an Offline Chart

Author: Fernando Carreiro

 

Hello Fernando,

This is really useful indeed. I have a little problem following your directions.

1) Is the history file the one that is named ''Signals.dat''? If not which and where exactly is it?

2) How exactly do you open the history file as an offline chart?

3) How do you select a non-standard Time Frame (for either an offline or an online chart)?

Many Thanks,

John

 

Hello John,

I will answer your questions in reverse order so as to make it easier to understand.

3) A standard timeframe for MT4 would be 1 = M1, 5 = M5, 15 = M15, 30 = M30, 60 = H1, 240 = H4, etc.; so a non-standard one would be for example 2, 3, 4, 6, etc. - You can only open Online charts of Standard timeframes (you can't open non-standard online charts). As a consequence you cannot dump to Offline charts of standard-timeframes (or least should not be able to) and should only use non-standard for Offline charts.

2) To Open an "Offline Chart", use the menu "File" -> "Open Offline" and then choose the chart generated (in the example image above, "EURUSD.m,M2" for the non-standard timeframe of "2" on "EURUSD.m").

1) For the example above, the offline chart is "EURUSD.m,M2" so then the file will have the name "EURUSD.m2.hst" in the "history" folder/directory under your broker's name as a subfolder.

Hope that helps!

Regards,
Fernando

 

Hi Fernando and thank you for your response.

I have a little issue with the second point. I go to "File''->"Open Offline" and from the available choices I don't see any non-standard timeframe. For instance the list starts with AUDCAD and it says:

AUDCAD,M1 - AUDCAD,M5 - AUDCAD,M15 - AUDCAD,M30 - AUDCAD,H1 - AUDCAD,H4 - AUDCAD,Daily - AUDCAD,Weekly

So I don't see M2 anywhere. I do this with 3 different brokers I use and it is the same. Am I doing something wrong?

Frankly I am a bit lost and was wondering if it would be possible for you to guide me with baby steps as to what I have to do. I couldn't thank you enough if you could this as I find this code very useful.

Kind Regards,

John

 

Hello John,

First of all, it is the weekend and no new "ticks" are coming in, so there will be no activity at the moment and hence no chart being generated. You will have to wait until there is sufficient data coming in to complete 1 bar of your chart.

However, here are the baby steps for you to follow once there is some activity. I will assume your favourite currency pair is AUDCAD so here goes:

  1. Open up a 1 Minute Chart for AUDCAD and confirm that you have "AUDCAD,M1" as the title for the chart.
  2. Attach the "SpreadTrack" indicator to the chart and choose "2" for the "intTimeframeHST" parameter, which is the default. I am assuming you know how to attach indicators to charts.
  3. You should see an extra line of details under the chart title with the text "SpreadTrack: #.#### AUDCAD2.hst" confirming that the indicator is attached and functional. The value of #.#### is the current spread value.
  4. Wait for at least 1 bar to complete or at least 1 minute to go by as it is a 1 Minute chart. (Make sure there is activity and that ticks are coming in regularly within that time period).
  5. Open the "Offline Chart" as explained before, selecting "AUDCAD,M2".
  6. You should see at least one bar of information in this Offline chart, so wait a few more minutes (15 mins, would be ideal) and look at the chart again.
  7. Set the offline chart to candlestick for a better view and if you wish, apply a simple moving average indicator to it as well to monitor the average over time (eg. MA(5) for a 5 min average, MA(60) for 1 Hour average).

Also, please note that the code makes some DLL calls to keep the Offline Chart refreshed with the latest ask/bid spread, so if it is not refreshing automatically due to DLL calls being disabled on your MT4, do a manual refresh of the chart to see the updated data.

Hope that is what you need to get it to work.

Regards,
Fernando

 
That is really great Fernando. I will try tomorrow then. Thank you again for your help!
 

Hi Fernando,

I tried again now that the market is open and ticks are coming in and I have a problem in the 3rd step I believe. I don't see the extra line of details under the chart title with the text "SpreadTrack: #.#### AUDCAD2.hst" as you mentioned. What I did was to save the SpreadTrack file under the Experts->Indicators folder, and I then went to the Navigator of the MT4, located the SpreadTrack and simply drag and drop on the 1min chart of AUDCAD (by default intTimeframeHST was set at 2 so didn't change anything there). Have I done anything wrong? Even if I go to File->Open Offline afterwards, I don't see AUDCAD,M2 so I must be doing something wrong?

Kind Regards,

John

 
by the way, if right click on the chart and then select "indicators list" I can see SpreadTrack indicator there, so it has been attached to the chart but I can not see the line with "SpreadTrack: #.#### AUDCAD2.hst" anywhere
 

Hello John,

The "SpreadTrack: #.#### AUDCAD2.hst" text is NOT on the Offline chart. You will only see that text on your source chart, the 1 Min Online Chart of AUDCAD.

Here is an example on my 1M EURUSD.m online chart that generates the offline chart.

SpreadTracker Details

Also, can you tell me what Build of MetaTrader 4 you are using? I am currently using Build 509 (24 Jul 2013).

 

Hi Fernando,

This is what I had done too i.e. I tried to apply the indicator on the 1M ONLINE chart. And in fact once I do, I then right click on the chart, select indicators list, and the indicator is there, but I can not see the extra line that obviously you have on your chart. I have the same build installed (version 4.00, build 509 - 24 Jun 2013). I have tried this with all my brokers platforms. I have demo accounts with 8 MT4 brokers and it is the same with all. The indicator is there but can not see the extra line. I'm tempted to try with your broker now but because we are not allowed to mention brokers in here I could send you an email - I see you have included your email address inside the code - and if you could let me know which broker you use I could give it a shot, unless you can think of anything else?

Kind Regards,

John

 

Hello John,

No, it is not a Broker related issue as I have also many brokers with both real and demo accounts and I use different PC's as well as pre-installed VPS accounts and on all the text appears.

Somehow on your set-ups, "Comments" must be disabled. I will look into the matter to see if I can find out where it is disabled and enabled and let your now.

However, it is common for many indicators and EA's to use "Comments" in that area, so test a few others that do use "Comments" and see if they function correctly.

Regards,
Fernando

Reason: