Anyone here familiar with MT4?

Questions and discussion of Trading Blox and other platforms for non Trading Blox customers. Trading Blox customers should use the Trading Blox Support forum.
Post Reply
LeviF
Roundtable Knight
Roundtable Knight
Posts: 1436
Joined: Mon Dec 22, 2003 12:24 pm
Location: Des Moines, IA
Contact:

Anyone here familiar with MT4?

Post by LeviF »

Does it have any portfolio management capabilities, like can I run a simple script to close x% of all open positions?
babelproofreader
Roundtable Knight
Roundtable Knight
Posts: 138
Joined: Wed Nov 10, 2004 4:36 pm

Post 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.
LeviF
Roundtable Knight
Roundtable Knight
Posts: 1436
Joined: Mon Dec 22, 2003 12:24 pm
Location: Des Moines, IA
Contact:

Post 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?
babelproofreader
Roundtable Knight
Roundtable Knight
Posts: 138
Joined: Wed Nov 10, 2004 4:36 pm

Post 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.
LeviF
Roundtable Knight
Roundtable Knight
Posts: 1436
Joined: Mon Dec 22, 2003 12:24 pm
Location: Des Moines, IA
Contact:

Post 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...
babelproofreader
Roundtable Knight
Roundtable Knight
Posts: 138
Joined: Wed Nov 10, 2004 4:36 pm

Post 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.
ratio
Roundtable Knight
Roundtable Knight
Posts: 338
Joined: Sun Jan 15, 2006 11:07 pm
Location: Montreal, Canada

Post 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
freeman
Roundtable Knight
Roundtable Knight
Posts: 114
Joined: Tue Oct 04, 2005 7:12 pm
Location: Switzerland

Post 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.
LeviF
Roundtable Knight
Roundtable Knight
Posts: 1436
Joined: Mon Dec 22, 2003 12:24 pm
Location: Des Moines, IA
Contact:

Post 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.
freeman
Roundtable Knight
Roundtable Knight
Posts: 114
Joined: Tue Oct 04, 2005 7:12 pm
Location: Switzerland

Post 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?
LeviF
Roundtable Knight
Roundtable Knight
Posts: 1436
Joined: Mon Dec 22, 2003 12:24 pm
Location: Des Moines, IA
Contact:

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