Archive for April, 2006

MetaTrader 4

Posted in Forex Trading, MetaTrader on April 19th, 2006

Wow!

Things have changed since the last time I downloaded MetaTrader many years ago.

After attempting to program for myself a connection between Wealth-Lab and CMS’s API (which proved unsuccessful) a friend continued to berate on me to download MT4.

Initially I wasn’t enthused.

I mean, I had tried the platform many years ago and it was too MetaStock-like (and I wasn’t a big fan of MetaStock – mainly due to the limitations of its coding).

But earlier this week I caved in to peer pressure and downloaded it.

Wow!

A lot has changed since whatever version of MetaTrader I used before.

Some of the things that I liked about it was its C-like Expert Advisor programming capabilities (where users can program a system and have it automatically trade), it’s large array of historical data (daily data since 1978 for some currencies!!) and its ease of use.

While there are only a small handful of brokers that support autotrading from MT4 a couple of the ones I would likely open an account with would be: Interbank FX and FXDD, with my primary choice being Interbank FX (which also seems to have changed since my last visitation).

Anyway, if you’ve been someone like me that has avoided MetaTrader and are looking for a platform that truly has it all I dare say that you really are missing out with this.

Try MetaTrader today.

(I’ll be learning how to code up some systems in their Expert Advisor and will relay my successes/failures over the coming weeks – stay tuned)

CMS API Part 4: Wealth-Lab Dilemma – Is This The End?

Posted in Auto Execution, Forex Trading on April 12th, 2006

Well it seems I’ve hit my first brick wall with automating a system on Wealth-Lab.

Just as I had finished coding up the CancelOrder procedure had I soon discovered that Wealth-Lab does not offer the functionality of flushing its alerts window.

What’s so important about that? I hear you ask.

You know how we created the alerts so that it would accurately showed us how much of a particular order was attributed to closing an already existing position and how much of the other portion was to initiate a new position… well, it seems that if we ever wanted to cancel an order that was split like this the side that was not cancelled would still be shown as active. Allow me to illustrate this by way of an example:

Let’s say we have already bought 5 GBPUSD contracts (therefore we are LONG 5 GBPUSD) and these 5 contracts do not have an attached stop loss order. Now let’s assume that we place an order to SELL 9 GBPUSD contracts. If we open Wealth-Lab and login to our CMS demo brokerage account our alerts screen will show something like this:

Sell 5 GBPUSD
Short 4 GBPUSD

Which is correct.

However, it we click on the cancel button for any one of these two orders the ENTIRE order will be cancelled, even though the alerts window will show one as being active!

eg. If we were to cancel the first order…

Cancelled 5 GBPUSD
Short 4 GBPUSD

Are there any workarounds?

At the moment this is what I’m trying to figure out, BUT if we think about this carefully do we really want “workarouds”? I mean, I don’t know about you, but I’d prefer to have NO workarounds at all if I want to eventually put real money on the line.

However, if we are to integrate this into Wealth-Lab we would need to change the alerts window so that each line reflects one order, continuing with our example above our order to sell 9 GBPUSD’s would look like this in the alert window:

Short 9 GBPUSD

Again though I think this is where things will begin to get messy as we simply cannot refesh the alerts window in Wealth-Lab and as Wealth-Lab needs to be linked to a portfolio if we start amassing too many entry orders (even though they may not be entry orders at all in CMS) it will begin to bog down the entire process.

Could this be the end of the road?

Possibly, and if it is it was still a worthwhile experience.

Amendments to Previous VC# Code in Part 3

Posted in Auto Execution, Forex Trading on April 10th, 2006

If you’ve been following the CMS API auto-trading articles the VC# code in the previous article was incorrect.

If you conducted some testing you would have noticed that if you placed multiple orders that tallied greater than its open position quantity you would have seen an output that would have been wrong.

As an example, if you were long 1 mini USDJPY position (with NO attached stop loss orders) and placed 3 individual 1 mini stop sell orders on the USDJPY you would have seen on the alerts something to the effect of:

Sell 1 USDJPY
Short 2 USDJPY

This is incorrect as we need to return each individual order, such as:

Sell 1 USDJPY
Short 1 USDJPY
Short 1 USDJPY

With this new code it seems to have solved this problem.

If you’ve been following and have used the previous code download the latest one here. If you’ve used the code in the part 3 article after this date then you don’t need to worry you would have downloaded the correct version.

Adding Our First Alerts To Wealth-Lab (Part 3)

Posted in Auto Execution, Forex Trading on April 5th, 2006

This article is Part 3 of a forex auto-trading series I am currently undertaking. If you haven’t already done so you want to read through the other two parts before continuing on.

Over the last couple of days I’ve been racking my brain over how best to have WLD read open orders.

Think about this for a second:

If I am long 3 mini lots on the EURUSD, and I place a stop and reverse order to sell 6 minis on the EURUSD how should this order register on WLD?

Now before you contemplate an answer remember than CMS and WLD have two different order types. CMS has only buy and sell, Wealth-Lab on the other hand has Buy, Sell, Cover and Short – therefore our alerts are going to need to be a little more precise.

In answer to my question above though, in Wealth-Lab we will need to show 3 lots as being of the order type “Sell” and 3 lots as being of the type “Short” – as the first lot will see the closing out of an already existing position, whereas the next lot will be the opening of a new short position.

Okay, several other things I noticed about CMS’s order types is that they signal whether a position is attached to an already open position. In other words, if you attach a stop or limit order to a trade these stop and limit orders will be different to a limit or stop order that isn’t attached to another order.

CMS do this by simply denoting attached orders as “L” (limit) or “S” (stop) and unattached orders as “EL” (entry limit) or “ES” (entry stop).

This does help as we now know that every order that is denoted by an L or an S is one that is attached to an already existing position, therefore, it can only be a “Sell” order type or a “Cover” order type.

While this seems so much easier in print it ended up being quite a pain trying to get it down into code for orders that are unattached as we still needed to find out whether there were any orders that were open and didn’t have attached orders.

Anyway, here is the new code that you should paste over your existing VC# CMSAPI project.

Don’t forget to change the username and password fields in the script to your demo account’s username and password.

Hit F6 (or Build > Build Solution) and before you open up Wealth-Lab open up your VT platform and login to your demo account and place a few trades (otherwise nothing will register in your alerts screen in WLD).

Enter into a currency at market and then place a stop order for a lesser, or more quantity than the amount you just went at market with.

Try this for other currencies before opening up Wealth-Lab, maybe even place a few stop and limit entry orders with attached stops/limits.

Write down what Wealth-Lab will need to show – don’t forget that WLD uses Buy, Sell, Short and Cover so you may really need to nut out what will happen if you’ve put some complex orders on.

You should notice that when you open WLD and login to your broker that the orders display as your answers should.

You may also notice that attached stop and limit orders to entry stop and limit orders aren’t shown. There’s a good reason for this: these orders aren’t active – they’re an If-Done type of order, meaning that they will only become active if the entry stop or limit order turns into an open position.

Why Are You Doing This Autotrade Thing?

Posted in Auto Execution, Forex Trading on April 2nd, 2006

I thank all of those who have participated in adding comments to the posts on auto-trading and I look forward to further insights and discussions from all of you as we continue down this path.

What I’d like to do is to just explain myself a little further on why I am undertaking this journey as well as provide some disclaimers to those who are following along.

Firstly, I undertook this task as an adventure.

I have used Wealth Lab Developer for several years and have used the product fairly extensively during those three years. As I feel I know the Wealth Lab platform quite well I thought I could undertake the task of creating a forex broker API to see if I could auto-trade – as this functionality exists (I suppose my attitude is similar to British climber George Mallory’s when he climbed Mount Everest in 1924, when asked why he did it, he responded with, “Because it’s there”) .

So, just as George did, I too am embarking on my own Mount Everest: auto-trading the forex market through WLD… because it’s there.

While I don’t doubt that other platforms, such as MetaTrader, can provide auto-trading functionality I thought I’d rather spend my time learning VB.NET (or VC#) which can help broaden my programming horizons that may possibility add further functionality to WLD or to other things in general.

Which leads into my disclaimer.

I haven’t coded any VB.NET (or VC#) stuff EVER, therefore, if we ever do get to the end of this adventure you should check the code THOROUGHLY before even contemplating using it on a real account.

I know for myself personally that I’ll be stringently testing any system I wish auto-traded for at LEAST 1 month on a demo account before moving it to a real account, and even then I would still be a little skeptical on the process.

So please understand this “adventure” could just be that – an adventure. However I do want to know if I can do this, and what problems or benefits such an adventure can bring to my forex trading skills.

All in all I hope we all learn something through the experience.

I wish everyone the best with their forex trading success.