Automated Trading

minx

Well-known member
Messages
328
Likes
10
I have a few mechanical systems that are ripe for automated trading but I'm a little worried about faults developing at some point along the chain from signal generation to trade execution. What currently happens is my system gives a signal, I input some data into Excel and then I place the trade. Ideally I'd like a program to do all this for me so I can free up time to do other development work.
My fear is that if CQG/ Excel/ TT/ PATS/ etc crashed then would the system suddenly start sweeping the market by trying to lift /hit infinity lots at a price of infinity/ zero. Or perhaps it'll start to act like a mad pinball machine and start hitting bid, lifing offer until all the capital has been burned up. Any idea of the software out there that can take signals off CQG, another number(s) from Excel and then conduct itself in the same sane manner a human would (or as near as possible).
I'd like to say money is no object but there are limits to this, to give you an idea of what I mean I'm thinking around the region of TT or CQG kinda costs. Basically stability will be the key, afterall no point in saving £200 a month on a cheap package if it f*cks up and costs me £10k on messed up trades.
I'm thinking I might be talking about an API here, how would I get this written or do the relevant companies write this for me adn then just charge extra on my RTs?
All comments appreciated
Minx

PS- I've posted this on a couple of other threads just to try to get the people 'in the know' to see it. Let me know if this breaks any rules, etc...
 
Last edited:
If you go the API route you will probably need to code it all yourself.
You could pay someone to do it but it would be very expensive and you will have to disclose your system.

Otherwise you can use off-the-shelf packages like Tradestation or Strategy Runner but with the limitations that come with a standard solution instead of something bespoke.

Good connectivity and an absolutely reliable and accurate datafeed are essential to reliable trading automation. Unfortunately, this is also where the costs can start to mount up.
 
jmreeve said:
Good connectivity and an absolutely reliable and accurate datafeed are essential to reliable trading automation. Unfortunately, this is also where the costs can start to mount up.
True but I currently use CQG and have direct access to the exchanges (via a clearer) so I'm already paying most of these expenses. I have to say that CQG has been a bit shoddy recently and the week we were out of sync with the US over summer time changes was terrible, their attitude was "just change your system", total crap!!

If I had an Api developed then surely I wouldn't have to reveal anything, I'd just say that when signal A is triggered look in Excel Sheet A, use Cell D1 and trade this size. Lots of 'IF' commands. Althou I know nothing about API so I'm just guessing here.
 
Last edited:
The CQG problem sounds very poor.
The last thing you want with automated trading is anything that needs manual intervention.
Reuters or Comstock feed might be better.

You will need an application that goes between Excel and something like the TT or Pats API
to write orders. I expect there is something like this available but I don't know how well it
would work and how reliable it would be.

You would have to handle all the order state information and respond to fill events.
There needs to be logic to cope with partial fills, rejected orders, message timouts
e.t.c. It is important to have exception handlers for all the things that can go wrong
and make sure these are dealt with gracefully.
 
CQG data can be terrible at times. If you have direct exchange access can you not take your price feed from that system and check it against what CQG gives you b4 you execute a trade? Just about anything can be fed into excel so you could check things there.
I have used TT combined with Excel in the past to automate very fast scalping systems and once I got the parameters correct they worked pretty well and error free. The downside was the amount the exchange charged me for all the orders I placed and pulled without being filled. One thing you need to do is ensure that when a message is sent to the exchange to trade you allow sufficient delay before sending another signal. I ran into issues when the system was reacting too fast to changes on one side but not the other and ended up buying offer and selling bid over and over when a signal went off. It cost a bit before I got that right. TT has parameters you can set to create necessary delays to solve this issue.

Now I use only Tadestation whose execution is slow and loses me a tick on most orders, otherwise I just take signals and manually execute so trying to improve on system execution.
If your system is taking directional signals then generally your execution does not need to be as precise but if your system is a scalper then the execution issues are far more important and I suggest you get familiar with them on 1 lots before you move to realistic clip sizes.
 
twalker said:
If your system is taking directional signals then generally your execution does not need to be as precise but if your system is a scalper then the execution issues are far more important and I suggest you get familiar with them on 1 lots before you move to realistic clip sizes.

It is directional, prob no more than 4 trades a day (bad day) and sometimes no trades for a week (current bear move in Bunds is a perfect example).
My real question was the stability in the chain of command should one part of the chain break. If CQG posted 0.00 as a price in the Bunds then I dont want my auto-trader to start trying to sell 1,000,000 lots at mkt, also if there is a fat finger at a bank and someone lifts 5000 DAX at mkt then I dont want it to try to hop on the back of this but would like it to ignore this stuff. I guess you would put in some "IF 'Extreme Event' then 'React like this'" kind of progrmming but I'd also need to take into account major economic/terrorist events and not have it shutdown just because we have a 150 tick spike in Bunds. If you see what I mean.....
 
best bet is to keep log of last price and if you are trying to submit a price which is > x ticks off last traded then you do not take the trade. Should be easy to write code to ignore zero price values.
As for extreme events I find that with technically driven systems these events pan out over time, sometimes they go in your favour, sometimes against you. I do not have a fundamntal element to my systems other than tightening stops on NFP days.
 
Did your IT slow over the ECB conference? I was getting Buy orders rejected for being too far behind the mkt even though on my screen I was trying to lift above the mkt. I guess thats another problem, if an order is rejected the software would need to know what this means and dive in again until it achieves its objective (getting in/out).
 
I try to include fair value bench marks into my trading programs so that you can supress any trades
to far away from FV. This makes sure I don't get killed in sucker trades.

So for Bund your program could check LIBOR and the cheapest to deliver bond to get an idea of
where you should be trading.

Not so easy for soft commodities where a fast real-time pricing benchmark is not available.
 
minx said:
I guess you would put in some "IF 'Extreme Event' then 'React like this'" kind of progrmming but I'd also need to take into account major economic/terrorist events and not have it shutdown just because we have a 150 tick spike in Bunds. If you see what I mean.....

Not shutdown... I'ld rather have the system shutdown than go awry. The first thing I've done in the system I'm developing is to create a basic check if everything is ok. If in doubt the system should shutdown and don't take any trades till verified everything works as designed. Normal market behaviour such as spikes is off course another thing. The system should be able to deal with them. How to handle them depends on the strategy. Personally I think there's little you can do about them. You don't know whether it's a spike or a crash until it's to late to do anything about it.
 
If wishes were horses.....

I'm thinking I might be talking about an API here, how would I get this written or do the relevant companies write this for me adn then just charge extra on my RTs?
All comments appreciated
Minx

Have a look at this thread
http://www.elitetrader.com/vb/showthread.php?threadid=35012

Going down the auto trading route is IMO opening a can of worms and rather like peeling a never ending onion. There is no subsitute for learning to trade successfully first, then perhaps to implement your own unique strategy into auto trading. Putting the cart before the horse will waste much time and money. As I mentioned in another thread, it is easy to be fooled into thinking computers will turn us into successful traders.
 
Commercial APIs make a good starting point

minx said:
I'm thinking I might be talking about an API here, how would I get this written or do the relevant companies write this for me adn then just charge extra on my RTs?
Minx

I think there are great advantages in using the APIs in commercial packages. I use Amibroker who has an excellent function library and have code for manual and automated order transmission. The link below gives you an example of the API for Interactive Brokers.

http://www.amibroker.com/at/

Now I'm sure many of the more popular chartng/analysis packages have similar offerings. The advantage of using something like this is that example coding with comments is already available as you can see in the link. Thus you do not have to re-invent the wheel, but simply add the extra spokes and perhaps a little motor of your own.

Further down the thread you say
minx said:
I guess thats another problem, if an order is rejected the software would need to know what this means and dive in again until it achieves its objective (getting in/out).
In the link I gave you will find code such as:

symbols = ibc.GetPendingList( 0, "Error" );
- returns list of orderids that have errors

You may be able to build some of this into conditional statements for building/modifying/cancelling orders.

Similarly you could build the extreme events code into it.

I don't deny that this would require time and work on your part, but at least you start with a framework. Furthermore there are usually user groups on the web e.g. for Amibroker there is a Yahoo group, where you might get assistance in programming certain types of events, without revealing everything

Furthermore if you get someone else to program the API for you, you will find it harder to tweak it yourself to reflect changing strategies/market conditions. It's always better to have worked through the logic and code yourself, so you fully understand it. Also in my experience a coder will not always interpret what you are asking for correctly, not because of incompetence, but that is the nature of communication - like the game of chinese whispers.

Finally, if you do decide to go down the commerical API route you will probably be able to download API formulae documentation freely from their sites to evaluate the complexity and breadth of the programming language.

Charlton
 
rols said:
Going down the auto trading route is IMO opening a can of worms and rather like peeling a never ending onion. There is no subsitute for learning to trade successfully first, then perhaps to implement your own unique strategy into auto trading. Putting the cart before the horse will waste much time and money. As I mentioned in another thread, it is easy to be fooled into thinking computers will turn us into successful traders.

I'm already trading these systems profitably, I've been trading for 6 years, I just want to automate them.
 
minx said:
I'm already trading these systems profitably, I've been trading for 6 years, I just want to automate them.

I would suggest not to fix what ain't broke and forgive me if I caused offence. If your system contains interpretation and intuitive instinct then only you can program it and even this may prove fruitless because you could be adding some crucial elements to your trading that you are not aware of.

If anyone knows how to program a gut instinct then please let me know!

Once you leave a computer in charge of your account then there are many other factors besides the system performance that need consideration. Back up systems for power source failures, internet, broker and server problems, not to mention Bin laden being captured.

The dream of switching on the automation and going off for a round of golf while the money comes rolling in is a wonderful one. If wishes were horses....
 
I have a few mechanical systems that are ripe for automated trading but I'm a little worried about faults developing at some point along the chain from signal generation to trade execution. What currently happens is my system gives a signal, I input some data into Excel and then I place the trade. Ideally I'd like a program to do all this for me so I can free up time to do other development work.
My fear is that if CQG/ Excel/ TT/ PATS/ etc crashed then would the system suddenly start sweeping the market by trying to lift /hit infinity lots at a price of infinity/ zero. Or perhaps it'll start to act like a mad pinball machine and start hitting bid, lifing offer until all the capital has been burned up. Any idea of the software out there that can take signals off CQG, another number(s) from Excel and then conduct itself in the same sane manner a human would (or as near as possible).
I'd like to say money is no object but there are limits to this, to give you an idea of what I mean I'm thinking around the region of TT or CQG kinda costs. Basically stability will be the key, afterall no point in saving £200 a month on a cheap package if it f*cks up and costs me £10k on messed up trades.
I'm thinking I might be talking about an API here, how would I get this written or do the relevant companies write this for me adn then just charge extra on my RTs?
All comments appreciated
Minx

PS- I've posted this on a couple of other threads just to try to get the people 'in the know' to see it. Let me know if this breaks any rules, etc...

I have designed a trading mechanism which can trade several items simultaneously, fully automatic and trades around the clock from an account via API. In fact is has inbuilt BE points to maximise profits and minimise losses as well as BACKTESTING procedures to test a strategy. However, to code your logic and subscribe to the trade engine will cost $$. It all depends what you want to do and how much are you willing to spend to do it.

E
 
It's not by the day its per hour they charge but I usually use my programmers which is less, provided
the strategy is not complex. Again it depends on how simply your strategy is. In saying all that keep in mind that the full automated trade engine is built already and connects to a specific broker and if that needs to change to say another broker that will cost also but for backtesting that wont be neccessary. So only the coding of the strategy is needed.
I hope this is helpful.

E
 
Top