Trading Predicting stock direction

Discussion in 'Share Investing Strategies, Theories & Education' started by devank, 29th Jun, 2017.

Join Australia's most dynamic and respected property investment community
  1. devank

    devank Well-Known Member

    Joined:
    18th Jun, 2015
    Posts:
    1,669
    Location:
    Inner West - Sydney
    Once a upon a time (SS) , I think it was MIW shared a presentation from an ASX guy called ‘Dale Gillham’ about how to pick (or drop) a stock.

    This is my memory of that summary.
    Step 1: Look at the price movements. Not daily but weekly or a bit longer.
    Step 2: Take a ruler and connect consecutive three (or two) peaks
    Conclusion: Stock would shoot up if after consecutive three increasing peaks. Similarly, after consecutive three decreasing peaks the share price drops dramatically.

    As a data modeller, I wanted to test this theory for a long time. I never had enough time & drive to implement this in an automated fashion.

    Now I have developed a R based system where it
    1. Picks up 193 ASX codes (192 from ASX200 and BKI)
    2. Loads historical prices (29 June 2009 to 25 June 2017)
    3. Selects only Friday closing prices
    3. Identifies peaks.
    4. Calculates the change in peaks = if it is an increasing peak or degreasing peak compared to the last peak
    5. Calculates last five lagged peak changes
    6. Develops separate models for each stock where last direction of the peak as a function of previous peak changes.
    Y = direction0 (last peak direction = positive or negative)
    Xs = change1, change2, change3,change4
    Eg: change1 = (PeakLag1-PeakLag2)/PeakLag1
    7. Shifts changes one step.
    eg: Previous change0 becomes new change1.
    8. Predicts the outcome based on the new inputs
    9. Assigns ‘Buy’ or ‘Sell’ if the probability is more than 90%.

    This is my outcome based on the model as of end of last week.

    code action
    BSL.AX Sell
    CGF.AX Buy
    CPU.AX Sell
    CTD.AX Buy
    IFL.AX Buy
    NAN.AX Buy
    TME.AX Buy


    I tried to back test the results using sharesight as @wombat777 suggested but I got lost.
    I’ll need to bring in other variables to improve the model.
    Does anyone have any suggestions to improve the process?
     
    Perthguy, apk and D.T. like this.
  2. Perthguy

    Perthguy Well-Known Member

    Joined:
    22nd Jun, 2015
    Posts:
    11,767
    Location:
    Perth
    It will be interesting to test over time how these recommendations stack up. What sort of timeframe are you looking at for testing the outcomes?
     
  3. devank

    devank Well-Known Member

    Joined:
    18th Jun, 2015
    Posts:
    1,669
    Location:
    Inner West - Sydney
    This is for trading. I want to know which one i need to buy which can make me money in a short time.
     
  4. Perthguy

    Perthguy Well-Known Member

    Joined:
    22nd Jun, 2015
    Posts:
    11,767
    Location:
    Perth
    Short time: a second, a minute, an hour, a day, a week?
     
  5. devank

    devank Well-Known Member

    Joined:
    18th Jun, 2015
    Posts:
    1,669
    Location:
    Inner West - Sydney
    I don't know that. Model outcome is either positive direction or negative direction.
    It is only saying about next peak.
    I guess we need to sell when either
    1. Model outcome becomes SELL or
    2. You get the itch
     
    Perthguy likes this.
  6. Phase2

    Phase2 Well-Known Member

    Joined:
    14th Jul, 2016
    Posts:
    1,289
    Location:
    Perth
    Buy a dartboard.. pin the stock-codes on each segment. Knock-yourself out. :D

    Sorry not very helpful, but trading is a numbers game that very few people do well. Tech analysis ignores the key fundamental driver of stock price movements.. human sentiment and the newsfeed that affects it!
     
  7. devank

    devank Well-Known Member

    Joined:
    18th Jun, 2015
    Posts:
    1,669
    Location:
    Inner West - Sydney
    Yes. Fully aware of it.
    This not for long term investment.
    I assume "human sentiment and the newsfeed" are reflected in the price.
    Infact, I think, this Dale's method is trying to pick the human sentiment behavior.
     
  8. Phase2

    Phase2 Well-Known Member

    Joined:
    14th Jul, 2016
    Posts:
    1,289
    Location:
    Perth
    I think that's a flawed assumption. Unless you control the global newsfeed... :eek: Is your name Elliot Carver by any chance?? ;)
     
  9. Perthguy

    Perthguy Well-Known Member

    Joined:
    22nd Jun, 2015
    Posts:
    11,767
    Location:
    Perth
    Ok, makes sense. It does make it tricky to test though.
     
    devank likes this.
  10. jins13

    jins13 Well-Known Member

    Joined:
    19th Jun, 2015
    Posts:
    2,357
    Location:
    Sydney
    Maybe it's me, but experiencing some good growth in my current share portfolio
     
  11. Zenith Chaos

    Zenith Chaos Well-Known Member

    Joined:
    10th Jul, 2015
    Posts:
    1,673
    Location:
    Sydney
    Whilst reading I thought you were using it for backtesting the thesis. Then it appears you are using it to make predictions when you don't really remember the original thesis.

    I'd use it first to backtest the data on every piece of stock data you can get your hand on. I'm pretty sure it wouldn't work every time, but it might work in a statistically significant sense.

    Ideally, you could build a model that predicts a thesis based on the data; that is, determine the criteria most likely present in the time before a crash / spike. You would then verify that on a test dataset.

    I'm fairly certain it would have been done before with all the algorithmic trading going on nowadays. The problem is the algos probably have such a big influence on the market that they reduce or eliminate arbitrage opportunities.
     
    Perthguy likes this.
  12. wombat777

    wombat777 Well-Known Member

    Joined:
    18th Jun, 2015
    Posts:
    3,565
    Location:
    On a Capital and Income Growth Safari
    Build a time machine.

    Sorry. I don't trade - I invest and focus on fundamentals. I don't have the time or interest for trading.

    I have some speculative investments but for these I focus on fundamentals. The ones I hold are ones that I want to own because I think their business model, strategy and management team is sound.

    The backtesting I do in sharesight is to look at how individual stocks or ETFs / LICs have performed overtime with respect to the ASX, each other and other indices. e.g. Looking at how they recover following dips / crashes. This is to understand trends. Sharesight also allows you to get some perspective on consistency in how income is distributed.
     
    Redwing likes this.
  13. devank

    devank Well-Known Member

    Joined:
    18th Jun, 2015
    Posts:
    1,669
    Location:
    Inner West - Sydney
    I have created a fake portfolio with last Monday open prices. Placed roughly 20K on each.
    upload_2017-6-29_19-33-42.png

    By now, it would have been 1.65% gain (excluding trading costs). Generally, most stocks are doing well this week though.
     
    Perthguy likes this.
  14. devank

    devank Well-Known Member

    Joined:
    18th Jun, 2015
    Posts:
    1,669
    Location:
    Inner West - Sydney
    What you are talking about is in-sample validation. I prefer to do a out of sample validation. That's why predicting the totally unknown future. It is a success even if it is marginally profitable as this is my first stab at this.
     
  15. Zenith Chaos

    Zenith Chaos Well-Known Member

    Joined:
    10th Jul, 2015
    Posts:
    1,673
    Location:
    Sydney
    You can validate with known data to speed up the process and then use the model to predict the unknown. You can train, validate and test using existing data without waiting for validation data to become available. The problem is that the past doesn't always guide the future.

    For example most of the fundamentals of investing in index ETFs is based on the assumption that the entire market will always move up over extended periods of time. However, the market could go backwards / stagnate for 20 years. We don't know. It has never happened before. But it is possible.
     
    wombat777 likes this.
  16. abbyfresh

    abbyfresh Well-Known Member

    Joined:
    2nd Jul, 2015
    Posts:
    433
    Location:
    VIC
    Your modelling seems to be overly complicated to get the buy / sell result. A couple errors along the way could throw the final signal the other way.

    I would have thought for example a 9 day / 21 day moving average as a basis are more simplified along with similar modelling is more the way to go.

    Agreed short term movements seems to be more mathematical than fundamental.

    With that said I think such a strategy needs to be combined with fundamental analysis as that can substantiate your buy signal and allow you to join more dots / create more risk mechanisms on a on sell / exit plan.

    Meaning if your current technical analysis is suggesting you buy, what does the fundamentals say on this buy value, what value should it be fundamentally and how long should it take to get there based on where the fundamental value should be.

    If the maths says buy, but the fundamentals says it is still way over valued then it is a much riskier proposition particularly for medium or longer term holding.

    Just some thoughts.
     
    Perthguy and devank like this.
  17. Skilled_Migrant

    Skilled_Migrant Well-Known Member

    Joined:
    21st Jun, 2015
    Posts:
    796
    Location:
    Melbourne
    The above two parameters are conflicting. A friday closing price will most likely not capture the peak as the highest price during week (or for that matter any other time frame) will invariably not be the closing price. Exceptions are rare and candlestick charts have special names for these exceptions.

    Highest price from OHLC data would be the right parameter for identifying peaks, especially as the whole theory revolves around peaks.

    You might be reinventing the wheel here. Some premium charting software / newsletters might already have a selection criteria based on 'Dale Gillham' which will save you a lot of time and effort in starting from scratch
     
  18. devank

    devank Well-Known Member

    Joined:
    18th Jun, 2015
    Posts:
    1,669
    Location:
    Inner West - Sydney
    The aim isn't to pick every small fluctuation. It should have been the average over a period. Possible even a monthly average. I used the Friday closing price as a proxy for the weekly average. This is to get the logic working and see if there it is worth spending time.
     
  19. devank

    devank Well-Known Member

    Joined:
    18th Jun, 2015
    Posts:
    1,669
    Location:
    Inner West - Sydney
    Thanks for the thoughtful reply @abbyfresh.

    Data prep was complicated but the modelling was very simple. Eventually, it will get more complicated as I start using other factors.

    Yes. He did use averages. Each stock gets it's own model. The number of data points gets reduced as I use averages of longer periods. For example, we will have only 12 data points within a year if I use the monthly average. The number of peaks within that is even less. I don't want to go too close the GFC either.

    Finally, someone thinks like me :)

    Every night my PC extracts following stats for all ASX200 stocks.
    Code
    Market Capitalisation
    Float Shares
    Book Value
    Ask
    Bid
    Last trade Price
    Last trade Size
    Open
    Day's High
    Day's Low
    Day's Range
    Volume
    Average Daily Volume
    Previous Close
    52-week Range
    52-week High
    52-week Low
    Earnings/Share
    EBITDA
    P/E Ratio
    PEG Ratio
    Ex-Dividend Date
    Dividend Yield
    50-day Moving Average
    200-day Moving Average

    At this stage, I don't know how to calculate any meaningful fundamental index. once I have enough records, I would be able to come up with a model based on this daily data as well.

    Yes. If we get it wrong in short-term then we still should be happy to hold it for longer term.
     
    Last edited: 30th Jun, 2017
    Perthguy likes this.
  20. House

    House Well-Known Member

    Joined:
    13th Sep, 2015
    Posts:
    929
    Location:
    Sydney
    How's the portfolio coming along?

    Picked up Dale's book and seems almost too simple... follow trend lines on a monthly basis and only pick those that pass the line, sell when they fall below.

    Or if that's too much effort, pick only ten uptrending stocks from the Top 20 on the ASX and buy and hold. Apparently he averaged an annual return of 25% doing this from 1997-2003. Though why he's using examples from that time in a book reprinted in 2014 is a bit inane.