• Australian (ASX) Stock Market Forum

Hello and welcome to Aussie Stock Forums!

To gain full access you must register. Registration is free and takes only a few seconds to complete.

Already a member? Log in here.

Algorithmic trading system

Discussion in 'Trading Strategies/Systems' started by Punta, Oct 27, 2011.

  1. Punta

    Punta

    Posts:
    158
    Likes Received:
    0
    Joined:
    Oct 27, 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!
     
  2. Gringotts Bank

    Gringotts Bank

    Posts:
    6,175
    Likes Received:
    600
    Joined:
    Jun 30, 2007
    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! :eek: Or you can rent a system and have a broker execute it for you.
     
  3. RazzaDazzla

    RazzaDazzla

    Posts:
    375
    Likes Received:
    0
    Joined:
    Jul 25, 2008
    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.
     
  4. Punta

    Punta

    Posts:
    158
    Likes Received:
    0
    Joined:
    Oct 27, 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:banghead:
     
  5. Gringotts Bank

    Gringotts Bank

    Posts:
    6,175
    Likes Received:
    600
    Joined:
    Jun 30, 2007
    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. :confused:

    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.
     
  6. RazzaDazzla

    RazzaDazzla

    Posts:
    375
    Likes Received:
    0
    Joined:
    Jul 25, 2008
    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.
     
  7. Gringotts Bank

    Gringotts Bank

    Posts:
    6,175
    Likes Received:
    600
    Joined:
    Jun 30, 2007
    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!
     
  8. ishakeel

    ishakeel

    Posts:
    20
    Likes Received:
    0
    Joined:
    Sep 12, 2009
  9. howardbandy

    howardbandy

    Posts:
    838
    Likes Received:
    93
    Joined:
    Jun 13, 2007
    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
     
  10. CanOz

    CanOz Home runs feel good, but base hits pay bills!

    Posts:
    11,529
    Likes Received:
    484
    Joined:
    Jul 11, 2006
    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
     
  11. Punta

    Punta

    Posts:
    158
    Likes Received:
    0
    Joined:
    Oct 27, 2011
    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.
     
  12. qldfrog

    qldfrog

    Posts:
    3,426
    Likes Received:
    1,783
    Joined:
    Jun 8, 2008
  13. Bernfeld

    Bernfeld

    Posts:
    9
    Likes Received:
    7
    Joined:
    Dec 4, 2019
    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.
     
Loading...

Share This Page