Working with Excel (tools, indicators, conversion ...) - page 10

 
dgrspencer:
I simply downloaded my MT4 from metaquotes.net.

What I am trying to achieve is a spreadsheet which automatically calculates 4hrly, daily, weekly and monthly pivots. Actually I don't use them directly for trading but I like to know where a position I may take fits into pivot points. I have conditionally formatted cells to light up colours when the price (I have a live price feed into the spreadsheet) gets within a certain number of pips.

I can export the history from MT4 (creates a csv file just as your script does) but I get the entire history within MT4 - thousands of candles worth of info. Obviously to calculate pivots I only need the most recent ones - hope that clears up what I was saying before.

However, having played around a bit I love the idea behind what your helping me with. Drag the script onto a chart (repeated ever 4 hours) then click on a macro button to automatically update my spreadsheet. This is a much slicker way!

Have I cleared things up a bit?

Continued thanks

Yes it did

With the script I gave you gets the amount of candles you require by altering the lines I pointed out. Just remember if run the script the most recent candle will have a closing price of the current price as it is not a close candle. It changes within the H4 timeframe each time you run the script.

In a way it does make your calculation dynamic if you lets say update every 2hours but I don't know if those change are significant for you calculation.

If you only want to consider closed candles then skip the first data in your excel update.

Btw did you get the changes to the Macro work out OK?

Another thing ,the script is written that way that it writes the files for the Currency and TF you altered the code to . You can put it on any chart and any TF of you MT4 t does not influence proper function of the script.

 
Forexcashman:
Yes it did

With the script I gave you gets the amount of candles you require by altering the lines I pointed out. Just remember if run the script the most recent candle will have a closing price of the current price as it is not a close candle. It changes within the H4 timeframe each time you run the script.

In a way it does make your calculation dynamic if you lets say update every 2hours but I don't know if those change are significant for you calculation.

If you only want to consider closed candles then skip the first data in your excel update.

Btw did you get the changes to the Macro work out OK?

Another thing ,the script is written that way that it writes the files for the Currency and TF you altered the code to . You can put it on any chart and any TF of you MT4 t does not influence proper function of the script.

Thanks. I'd worked out that it doesn't matter what currency or time frame and the script works. It's a great tool.

OK, so here's where I'm at. I can run the script and, as it's supposed to, it creates a csv file in the experts>files folder. So where I'm now at is trying to get the macro function within the spreadsheet to work - ie get the information from these files.

I changed the file path and removed the "m's" but for some reason it isn't working. Well, nothing happens immediately - maybe I've changed the file path correctly but then when I click on the macro button it is incorrectly set.

I've tried starting from scratch and copying the excel command you use (but with my file path)

(my version)

='C:\Program Files\MetaTader 4\experts\files\[ExportedEURUSDD1.csv]ExportedEURUSDD1'!A1

but when I hit enter, a window appears saying "Update Values: ExportedEURUSDD1.csv" (the file I've linked it to) - I go to the location of this file but it doesn't appear. It only recognises actual excel files, lotus files or web pages.

So in short, I can't connect an excel file with the data and nor can I set the macro correctly! Just thought, is the line of code in excel dependent on a macro? ie do they need each other to work. Sorry I'm quite out of my depth!

Dave

 

OK, zip it up and post it please. Or load it up to rapidshare.com and send me the link.

 

how to connect date from MT4 to excel ?

hi guys ,

I will like to get some quotes and indicator data from my MT4 to excel spreadsheet.

can some one explain how to do it or direct me where I can learn to do so?

thanks.

 
Forexcashman:
OK, zip it up and post it please. Or load it up to rapidshare.com and send me the link.

RapidShare: 1-Click Webhosting

Here you go. Note it's the GBP/USD tab I've been working on - the others don't deal with my questions.

Many thanks,

Dave

PS - not used rapidshare before so hope it works!

 

not sure that worked so here's the file (hope this works!)

Files:
 
400396:
hi guys ,

I will like to get some quotes and indicator data from my MT4 to excel spreadsheet.

can some one explain how to do it or direct me where I can learn to do so?

thanks.

Sorry if this is patronising (I'm new to all this too) but if you haven't already done this, open up the file DDE-Sample within your MT4 installation folder. This at least shows you how to get a live feed into excel. Beyond that you're into scripts and indicators which create csv files. These can then be imported into excel via macros but I'm struggling with this at the moment as you will see from my posts!

 
400396:
hi guys ,

I will like to get some quotes and indicator data from my MT4 to excel spreadsheet.

can some one explain how to do it or direct me where I can learn to do so?

thanks.

The easiest way to export data is to use the history centre which allows you to export data to a comma seperated variable file that can be imported into excel.

I think the F2 key opens the history centre.

If you want indicator values, you'll need to write an indcator that writes the data you require to a text file. There are examples of these scattered around various forums, alternatively there are TA libraries that can be used with excel, again plenty of links on various forums to these libraries.

DDE might be useful, but its a right pain in the ass, and not really suppoted these days.

 
zupcon:
The easiest way to export data is to use the history centre which allows you to export data to a comma seperated variable file that can be imported into excel.

I think the F2 key opens the history centre.

If you want indicator values, you'll need to write an indcator that writes the data you require to a text file. There are examples of these scattered around various forums, alternatively there are TA libraries that can be used with excel, again plenty of links on various forums to these libraries.

DDE might be useful, but its a right pain in the ass, and not really suppoted these days.

Forexcashman being an enormous help to me, but zupcon, could you comment on importing data into an excel file from one of the csv files created by an indicator? Does the csv file need to be open if one writes a macro to get the info from the csv file?

 

There are several ways to get the CSV data into excel.

If your using Excel 2007 there's a data tab, with the option to import from a text file.

In earlier versions you need to use the file import wizard (I dont have an old version of excel so cant remember where this is found, probably under the data menu). Once the wizard starts it guides you step by step through the process, it allows you to pick the delimiter etc, drop unwanted columns etc

You can write a macro to read text files, but its not necessary, and unless your opening hundreds of files, probably not worth the effort.

Another option is to use star office, if you double click a text file the application is sensible enough to start the import wizard, and you coud always save the spreadsheet in XLS format if you really wanted to use Excel

hope this helps

Reason: