Sunday 13 March 2011

MT4 - Indicators and Expert Advisors

My live trading activity has almost stopped as I try to learn more and more about the Foreign Currency Exchange and if I can make money from it.

I spent the weekend learning how to code in MQL4 the C++'esque language used by the popular trading platform MT4. MT4 is available as a trading platform through most leading brokers. It is a powerful charting tool with a heap of indicators. More excitingly (for me as a computer nobby person) is the fact you can program your own indicators and indeed program your own Expert Advisors.

An Indicator is something that you can use to see a general trend in the market. There are long established "industry standard indicators" that are based on averages, volume, mathematical algorithmic curves etc etc.

I decided to learn all about reversal patterns this weekend. These can be applied to any timeframe and are basically a set of identifiable patterns that indicate a current trend is about to reverse.

As such, I wrote myself an advisor that would :
  • identify a trend (I could define a trend as x number of consecutively climbing or descending close prices), identify a signal (interrogate the current trading window and look for tell tale signs of a reversal).
  • discern an entry point (as well as top and limit exit points)
  • identify confirmation that the predicted trend was reversing
Not bad for 22 hours programming !! while my lovely daughter tortured me by playing non stop Justin Beiber, Glee and High School Musical in the background....not what I would consider 'thinking music'. I must at some point untie her and let her back out of the cupboard.

Now, I want to take this indicator and turn it into an advisor. An advisor will, based on a set of conditions, place an order for you, manage the order and report the outcomes.

Once you have developed an advisor you can "back test" it on historical data, this involves running your advisor from some start point in the past and seeing how it would have worked.

If you get a good result from this, you can then forward testing by letting your advisor automatically place trades on your demo account and see how it goes in 'real life'.

Im not even sure if I believe a system can be written, after all there are alot of smart cookies out there and I would imagine anything I have thought of has already been tried, however the process I am going through teaches me an awful lot and is great fun.

One issue of backtesting is you keep tweaking your system until you show profit, this then results in you creating a system that can "predict the past". Which is possible not much use :) Hence the need for forward testing.

Ill post up some screen shots of my indicator and some links to MQL4 programming guides later.

Till next time, Pip Pip.

No comments:

Post a Comment