Archive for March, 2006

Programming A CMS Forex Broker Adapter in Wealth Lab Developer 3.0 – Part 1

Posted in Auto Execution, Forex Trading on March 30th, 2006

To say I’ve had fun over the last couple of days since my crazy expedition to create a Wealth Lab broker adapter fit for trading on CMS is an understatement.

It’s been nothing short of frustrating!

Especially since I’ve never done programming on this level before – just a little bit of VBA.

But… we all need to start somewhere, and I’m a firm believer that if you REALLY want to learn something you either teach it or do something with an intended goal in mind.

At the moment it’s the latter: building a WLD CMS broker adapter.

Okay, here’s what I’ve learnt if you’re interested in doing this yourself or just waiting for me to pass out. Either way by writing this out it in here it allows some of my sanity to return!

Firstly, I can’t get Visual Basic’s 2005 Express Edition to create a foundational WLD broker script. But creating a script in Visual C# 2005 Express Edition was a breeze, and I think it has to do with one small tweak you need to do in VC# that, for the life of me, I cannot find in VB.

But firstly, here are the testing scripts just to make sure we’ve laid the correct foundation:

To create a project in either of them you just click on File > New Project > Class Library > Enter a class name such as VTAPI and then hit OK.

Copy all of the following code into the VB script that opens (copy it over everything).

Now what you’ll need to do is import the WLD COM object and this is done by clicking on Project > Add Reference > COM > select WealthLab Library 1.0 > click OK.

Lastly you’ll need to click on Project > VTAPI Properties… > Assembly Information > select “Make assembly COM-Visible > click OK.

Click on the Save All button (which is the button with three floppy disks – to the right of the normal save button) and save it as “VTAPI”. After when that is done click on Build > Build VTAPI and a dll file has now been created.

Was that easy or what?

Well… not so fast, if you can remember I said that the VB script doesn’t work. We can check that in WLD now, but first we need to create a file so that WLD knows where to look for our dll file.

We do this by simply creating the following file:

WLD VB CMS Broker Adapter

(change the path to wherever you stored the dll file, most people using Windows XP will only need to change the “@@@@@@” section in that file to their Windows XP username)

Save this file in the root directory of your Wealth-Lab Developer folder, for most people this will be c:\Program Files\Wealth-Lab, Inc\Wealth-Lab Developer 3.0\ and save it as BrokerAdapter_CMS.txt (this is important).

Crank up Wealth-Lab click on Order Manager make sure CMS Forex is selected and then click on Broker Login.

Hopefully (or should that be unfortunately?) you’ll come across an error message box that says:

System error. Code: 203.
The system could not find the environment option that was entered

(If you get an error message that says something to the effect of “The specified module could not be found…” it means that you’ll need to open the BrokerAdapter_CMS.txt file up and check that the path you’ve entered is indeed the path that leads to the dll file in the VTAPI/Release folder, if not change it accordingly.)

I have no idea what that error box means, but it’s not good because our adapter didn’t work. After trying a million different things such as regasm (etc) I still couldn’t get it to work.

Thankfully I had VC# installed… and it is here where we DO get the broker adapter to work.

Here’s the process:

Firstly, crank up the program, click on File > New Project > Class Library > Enter a name such as CMSAPI and then hit OK.

Copy all of the following code into the script window that opens – copy it over everything.

As we did for the VB script we’ll need to change some of the settings.

Click on Project > Add Reference… > COM > select WealthLab Library 1.0 > click OK.

Click on Project (again) > CMSAPI Properties > Assembly Information… > select “Make assembly COM-Visible” > click OK

After when you’ve clicked OK click on Build (underneath Application with the active window) then select Register for COM Interop.

Click on the Save All button and save it as CMSAPI and lastly click on the Build menu selection (up the top) > Build Solution.

Still with me?

Alright, we now need to create that file for Wealth-Lab. Which you can find one here, but again you’ll need to change it so that it points to the dll file you just created and make sure you save it as BrokerAdapter_CMSVC.txt (this is important).

Now for the test.

Open up Wealth-Lab, click on Order Manager, change the selection so that it points to CMS VC# and hit the Broker Login button.

Hopefully you should see the words “Connected” in the lower left hand panel with the balances of Cash $1,000.00 and Buying Power $999.00.

Woohoo!

In the next post we’ll connect to the Visual Trading API and get this thing really cooking!

(PS – does anybody know why the VB script won’t work? If anybody can get it to work I’d love to know how.)

Auto Trading Forex

Posted in Auto Execution, Forex Trading on March 27th, 2006

Wouldn’t you agree that the best returns on our money are when we make the highest possible profit on the least amount of money with the smallest amount of work/effort?

One of the great things about the forex market is that enables customers to trade automatically.

Over the past several weeks I’ve dug around to try and find out more about what it takes to create a system that can trade automatically – preferably for the least amount of cost as possible.

Firstly though I had to find out what forex brokers allowed me to trade automatically, as not all forex brokers are created equal.

With some of the more popular brokers I was able to find that the following provided the capacity to allow you to trade your account automatically:

While I realise that there are other forex brokers which offer the ability to trade automatically (such as those that use MetaTrader) I wanted to find out which ones were able to interface/interact with my current backtesting platform Wealth-Lab Developer.

And so the next step began: having the forex broker’s API (which is the techno-speak acronym for allowing users to control the processes (etc) of their forex trading account) interact with the signals of my forex systems.

This left me with two options:
1) I could try and learn how to create the necessary software and write the code myself, or
2) Find a software that already does.

Option 2 sounded waay better, so I set out to try and find such software.

While my journey is still ongoing and incomplete I would like to detail a list of such software providers in case you too are looking for the same thing.

Fabre Factum US$699
Yet to receive a free trial subscription from this mob, but the attraction was the software’s ability to “supports Refco, FXCM, GAIN, Forex.com, FXAdvantage and CMS mini and regular accounts (demo and live accounts)”. Will detail more when I receive a free demo.

Trade Bullet US$35 – US$75 / month
Didn’t support any of the brokers I wanted, but I’ll include this in case some of you are using some of their supported brokers.

Trade Bolt (various costs depending on broker)
Offers trading through Gain Capital, doesn’t seem to support Wealth-Lab Developer.

Trade Robot US$500 – US$750
Supports FXCM only, doesn’t seem to support Wealth-Lab.

HyperOrder FREE!
Supports Interactive Brokers Workstation, Patsystems, MB Trading, FXCM, RefcoFx, MAN FX and MetaTrader. Doesn’t seem to work with Wealth-Lab.

API Trader FXTS US$25 / month (demo accounts) US$50 / month (live accounts)
Supports FXCM only and cross-platform (which could help those on non-Windows OS machines).

SnapDragon (Free?)
They are currently looking for beta testers who wish to trade from TradeStation onto Oanda’s platform.

Anyway, these have been the ones I’ve come across. As you can see not too many were helpful for my individual needs, or maybe they were and I just couldn’t tell.

So I moved on and looked at the first alternative of creating my own forex broker adapter for use in WLD. And to my surprise I found that Microsoft were giving away free Visual Basic, C# and C++ developer environments with their Visual Studio 2005 Express Editions (only until November this year) – which can help immensely with coding the required adapter.

So for now I’ll give it a bash and see how I go. I’ll be sure to report any successes here.

Lastly, I’m testing my crude forex broker adapter on CMS Forex’s API and demo account (all free and no paperwork is needed to sign to grab the API).

If anybody knows of any other forex trading robots or auto execution software that can interface with any of the above add your comments below.