how do I create an automated system for automated trading?

Discussion in 'Automated Trading' started by blue717, Aug 2, 2009.

  1. blue717


    I need some help in creating an automated system for automated trading. I have a couple trading ideas I've backtested and have been testing for the past few weeks which work and would make money if executed and closed out according to my strategy.

    The problems I have are:

    1) I second guess my system and dont initiate a position.
    2) I close out a trade too fast for a small gain
    3) If a trade goes against me,according to my strategy it should be closed, but I tend to hold on or average down
    4) Sometimes I have other obligations during market hours and I need trades executed when Im not there

    Therefore Im looking to build an automated system and have it trade for me, basically removing all emotion, thinking, and second guessing from my trading.

    My strategy is simple. Basically something like:

    if X happens buy/sell and hold till a certain price is reached or if the trade goes against me to get out at a certain price.

    So where do I start in building an automated system for automated trading?

    Would appeciate any links, advice, help, ideas etc....

    Lets keep this thread on topic and if you dont have anything constructive to offer stay off the thread.

  2. pengw


    I have done that with IB TWS API, using Java program.

    If you know Java, let me know, the program will have a template method for you to fill in.

    I tested it with latest TWS.

    Respons to this board if anyone interested,
  3. ddefina


    NinjaTrader is free to program and test, and $60 per month to use in live trading. Very easy to do what you describe with their wizard. Its also awesome to trade with as well, setting up brackets or trailing stops automatically for you.

  4. I use TradeStation to trade, though I don't use their automated trading feature. What you said seems to be simple enough. You can write some TradeStation scripts to autotrade and backtest using your script to enter and exit (target, and stop). Your entry/exit criteria can be stock reaching certain price, an indicator reaching certain value, or 2 indicator crossing (e.g. 10MA crossing 50MA), something like that.
  5. It's a long road to success, but it can be done. I recommend starting kind of slow. There are lots of cheap backtester programs with data. You can try eSignal or Telechart for example. Amibroker is good, but I think you need a data service. Or you can simply use some of the free charting a data sites on the web to look at back trades manually.

    Here are some ideas I use:

    1. You NEED a good cheap broker. For me the choices are IB or IB.

    2. You NEED to track and log EVERY TRADE. Excel works fine for me. These trades should be analyzed for hit rate, profit factor, etc.

    3. It's very helpful to have a backtest and analysis program and data. I think eSignal "On Demand" is a great service for the price. But it is delayed so with IB you might need a decent chart program, if you need more than the basic signals. QuoteTracker is good, but it might not be free for long.

    4. I have found swing trading from one to about 7 days works for me. Try this: develop entry alerts and manually send them (very small size at first! - try 100 shares of less than $50 stock) using Limit or Stop orders ONLY (depending on your method - reversion or breakout). Stay away from Market.

    5. If triggered, the next day put in Limit or Stop orders to take profits where your system indicates. Close trades after your time limits if your profit targets are not hit. You might try stop loss targets too, but for me they don't work. I just close after a time limit.

    Do this for a few months so you can test in real time over different market conditions. Track every trade and see if the performance is what you expect. Avoid dicking with your trades. Put in the orders and DON'T SCREW WITH THEM UNTIL IT IS TIME TO EXIT.

    If this sort of manual method works, you are almost there. The next step would be to slowly automate parts until it is taken as far as you want. No need to rush. Just take your time to get it right. Coming up with a decent method that works in most markets is the hardest part. If you are not very comfortable with it, IOW you have traded and tested the hell out of it, then you will always second-guess trades. Automating is easy compared to this.

    Good luck! :cool:
  6. Do you have any programming experience?

    It sounds like all you really need is limit / stop bracket order. Most brokers have this feature I think. I know IB does.
  7. I have been programming one of the setups I used the last weeks with not so much success into a NinjaTrader fully automated system. Problem is that I was too slow, second guessing things - now Ninja (which i don't like particularly, but it gets the job done) executes the setup perfectly, unless I block the robot (which I do, fo example, around news releases, when the market is simply not right for it - still trying to find a way to program that condition).

    So far it works like a charm. During forward testing I got tremendous good days, combined with some bad ones - but overall heavily green (5 to 15 signals a day in the YM - mostly around 7-10).

    The good thing is the robot never gets tired and always watches the market perfectly. No emotion. No - this is a reversal breakout - runaway deakls, the order is in in less than a 5th of a second (I am in europe, so the travel time over the internet accounts for about 1/10th of a second). Stops go in fully automatic, and if I am lucky and get a runner it is funny to see the trailing stop being adjusted in basically every tick ;)

    It can be done. Sound progrmaming knolwedge required for more than the most simple things. In case of Ninja, the internal order handling was just too primitive, so I had to program my own trade manager around to have a better grip on where I stand from within the strategy. Esepcially as it is moving into quite a lot of signals that partially have the ability to reenter a position in a trade.

    Now it trades real funds (for 3 days, up quite ok) and we will see what happens this month. TOday I start taking full statistics in excel, because I want to know exactly how the different signals influence the profit projection ;)