# Algorithmic trading system



## Punta (27 October 2011)

Hi all, 

I am looking to set up an algorithmic trading system, and wonder whether anyone has any advice on how to go about this.

As background, I'm technically competent (Matlab, C, Bash, Linux), and I have been analysing historical end-of-day-data, and have developed a strategy that I'd like to implement.

How do I get from running my computer code each day, which tells me which stocks to buy/sell, to executing those trades?

Let's say I have 50+ symbols that I want to purchase in the morning, but I don't want to manually read them from my computer program, and then click the appropriate buttons in IB/Etrade.  As an individual trader (dare I say punter), do I have the option to implement this?

One thought that springs to mind is that I could set up my system to automatically email a list of buy/sells to the broker that I use.  Are there online brokers who can take this kind of input, or would I need a human on the other end to interpret the instructions??  If the latter, I would imagine that the small intraday gains would be wiped out by fees...

I am somewhat reluctant to have proprietary software installed on my system, but if there's something out there that is tailored to this sort of thing I'd love to hear about it...

Thanks!


----------



## Gringotts Bank (27 October 2011)

There is no way in Australia that I know of.

In the US there's heaps of companies and brokers that will do it for you.  You just set your conditions and let it rip, while you sit back and realise some hefty losses!   Or you can rent a system and have a broker execute it for you.


----------



## RazzaDazzla (27 October 2011)

Have your algo produce your signals. Feed your signals into an excel spread sheet (through a CSV file).

IB has a DDE that allows live prices to be fed directly from IB into excel, and also orders directly from excel to IB.

So EOD, once your signals are in the spreadsheet, do your calculations to figure your position sizing, and then pass that order for that stock from excel into IB.

If you want to get even nerdier, I'm sure there's plenty of other ways to pass order info into IB via their API's.


----------



## Punta (27 October 2011)

Thanks, that's awesome - it looks like C++ can talk directly to IB through their API.  It also looks like there's wrappers to let Python talk directly to IB.  Looks like a few more nights of coding coming up for me


----------



## Gringotts Bank (28 October 2011)

RazzaDazzla said:


> Have your algo produce your signals. Feed your signals into an excel spread sheet (through a CSV file).
> 
> IB has a DDE that allows live prices to be fed directly from IB into excel, and also orders directly from excel to IB.
> 
> ...




If you have to fiddle with excel to work out what to buy and how much, how is that automated trading?  It's sounding pretty much like a manual system.  

I know AB can interface with IB and do true automated trading, but the AB guys recommend always _monitoring _it to make sure nothing goes wrong! Yikes! The auto-trading plug-in is still classified as Beta, I've noticed.  So I didn't count that.

Compare this with eg. Tradestation, TicknTick, RightEdgeSystems and a millions others.... all in the US.  Turn your PC off and it will take care of it.


----------



## RazzaDazzla (28 October 2011)

Gringotts Bank said:


> It's sounding pretty much like a manual system.




Gringott,

My post was a little misleading.

Ideally the user would have a spreadsheet setup which receives the live prices from IB, and then the spreadhseet auto calculates the position sizing based on what ever formula the user wants. These orders are then passed from Excel to IB.

As the OP has found out, IB has API's for C, etc. A language like that would be far more powerful and flexible than relying on M$ Excel.

You make a good point re. using other "truly" automated services. I personally would not rely on my home PC and home internet connection to be up and running 24/7 and updating my orders.

However if my system was EOD, then I don't see any harm in firing up the system on home PC. Then the system could submit the orders after the close, I could then eyeball the orders as a last minute sanity check before the next open.

Horses for courses. EOD, set it up yourself at home. If it's intraday, then hosting it somewhere else would be highly recommend. Either way, all very interesting stuff in my opinion.

OP let us know how you get on! Oh, and don't forget IB has a paper trading facility which might be a good sandpit.


----------



## Gringotts Bank (28 October 2011)

RazzaDazzla said:


> Gringott,
> 
> My post was a little misleading.
> 
> ...




Yeh I once tried to get a half-automated thing going, using 100's of conditional orders, placed each EOD to _maybe _trigger the following day.  I was trying to catch maybe 2 or 3 stocks per day of the 100's that had orders on them.  The idea appealed to me, because I could go and do other stuff during the day.  Alas, it was a flawed system!


----------



## ishakeel (6 May 2012)

Markets crash due to faulty algorithm? Traders must be forced to bear the losses.. Ouch!

http://economictimes.indiatimes.com...d-to-bear-the-losses/articleshow/13012031.cms


----------



## howardbandy (6 May 2012)

Greetings --

If you are thinking about having an interface between your signal generation program and your brokers order entry facility, I recommend being very careful.  In the US this is often referred to as "automated trading" or "a real-time trading interface", or something like that.

A few years ago I was a research analyst for a Commodity Trading Advisor (CTA) company and we had automated trading.  We had live personnel at the computers every minute of every day that an order could be generated.  We had duplicate / redundant everything -- computers, power sources, data feeds, etc.  We had excellent relationships with our brokers, so that when a trade was entered due to an erroneous tick, we could make a telephone call to the broker and get out of the trade as soon as possible.  We tested everything regularly, and needed it more than once. 

I do recommend that trading systems be formula-based.  But I recommend that the orders be placed manually after a person has verified that the trade is OK. 

Thanks,
Howard


----------



## CanOz (6 May 2012)

howardbandy said:


> Greetings --
> 
> If you are thinking about having an interface between your signal generation program and your brokers order entry facility, I recommend being very careful.  In the US this is often referred to as "automated trading" or "a real-time trading interface", or something like that.
> 
> ...




Howard, by now almost all intra-day algorithms are trading automatically. I agree they need to be watched to make sure the everything stays connected and orders are properly executed. Planning for the worst case scenario must be done and the plan must be ready to be executed as well. 

But honestly in this day and age i can see no reason why not to trade in full auto.....certainly for my systems. I don't even need to use a VPS, but some should consider it depending on how critical latency is.

With proper slippage factored in, the system should perform as expected.

CanOz


----------



## Punta (16 August 2012)

I missed the last few posts on here.  Thought I'd update (inspired by another thread).

I ended up going with IB and using their java API.  IB is set up so that any one of a half dozen languages can communicate with it.  Just about everything you can do in TWS with mouse clicks, you can do with code that connects to TWS.  

It took a while to set up (I had no previous java experience), but in the end I think it was worth it.  It allows me to trade strategies that I couldn't manage manually, due to the time taken to make decisions and click buttons.  Also algos don't get bored of waiting for the "right" patterns.

I agree with a lot of what Howard said above - there are inherent safety issues with automated trading.  On the other hand, it gives you access to a class of strategies that would be otherwise unavailable.

You should be able to code safety checks into your algorithms that take care of most of the problems that develop - obviously always have multiple lurking stops, and make sure that the system is never in an unexpected "state", with open positions.  You obviously can't guard against every eventuality, but the same is true with human trading.  

It's different strokes for different folks and some people would never be comfortable with leaving a computer to make trading decisions and executions.  On the other hand, it works very well for a lot of people.  I personally don't have the emotional composition to trade intraday with mouse clicks - it makes me too sweaty.


----------



## qldfrog (4 November 2019)

https://www.afr.com/markets/equity-...ld-s-most-lucrative-black-box-20191104-p53738
Interesting, anyone read it before?


----------



## Bernfeld (6 December 2019)

Punta said:


> Hi all,
> 
> I am looking to set up an algorithmic trading system, and wonder whether anyone has any advice on how to go about this.
> 
> ...




For these purposes, a trading robot can be used, for example, on the Metatrader 4/5 platform (in MQL).
What you want is called Market Scanner. He will search for signals according to your rules, according to all symbols and timeframes you have chosen.

There are no constructors to implement your idea. Costructors can only be properly configured if this is a very simple standard strategy. You just need to make a request to companies that are engaged in the professional development of automatic trading systems.
To solve a similar problem, for example, I ordered on this site: https://www.nordman-algorithms.com/metatrader-programming
There are about 5-6 companies on the market that professionally provide Expert Advisor development services and can really realize what you want.
They have a different level of service, support, cost and quality. You can send free inquiries and consult with them, already during the conversation decide who suits you best.


----------

