Automated execution

Discussion in 'Automated Trading' started by RogerwOwens, Jan 29, 2008.

  1. I believe that an automated system can be successful because it takes the emotion out of the equation. Traders tend to get greedy or panic and fail to follow their trading strategy. Automated systems can also react much faster than people.

    I wrote an automated trading system that works with TDAmeritrade, so it can't do futures or forex, but it works with stocks.

    This system is written in C# and uses something called TradeScript from Modulus Financial Engineering. It streams ticker data from TDAmeritrade. It places the buy order and monitors the ticker data to manage the sell order by tightening stops and/or selling at a specific profit margin. It also monitors the TICK and the TRIN and the major indices and can be set to suspend trading when any of these hits their tolerance levels.

    It works pretty well with one problem...I need a winning trading system to put into it. The best of the strategies I have tried so far will make money in the long run, but not a lot of it. Part of this is due to the modest size of my account. Commissions end up eating away all of my profits.

    I have a backtesting module built in. I am interested in finding some good intraday trading strategies to backtest.

    c?c
     
    #11     Feb 1, 2008
  2. Jerry030

    Jerry030

    C7C,

    I assume what you mean by trading strategy is a defined rule set:

    A made up example:

    IF Close of bar > average of prior 3 close
    AND
    derivative of RSI < .33
    AND
    Japanese Candlestick - Shooting Star
    AND…..
    ……..
    ...........

    For years I tried this kind of thing but found it wanting in terms of long term consistency. One can find periods where the market responds to various combinations of indicators. Usually by the time one finds such a thing and implements it, the market evolves so that it soon stops working as well. In part perhaps because thousands of others have found the same patterns.

    My thinking on why this happens is that the market is a extremely
    complex system. Far too complex for very simple mathematical functions like traditional technical indicators to capture consistent functional dynamics. Most popular technical indicators were invented decades ago and deigned to be computed with a hand calculator.

    My approach and suggestion to you is to look into creating a predictive model to replace the typical rule based approach. There are many ways to do this including: neural networks, decision trees, GA, SOM, and RBM. Then incorporate the model into your system in place of the rule set.

    Jerry
     
    #12     Feb 1, 2008
  3. rwk

    rwk

    Jerry, I think you are at least partially right. I have been saying for a long time now that if we do the same things everybody else does, we will get about the same results. Where I disagree is that simple, rule-based concepts can work. I have been making a living at it for over four years now. Predictive modelling may work too, but it's too complicated for my simple mind.

    I suppose it is damned annoying to hear that. That's the way I felt until I found something that actually works. I'm not intentionally taunting anyone, but knowing that it can be done is useful information.
     
    #13     Feb 1, 2008
  4. Jerry,

    When you talk about neural networks and such, are you suggesting a way to bridge the gap between technical analysis and fundamental analysis?

    Our plans aren't on such a grand scale. Your first example, of a script, is what we are looking for.

    We have experienced what you are talking about. The scripts seem to work great for a few months and then they stop working so well. I still have to think that there is something to technical analysis. Candlestick patterns were developed centuries ago.

    We wrote this application as a sidebar to our main business. We wanted to be able to trade with the company's funds and generate some income. The problem is that we are software developers, not traders.

    We think that this application has a great deal of potential. If somebody comes up with an intraday strategy/script that allows our application to make money. We'd be willing to cut them in on the action. This isn't limited to a single strategy, it can run several different strategies on several different stocks at the same time.

    c?c
     
    #14     Feb 1, 2008
  5. crisis,

    What about switching to a different broker like IB? If commissions are killing your profits you can make round trip trades for dollars instead of $20 round trip on TDAmer.

    Btw did you use their API to communicate with TDAmer and was it a hassle to get it from them or did you just have to email them?

    --S
     
    #15     Feb 1, 2008
  6. Skellington,

    It wasn't a hassle getting the API. We told them it was for a company. I don't know if they would have given it so freely to an individual.

    They were still working on the API and we were able to help them debug it. They were very helpful and responsive. At one point, they even gave us access to a test account with real money and live trades.

    TDA is currently giving us $7 trades, so $14 round trip. Since our application is tied to their API, it would take a complete rewrite to switch to another broker and another API.

    crisis
     
    #16     Feb 1, 2008
  7. Craig66

    Craig66

    "1 GB of executable code", I've worked on big distributed telecoms projects in C++ where the collective code size got nowhere near that, 1 GB is like operating system size.
     
    #17     Feb 1, 2008
  8. Jerry030

    Jerry030

    C?C,



    Jerry,

    When you talk about neural networks and such, are you suggesting a way to bridge the gap between technical analysis and fundamental analysis?

    ***
    Not exactly. I personally ignore all fundamentals and instead believe that all necessary information is contained in price alone.

    The problem as I see it is that there are many fundamental bits of data other there, but what do they mean? Fed cuts interest rates, the market goes up, next month they do the same and the market does nothing. Why??? ....errr, well the job numbers were bad or the market had already discounted the event. It's an endless series of, well it really meant x, y or z this time.

    ***

    Our plans aren't on such a grand scale. Your first example, of a script, is what we are looking for.

    ***
    There I can't help as I gave that approach up long ago.

    However if your application can call an external application, I can convert a model to C++, Java, VB or other callable forms. What would be returned to your application would be the same as the results of executing a rule script. That is: Market, Buy or Sell, Order type (MOC, FOK, GTC), Stop Exit Price, Profit Target Exit Price, etc.
    ****

    We have experienced what you are talking about. The scripts seem to work great for a few months and then they stop working so well. I still have to think that there is something to technical analysis. Candlestick patterns were developed centuries ago.

    ***
    True and at the time with the limitations of rice paper and a goose quill pen they were perhaps cutting edge technology. Times have progressed. 20 years ago plotting a price chart on a computer screen and they plotting a moving average and an RSI on top of it was cutting edge. These days there methods like Synthetic Charting where an application extracts components characteristics of price variation and uses multi-dimensional matrix processing to “chart” price in 10 or even 20 dimensions. This can’t be visualized in 2D space but the application that created it can trade it.

    ***

    We wrote this application as a sidebar to our main business. We wanted to be able to trade with the company's funds and generate some income. The problem is that we are software developers, not traders.

    We think that this application has a great deal of potential. If somebody comes up with an intraday strategy/script that allows our application to make money. We'd be willing to cut them in on the action. This isn't limited to a single strategy, it can run several different strategies on several different stocks at the same time.

    ***
    Contact me either publically or privately with information on the specifics of what you trade and the time window you want to work in and I'll see if I think a model makes sense.

    I'm willing to explore and research what could be done without cost or obligations. Once I have something that generates what you need in real time paper trading we can discuss what its value might be if incorporated into your application.

    Jerry
     
    #18     Feb 1, 2008
  9. Jerry030

    Jerry030

    RWK,

    Jerry, I think you are at least partially right. I have been saying for a long time now that if we do the same things everybody else does, we will get about the same results. Where I disagree is that simple, rule-based concepts can work. I have been making a living at it for over four years now. Predictive modeling may work too, but it's too complicated for my simple mind.

    **
    I don’t doubt that it’s possible but it often involves a complex combination
    of knowledge, skill, experience and intuition. That’s hard for most folks.

    Yes, development effort is huge and one really needs an advanced degree in Computer Science to do it right.

    However the advantage is that the black box can trade hundreds or thousands of markets at the same time. Systems with a human component, say getting a signal from the rule based signal generator and then confirming it or deciding how to play it are limited to human bandwidth. Following more than perhaps 50 markets at a time can be a challenge.


    Jerry
    **

    I suppose it is damned annoying to hear that. That's the way I felt until I found something that actually works. I'm not intentionally taunting anyone, but knowing that it can be done is useful information.
     
    #19     Feb 1, 2008
  10. Jerry,

    Our application can call external applications. In fact, that is how it is working right now. We are using TradeScript from Modulus. Basically, we feed it bar data (open, high,low,close,volume) and it evaluates a script and will fire an alert event if a buy is warranted on that bar.

    We are looking at intraday timeframes since we feel that is where the real value of an automated system lies. It can make split-second decisions on where to buy and sell.

    We have been experimenting with one-minute and five-minute bars to determine when to buy. Then we look at each tick to manage the sell. We can tighten stops, switch to trailing stops, etc. based on the rules set for that specific strategy.

    The Modulus 3rd-party controls have had some bugs in them. We could easily modify out application to call your control and pass it tick data or bar data.

    After backtesting, we would initially test it live with trades of no more than $20K, so it would be good if the average gain on the $20K trade was more than the $14 round-trip commission.

    Would your black box signal both when to buy and when to sell? Right now, we are using Tradescript only to signal when to buy. Then we look for a profit margin and/or put in a trialing stop.

    Since this is using the TDAmeritrade API, we can only trade stocks and ETFs.

    Right now, we are looking strictly at long positions. Once we get something that makes some money, we can look at implementing short trades.

    crisis
     
    #20     Feb 1, 2008