My idea on automated, algorithmic trading --- Is this feasible or am I missing someth

Discussion in 'Automated Trading' started by Newmoney24, Jun 22, 2014.

  1. I'll try to keep this post as short and concise as I can.
    Firstly I will say I had this idea about 2 years ago, I have refined it since, and as far as I can tell it should work, but I want to get your feedback(especially if you have experience in this realm of trading).



    The basis of my idea is for an automated program to follow trendlines (based on support and resistance lines).
    See Exhibit 1 (http://imgur.com/UPhfb9z). The program in action would buy at a point like (4) and sell at a point like (9) (after the trendline has been broken). The concept is simple- follow the trend, and only buy at very opportune times (when the price of the asset being traded is very close to the trendline. And further, if the trendline is broken, the exit point is very close by so loss is highly mitigated.

    There are a lot of variables in this, some for example are--
    -When buying: How close to the trendline a purchase takes place (I was thinking within 1% of the total height of the trendline, though it could be 0.5%, even .1% or less)
    -When selling: How far below the trendline would the price have to be to trigger a sale (this could be 1% below the trendline, or really any variable from 2% as far down as .1%(or less)
    -How many points there are on the trendline supporting it (This is a variable which could be anything from 3 to 10 or more, again the more picky you are, the less opportunities the program would have to execute trades).
    -Other variables, such as closing a position automatically if it goes to a certain height above the trendline (a breakout) (ie: 100% higher than the height of the trendline), thus locking in profits.
    -Even more variables such as only allowing "long" trades or "short trades" (ie: in aggressive upward markets it might not be wise to allow even an automated program to go short (then again it could be profitable too, this is just another variable).

    This is the basic concept of the program.
    ---------


    Now here is the stuffing:

    The program would automatically go through EVERY liquid asset (stocks, forex, bitcoin and digital currencies, etc, the number of assets to chose from are in the thousands), it would identify active patterns based on the variable specifications discussed above. The more stringent the variable specifications the less matches it would have (ie: if we specified we needed 3 supporting points on the trendline, it would find far more active patterns then if we specified we needed 6 supporting points).

    The program would then select the trends which provide the greatest return within the variable specification which you have selected. (See Example below of identifying the highest ROI trends)
    Next, it would backtest the variable combination through the recent past to determine if the strategy would have been successful in the recent past (It could backtest across the whole market, or just for the asset -- this is another variable). If the backtest is favorable, it would take the position.

    Once the pattern is broken, the program closes the position and the next best trend is selected and the whole process repeats. It continues doing this indefinitely.
    It it important to note that the program would be switching the asset it is invested in on a frequent basis (each trade could aim to hold for a few hours- but it could also aim to hold for only seconds (or nanoseconds)(especially if there are no trading fees on the exchange).




    **Example of identifying the highest ROI trends**

    See Exhibit 1 and 2.
    Exhibit 1: http://imgur.com/UPhfb9z
    Exhibit 2: http://imgur.com/m02wUfA



    First, to calculate the theoretical annual ROI, you take the rate of growth of the trendline and pan it out over a year. Of course its important to note that none of these trends would continue for a year, but it doesn't matter because once a trend for a certain trade is broken, the program automatically switches to the next best active trend pattern.

    *Comparing exhibit 1 and 2*
    The first trendline would provide a theoretical annual ROI of 29,200%
    ((Calculation: 10% x 8 x 365) = 29,200%)

    The second exhibit would provide a theoretical annual ROI of 1% return per minute which would have a theoritical annual ROI 525,600%
    ((Calculation: 1% x 60 x 24 x 365) = 525,600%)

    In this example, the trade in exhibit 2 would offer a significantly greater return, though as you can see the time frame is much shorter- and this is important because of things like trading commissions, and the effect of taking/closing a position would have on the market price. Thus exhibit 1 might be a more practical trade especially if working with a sizable amount of capital (millions of USD), and on a centralized stock exchange with fees(ie: Nasdaq, NYSE, etc).


    It's also important to note that there may not often be a pattern offering such sizable returns, but there virtually always is a good variety of trades offering theoretical annual yields of 1000%+ and which have trendlines of at least a few hours long (thus allowing larger positions to be taken).




    Loss Mitigation:

    One benefit of this strategy is the law of large numbers. Because there are so many trades taking place, losses are largely mitigated on any trade. Say a purchase is made only within 1% of the trendline, and sold if it falls 1% below the trendline. The total potential for loss then is 2% of the trendline value (which means a maximum loss of 2% of your trading capital on any trade, but in reality it would often be a small fraction of that -- about 1/10 or that per trade for trends that are days long or much less if shorter trends are picked (such as trends that are only hours or minutes long)




    Some limiting considerations are:

    The amount of capital one is working with- obviously the more money you are working with, the less you would make. Why? Because getting into a position and getting out will push the market up or down respectively- and the shorter the time frame, the greater the effect. Thus if one is working with a significant amount of money (~$100M+), they would have to accept that they could not take as many trades (only trades over longer time frames where their own action buying and selling wouldn't have a significant impact on the market price)-- so with less opportunties, their ROI wouldn't be as high(though I still could easily see an entity even with $1B to trade taking trades which give a 1000% theoretical annual ROI)

    Additionally, the design I have created is computing resource intensive, but the amount of resources used could be reduced in many ways-
    ie:
    -Only picking trends that have been running for a few hours, or a few days (as opposed to trends which are minutes or seconds long) -- this would massively reduce the number of calculations needed to be made- the downside is less trade opportunties would be identified and thus a lower ROI (but it still should be a very sizable ROI, much higher than traditional investing and holding).
    -Also having the program do less backtesting, but I really wouldn't want to skimp here.






    In conclusion, I would really like to hear from people currently working in the automated trading / algorithmic trading world. I'm certain you guys are doing something similar to this, perhaps even with evolutionary algorithms. I would love to hear and connect with you so don't hesitate to contact me.
     
  2. Can you really write a program that can correctly plot trend lines? You might want to Google 'automatic trend lines' and take a look at the images. If anyone has done it, it doesn't seem to have been posted. Pretty much hit and miss.
     
  3. Hope you can write a better program than this guy!
     
  4. real market data doesn't fit nicely into a straight line, it breaks the line and gets back on top, and then looks choppy for a while before picking up the trend again... the signal is buried in a lot of noise... and you have to sort through that noise... you need to clearly identify the signal (in this case your trend line) programatically (not so easy since the computer has 0 intuition... you have to explain your plan to a piece of silicon! so it has to be 100% logical)

    once you have that, you can test your idea and start thinking about money management... before you have that, then there is no way to know if it is any good or not... and there's not much of a point discussing risk reward or any of that... without data, there's nothing to measure.

    there are too many open questions... like how many false positives does it give, or how often it misses a true positive... (both for the buy and the sell signal...)
    When things go wrong, how bad do they go wrong (drawdown), when things go right, how often do you get stopped out too early?
    etc...

    step 1. plot your lines on some real data by hand (get rid of the drawings)
    step 2. figure out how to explain to a piece of silicon where to plot those lines and where not.
    step 3. explain it to the computer, and have it draw some charts for you (again, on real data plz...)
    step 4. measure the strength of the signal...
    step 5. repeat steps 1-4 until you get it to work, or decide to try a different idea.
     
  5. pftq

    pftq

  6. Bob111

    Bob111

    The question is-is it profitable? (Besides the fact that drawing trend lines is very subjective)
     
  7. pftq

    pftq

    Yes. Not alone but in conjunction with other criteria. Else there's no point bringing this up.
     
  8. Not at all.

    You could define a trendline with simple pivot points, a pivot high being a candle preceded and followed by at least 3 candles with a higher low, for example, and vice versa for a downtrend.

    Once the trendline is clearly defined in computer terms, you can backtest all kinds of chart formations (trendlines, support and resistance lines, triangles, channels, etc...)
     
  9. aysos75

    aysos75

    To draw a line support by program between time t1 and t2 must:

    1) find the lowest m1 = (xm, ym)
    2) iterate over the following awards and verify that each p (x, y)> m1.
    3) if yes continue until t2
    4) if not change the line support
     
  10. Bob111

    Bob111

    ok,that's easy. anybody can do that...draw a line between two highs or lows peaks. specially when they are at same level. but what about projecting the line further or to define specific points on the chart relative to those lines? as on OP's pictures or one below
     
    #10     Aug 10, 2014