Thursday, May 13, 2010

At last, the VOM article has been published

See the MQL5.com article section.  It was a big effort for me to get it finished, topped off at the end by their somewhat tricky article editing software.  But the editor, Eugene, was very helpful, and it's now up there.  A nice WebMoney payment, and an MQL5.com rating that has jumped to 588.

What now?  It's been hanging over my head for so long.  I get the feeling that it will be rather overwhelming for most readers, although I hope it is taken up by advanced coders and cleaned up in the process.  The fact remains that it is really the only way to manage multiple orders on the one symbol in MT5.  I'm very prepared to spend time responding to questions and fixing bugs.

But what I really want to do now is to finish off my Neural Network EA, and discover whether the approach that I've been thinking about for so long is going to work.  It's coded, but something's wrong with the learning process, and will probably require many hours to find out why. 

Monday, April 19, 2010

Eight months of virtual hosting

A lot has happened since my first blog entry on virtual hosting, which was on 28th August last year.
My original post described what I did to set up a virtual host. In summary
  • A simple request to Commercial Network Services that enabled me to have Metatrader 4 up and running in two hours
  • Situated in New York to minimise ping times to FXDD.
  • $US30 per month
What has happened since then
  • I’ve had the most relaxing eight months I can recall in terms of MT4 reliability. The virtual hosting service isolated my MT4 live account from the implications of a 36 hour phone line fault, a 12 hour power outage in my street and two multi-day visits to hospital. Conversely, I experienced one issue with a failed restart command that I requested of the virtual host, which CNS responded to within a couple of hours.
  • I started the virtual host with 384MB of memory, but with up to three MT4 clients and two beta MT5 clients running I upgraded to 640MB at the additional cost of $US5.12 per month. The amount of container memory may still seem very low, but it’s the right amount for the purpose now, and can be adjusted immediately any time, in contrast with the purchase of a general purpose PC with multi-GB of memory to run large concurrent applications and to cater for future requirements.
  • For some time CNS has been encouraging their customers to move from Virtuosso host software to Microsoft’s Hyper-V, so I did this about a month ago. Before, my container was a Windows 2003 x64 instance, and the new container is Windows XP 32 bit. Everything works fine and this should remove the x64 limitation with running 32 bit dlls, which I have no need to do right now. It is however the one area in which I have less than 100% satisfaction with CNS: their console which shows details of my virtual instance is still pointing to the old Virtuosso host, and their console upgrade to point to the Hyper-V stuff has been “real soon now” ever since I changed over.
  • The last change is an interesting one: my FXDD live account is now with FXDD Malta. I believe that this is an offshore strategy to circumvent the new NFA FIFO laws in the US. The funds are still with a secure (?) US bank, but when I get a moment I must check out the ping times from New York, which will be a lot slower if the servers are physically in Malta.
So overall, I thoroughly recommend virtual hosting. At $420 per year it’s a reasonably cost effective alternative to having a dedicated Metatrader PC at home, and it’s certainly a lot more reliable.

I have no association with CNS beyond being one of their customers.

Wednesday, March 31, 2010

Two VOM shorts on EURUSD

Earlier, I posted an example of two VOM EAs with opposing virtual orders, resulting in no net position at the broker.

Today, there is an example of the two EAs agreeing on price direction. Both the FrAMA Cross EA and the Support Resistance EA are short on EURUSD, and it is instructive to see how this ends up in the VOM and at the server.

FrAMA Cross EA on daily EURUSD chart
Virtual short 0.1 lots at 1.33978. This has a wide protective virtual stoploss 500 (or 5000, in 5 digit terms) pips away.
This was the first order executed, and the server stoploss was set at 550 pips, ie virtual stop plus 50.

Support Resistance EA on hourly EURUSD chart
Virtual short 0.1 lots at 1.34895. This has a virtual stoploss 85 (or 850, in 5 digit terms) pips away.
This is what happened to the server position when this second order was executed
  • The server lots moved up to 0.2 short
  • The server position open price is now the average of the two orders - this is automatically calculated by the broker.
  • The VOM moved the server stoploss down to the tightest virtual stoploss plus 50 (1.36195), which can be seen on the daily chart.
If the virtual stoploss for this EA is hit, then the server stoploss will revert back to the much wider stoploss of the FrAMA Cross EA

All this careful maintenance of the server stoploss at the tightest stop plus 50 (500) pips is there for disaster protection in the event of Internet or PC failure.

Monday, March 15, 2010

Forward tests suspended for a short time

I run all my MetaTrader accounts (MT4 & MT5 demo and MT4 live) on a Commercial Network Services  virtual desktop (see original post here). Although there have been a couple of negative comments on this blog about CNS, it's been completely trouble-free for me.

CNS has been promoting a move to Hyper-V for some time, so I decided to do it. Hyper-V is apparently even more reliable than Virtuozzo, which is what I was running on before. I received an email this morning that the change had occurred, but I didn't have much time before going to work so have only set up my live account at this stage. It only took me about 20 minutes, and it's running fine - I'll write another blog soon on my impressions of Hyper-V and the general experience of remote desktop working. 

Other than being a customer I have no connection whatsoever with CNS.

[ update 18/3 ]
Just waiting for another MT5 build to come out before I can start the forward tests again.  The last two builds broke my VOM code but as usual MetaQuotes have been very responsive in fixing it.

Thursday, March 11, 2010

A real "hedge" situation with two different timeframe MQL5 EAs using the Virtual Order Manager

I started up the FrAMA Cross EA VOM forward test at least a couple of weeks ago during a massive EURUSD downtrend, and the first cross event occurred yesterday with a long trade which has already reversed this morning to a short after pulling in 111 pips. So it's finally in the market. I am reassured to see a profitable trade first off, but remember that this is such a slow trader that even though the backtest is excellent it is not at all certain that it will be profitable long term.

It's good to see an example of a real "hedge" scenario happening here with the two different timeframe EAs. The Support Resistance EA entered a EURUSD long last week against support in the 1.3450 area (which is off the bottom of the chart screenshot shown below), and the FrAMA Cross EA is now EURUSD short. The result is no open position at the broker, with the VOMs maintaining the opposing long and short trades respectively.

Wednesday, March 3, 2010

Reorganising the forward tests

I have been letting a number of forward tests run for some time without really paying much attention to them, so it's time to clean everything up.

Here's what will continue to run.  These will also have a link in the forward tests section on the right, and I have looked through old posts and updated links so I hope everything works.

MetaTrader 5
I am running two VOM EAs on the one demo account.
Past forward tests on MetaTrader 4
I was running a number of tests on MT4, in particular two versions of a News Trader, but I'm going to stop for the moment.  The best NewsTrader only broke even at best, and obviously needs work.  I'll be converting to MQL5 as some stage.




Thursday, February 4, 2010

Is the FrAMA Cross EA successful?

In a nutshell: no, and maybe.

No-one was more surprised than me when I plucked a simple strategy out of the air to develop my MQL5 coding skills, and it actually showed some promise. This is the FrAMA Cross EA, which simply uses a moving average cross on a 1H EURUSD chart with the Fractal Moving Average indicator that comes with MT5. The two MA periods are 6 and 12, with a fixed stoploss of 50 pips. Each cross event reverses the direction of the trade.  My original blogpost for this EA is here.

In the absence of a strategy tester for MT5 so far, and witnessing the promising equity curve in the forward tests, I decided to code the FrAMA indicator into MT4 and backtest it. The formula is well documented under the Analytics section of the MT5 terminal help file.

So here's an MT4 custom FrAMA indicator, which gave me the satisfaction of behaving exactly the same as its MT5 counterpart.

I wasn't particularly surprised to see that the backtest using the above parameters is rather poor.  The equity curve from 1/1/2004 to now is like this:


Maybe there's some tweaking that can be done - there is an extended profitable period from last August - but I'm not going to bother because it tends to reinforce my experience that H1 charts are very difficult to trend-trade.

Not to be deterred, I set about optimising the parameters using the MT4 strategy tester. There are lots of ways to trend-trade Daily charts - is this another one? The answer is, as is usually the case with optimisation of EAs on daily charts, "maybe". Here's an optimised backtest of a FrAMA Cross EA on a Daily EURUSD chart with Fractal MA periods set to 2 and 58, ending at 31/12/2008.



… and here is the out of sample 1/1/2009 to present.



In case anyone is wondering, this is a legitimate use of the open-prices-only model for backtesting, because the EA gets its entry and exit signals from events detected in the previous completed bar. If you want to wait for half an hour, a 90% modelling backtest of every tick will look the same, and an EA of this type will behave almost to the dollar the same in live trading as it does in backtests. But notice that I didn't say that it will necessarily be as profitable - optimisation of daily charts introduces a big fluke factor, caused by the fact that the total number of trades is statistically too small.

So where to from here? Before even considering trading them live, I usually mothball EAs of this type for at least a year, dust them off, and see how they would have performed. With the massive peak in volatility from the GFC well behind us, maybe it's time to get into long term trend trading again. In the meantime, you can watch grass grow (average 1 trade every 3 weeks!) with the VOM version of the EA.