Page 1 of 1

Anyone here familiar with MT4?

Posted: Wed Aug 10, 2011 1:06 pm
by LeviF
Does it have any portfolio management capabilities, like can I run a simple script to close x% of all open positions?

Posted: Thu Aug 11, 2011 11:57 am
by babelproofreader
can I run a simple script to close x% of all open positions?
I have seen scripts/EAs available online (Google gets many hits) to close all open positions/cancel pending orders etc. so I'm sure it would be trivial to change these to close X% of open positions.

I too have recently looked at Metatrader 4 and I soon came up against a few programming obstacles (at least obstacles for me and what I would like to do).
  • There is a limit to the number of indicators [buffers] that can be attached to a single chart window
    Having the output of one indicator [buffer] as input to another indicator [buffer] in a different window involves some major hacking or repetition of the first indicator code in the second indicator
    If you want to write your own DLLs for speed purposes there is very little support (forums etc.) available compared to MQL support
However, IMHO one great thing about Metatrader is the history export function. Using this you can get free history going back many years, at frequencies down to 1 minute, for use in your back testing software of choice. Another good thing is that it appears to be quite extensible. In my travels around the internet looking for solutions to my problems I came across a few postings that mentioned interfacing Metatrader with R and using the statistical power of R for linear regression and projection, neural nets etc. directly in Metatrader. If your programming skills are up to it, this would suggest that you could use Metatrader as an API to software you are already familiar with, similar to the way in which lots of trading software suites have an API to Interactive Brokers. for example.

Posted: Thu Aug 11, 2011 12:00 pm
by LeviF
babelproofreader wrote:However, IMHO one great thing about Metatrader is the history export function. Using this you can get free history going back many years
Can this conveniently be used as a substitute for CSI for order generation in Blox?

Posted: Thu Aug 11, 2011 12:55 pm
by babelproofreader
Can this conveniently be used as a substitute for CSI for order generation in Blox?
I'm not a user of CSI or Blox, but I would say the answer is almost definitely yes. I have read online about Metatrader scripts to automate history export to ASCII files, which could then be imported to Blox. For end of day trading (I believe CSI data is end of day only) this would just mean changing your routine from
  • use Unfair Advantage to download price - import to Blox
to
  • Run Metatrader script while connected to broker - import to Blox
Another advantage to the Metatrader approach, apart from the free data, is that the downloaded price series will be the price series you actually trade at your broker compared to the presumably multi-broker aggregated price series you get from CSI. This of course would only apply to forex data, as I am unaware of being able to trade futures, stocks etc. through Metatrader.

Posted: Fri Aug 12, 2011 11:31 am
by LeviF
I was up till 230AM last night working on an MT4 script that will automatically place orders with my broker based on Blox output. I am coming along slowly but steadily; it sure is satisfying as your code comes together and you get your desired output piece by piece...

Posted: Fri Aug 12, 2011 3:36 pm
by babelproofreader
I found the Metatrader to R interface I mentioned above here. You might be able to cannibalise some of the code for your purposes; it's all open source.

Posted: Sat Aug 13, 2011 11:48 am
by ratio
For those of you that trade with Interactive Brokers, there is the really good C# wrapper for IB API at http://www.dinosaurtech.com/utilities/

It can help you make an automated trade entry program

Also, for some system you can also look at Tradebullet http://www.tradebullet.com/

This one can work with many broker and it can read ascii file that you create on your Order Generation script

Posted: Thu Dec 08, 2011 5:11 am
by freeman
LeviF wrote:I was up till 230AM last night working on an MT4 script that will automatically place orders with my broker based on Blox output. I am coming along slowly but steadily; it sure is satisfying as your code comes together and you get your desired output piece by piece...
How did u go with the mt4 data?

I was playing with this idea for sometime, u can download and save each file in csv, however im in talks with a mt4 broker to simply things, pm me if your interested in code exchange and solutions.

Posted: Thu Dec 08, 2011 8:53 am
by LeviF
I wrote a script that downloads the daily OHLC data for the instruments in my portfolio, a script that processes entry/exit orders spit out from TB, and a script that enters all positions to synch with TB.

Posted: Fri Dec 09, 2011 9:32 am
by freeman
LeviF wrote:I wrote a script that downloads the daily OHLC data for the instruments in my portfolio, a script that processes entry/exit orders spit out from TB, and a script that enters all positions to synch with TB.
looks like you have sorted then: ) i was trying to access and and go through there .dat and .hst files but encryption is always a pain, lol ..

Mt4/5 sales have quoted me 100k to have there software, i have suggested to them to set up a api as i want to run orders, charts etc via a .asp website i have, would be nice, but i doubt they will do it.

I will most likely end up having a crack at something similar to what you have done for now but i doubt i will be able to set it up to send orders for my intraday system fast enough.

I day trade from a certain time, but my orders may be generated in seconds on that time or they may not be generate for hrs, i normally get 1-2 trades per day per each currency and i use 5,15 and hr bars but i could live on 5 or just 15.

Long story short ive stuck with building my intraday strategies in MT4 and used Tb what its best for EOD.

I have MT4 intraday system/s that always bring in the daily bread every day without fail, happy to exchange code to save time (discretion condition's applies), : )

(enters all positions to synch with TB) is this for portfolio update only?

Posted: Fri Dec 09, 2011 10:19 am
by LeviF
I'd be interested to see what you have.
freeman wrote:(enters all positions to synch with TB) is this for portfolio update only?
I use it if I bring a new client on, or adjust leverage, or bring a new system online, etc.