• 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.

How to trade the Unholy Grails system?

Discussion in 'Trading Strategies/Systems' started by Elfanger, Mar 18, 2013.

  1. Roller_1

    Roller_1

    Posts:
    313
    Likes Received:
    87
    Joined:
    Sep 13, 2013
    where's the code?

    This is my results on my code 2016-now
    clearly a single run but you get a idea
    bbo.PNG
     
  2. Wysiwyg

    Wysiwyg Everyone wants money

    Posts:
    8,424
    Likes Received:
    261
    Joined:
    Aug 8, 2006
    Code:
    Capital = Param("Start Capital", 100000, 10000, 100000, 2000);
    SetOption("InitialEquity", Capital);
     
    ATRPeriod = Param("ATR Period (Risk)", 45, 5, 50, 1);
    ATRMultiple = Param("ATR Multiple (Risk)", 2.5, 1, 10, 0.5);
    ATRAmount = ATRMultiple * MA(ATR(1), ATRPeriod);
    
    Risk1 = Param("Dollar Risk", 1400, 100, 20000, 100);
    PS = (Risk1/ATRAmount )* BuyPrice;
    PSLimit = Param("Position Size Limit", 10000, 1000, 100000, 500);
    
    PositionSize = IIf(PS < PSLimit, PS, PSLimit);
    
    IndexClose  = Foreign("XAO", "C");
    IndexMA = MA(IndexClose, 75);
    GoLong = IndexClose > IndexMA;
    PositionScore = Correlation(IndexClose, C, 20);
    
    SetTradeDelays(1,1,1,1);
    
    Turnover = MA(C * V, 5) > 1000000;
    
    ///// BBO \\\\\
    
    MA100 = MA(C, 100);
    MAStDev = StDev(C, 100);
    
    UpperBand = MA100 + 3 * MAStDev;
    LowerBand = MA100 - 1 * MAStDev;
    
    Buy =  C > Ref(UpperBand, -1) & GoLong & Turnover;  //Cross(C, UpperBand)
    Sell = C < Ref(LowerBand, -1); //Cross(LowerBand, C)
     
  3. Roller_1

    Roller_1

    Posts:
    313
    Likes Received:
    87
    Joined:
    Sep 13, 2013
    Why are you using the ATR/Dollar risk as position sizing? doesn't the book say 20 positions at 5% of capital?

    PositionScore =mtRandom();

    Why are you using correlation to the index?
     
    rb250660 likes this.
  4. Wysiwyg

    Wysiwyg Everyone wants money

    Posts:
    8,424
    Likes Received:
    261
    Joined:
    Aug 8, 2006
    Thanks. Found the core criteria for all strategies in the book. Don't have Dividend data for the periods held. Couldn't find any reference to PositionScore???

    Code:
    SetOption("InitialEquity", 100000);
    SetOption("CommissionAmount", 29.95);
    PositionSize = -100/20;
    
    IndexClose  = Foreign("XAO", "C");
    IndexMA = MA(IndexClose, 75);
    GoLong = IndexClose > IndexMA;
    PositionScore = mtRandom();
    
    SetTradeDelays(1,1,0,0);
    
    TurnoverLiquidity = MA(C * V, 7) > 500000 & MA(V, 7) > 500000 ;
    
    ///// BBO \\\\\
    
    MA100 = MA(C, 100);
    MAStDev = StDev(C, 100);
    
    UpperBand = MA100 + 3 * MAStDev;
    LowerBand = MA100 - 1 * MAStDev;
    
    Buy =  C > Ref(UpperBand, -1) & GoLong & TurnoverLiquidity;
    Sell = C < Ref(LowerBand, -1); 
     
  5. Roller_1

    Roller_1

    Posts:
    313
    Likes Received:
    87
    Joined:
    Sep 13, 2013
    It just randomly selects a position if there are more buy signals than positions available, in theory its probably better to have a ranking system system such as ROC(c,30), but that's not is the book.

    Why not use the bollingerband function bbandtop & bbandbot?
     
  6. Wysiwyg

    Wysiwyg Everyone wants money

    Posts:
    8,424
    Likes Received:
    261
    Joined:
    Aug 8, 2006
    You can ...

    UpperBand = BBandTop(C, 100, 3);
    LowerBand = BBandBot(C, 100,
    1);
     
  7. Roller_1

    Roller_1

    Posts:
    313
    Likes Received:
    87
    Joined:
    Sep 13, 2013
    i know you can but you didn't...
     
  8. rnr

    rnr

    Posts:
    531
    Likes Received:
    286
    Joined:
    Jul 1, 2007

    Almost there!
    I suggest that you remove the Index Filter (for now) and adjust the code so that once an initial BUY signal has been generated for a security there will be no further BUY signals until a SELL signal has been triggered.
    Now if you post a chart of RRL with the code attached showing BUY & SELL signals you will be able to confirm your code is correct by comparing any charts in the book that are relevant to the BBO system.

    Perhaps you could re-run your test from post #180 so that we can see how the system operates with the correct code.

    Thanks in advance Wysiwyg for being such a good sport.

    Cheers, Rob
     
    Roller_1 likes this.
  9. Wysiwyg

    Wysiwyg Everyone wants money

    Posts:
    8,424
    Likes Received:
    261
    Joined:
    Aug 8, 2006
    For rnr ...
    Test 1 (left) without exrem, Test 2 with exrem.
     

    Attached Files:

  10. rnr

    rnr

    Posts:
    531
    Likes Received:
    286
    Joined:
    Jul 1, 2007
    Thanks for that Wysiwyg as stats are interesting.

    Can't help but wonder what the stats would look like without the XAO index filter.
     
  11. Wysiwyg

    Wysiwyg Everyone wants money

    Posts:
    8,424
    Likes Received:
    261
    Joined:
    Aug 8, 2006
    Without the XAO 75 MA from same period, 01/01/2016 to present. Shows it is Index correlated with equity peaks in Aug 2016 and Jan 2017.

    Untitled.png
     
  12. Wysiwyg

    Wysiwyg Everyone wants money

    Posts:
    8,424
    Likes Received:
    261
    Joined:
    Aug 8, 2006
    Without XAO 75MA on the left and with XAO 75MA on the right.

    Untitled.png
     
    peter2 likes this.
  13. rnr

    rnr

    Posts:
    531
    Likes Received:
    286
    Joined:
    Jul 1, 2007
    Thanks again Wysiwyg for taking the time to post this info.
     
  14. Roller_1

    Roller_1

    Posts:
    313
    Likes Received:
    87
    Joined:
    Sep 13, 2013
    are you using 20 positions @ 5% of equity? Also are you only testing on current all ords or with historical constituents?
     
  15. Roller_1

    Roller_1

    Posts:
    313
    Likes Received:
    87
    Joined:
    Sep 13, 2013
    one problem with this system is it would be mentally hard to trade. a2m has a +200% open profit but look how far the stop is, basically 50% below current levels. But results show it's not too bad if you can ride the wave..
    a2m.PNG
     
    kid hustlr likes this.
  16. Newt

    Newt

    Posts:
    524
    Likes Received:
    820
    Joined:
    Oct 17, 2012
    Agree, and good points for potential new traders to watch. Its very easy to get excited about the equity curve, but these psychological issues make for major roller coaster morale issues as the market cycles between up and down periods. Those blips on the curve feel a lot more bumpy in real life.

    Also notable that without the filter, performance is better, but the gyrations are even more pronounced. That is, the psychology is even harder, and the risk of ruin becomes possibly higher (unless the greater volatility of returns is balanced by significantly greater (and reliable) returns).

    Radge systems often involve a switch to tighter stops when the filter cuts in, and/or limitations on buying. For those that feel they can cope with the psychological issues, it would also be beneficial to also review performance over the GFC historical data (2007 through to 2009) and see if you still prefer to leave out a filter. No right or wrong, just issues for each individual to deal with and decide before the market bounces around.
     
  17. tech/a

    tech/a No Ordinary Duck

    Posts:
    19,351
    Likes Received:
    3,499
    Joined:
    Oct 14, 2004
    It’s way worse than that.
    Being a displaced M/A the exit will turn down and move away from where it is now
    The slower it falls the worse it becomes.

    Having said that the point of a system ISNT maximising profit on a single trade but finding a repeatable sequence of events which results in a positive expectancy.
    So the system is as good as it was/is designed.
    Trades in isolation aren’t what systems trading is about.

    If you understand the above it’s no biggie phsycologically
    If you want to trade it differently on its own you can
     
    Last edited: Oct 14, 2017
    willoneau, peter2, rb250660 and 3 others like this.
  18. Joe90

    Joe90

    Posts:
    62
    Likes Received:
    73
    Joined:
    Dec 24, 2013
    InsvestoBoy likes this.
  19. InsvestoBoy

    InsvestoBoy

    Posts:
    623
    Likes Received:
    760
    Joined:
    Sep 6, 2016
    I recently had a chance to read Unholy Grails and was doing some searching on this forum to see commentary.

    @craft interesting about this comment on @tech/a's TechTrader system, at first I thought the same thing as you that the returns were not much better than simply buying the index on leverage but I actually think it is better than that.

    From the chart @tech/a posted, the dates are blurry so I couldn't be 100% sure about the exact start and end dates but I think it shows 90k starting capital on 23/08/2002 and 357k ending capital on 23/08/2009.

    For an apples to apples comparison versus a benchmark, we would need to assume an investor with $30k takes out a 3:1 margin loan and invests the $90k lump into the XJO, reinvests all the earnings and franking credits, etc on the start date and removes it on the end date. Thanks to @peter2's mention, there is an index the XNT which represents this exactly.

    You can see the data for that index here: https://au.investing.com/indices/s-p-asx-200-net-total-return-historical-data

    The index value on the start date is 15950.62 and the index value on the end date is 28785.52.

    So a benchmark investor would've received a total return of about 80% total over that time period. Maybe we can assume the benchmark investor reinvested dividends on 3:1 margin as well over time and the return would've been a bit better than that.

    But I think based on those numbers TechTrader actually still outperforms quite handily, because it compounds on leverage over time. i.e. once the account has generated another 30k in profits there is 60k of real money there and at 3:1 margin it can trade 180k worth of stocks. At the terminal date with $357k the account would be able to trade a bit over a mil of stocks!

    This isn't a fair comparison because you are trying to claim the best possible benchmark CAGR using the start and end date as 03-07 where TechTrader was trading 02-09, including making new highs in the system while the benchmark was near the lows of a big drawdown.

    I think this statement would be correct if it was simply trend following the index. But TechTrader was investing in smaller individual companies (one of the rules in the scan is max price <$10) with a lot more upside volatility than the index, coupled with compounding leverage and tight risk management to avoid downside volatility. So there is a bit more strength to it than what you say, especially if you analyse the equity curve chart that @tech/a posted closely you can see there are plenty of periods where it provides uncorrelated returns which are quite valuable even if only as a diversified stream of returns.

    I follow systematic trading quite a lot and can see some value there.

    Didn't he use the money to buy a building?

    I guess the question is were there any stocks <$10 doing well during the 2010-2012 period? If you look at the return chart posted in Unholy Grails (implemented with slightly different position sizing rules from what @tech/a used), the return for 2010 was 22.3% and the return for 2011 was -6.1%, which is around when the edition I got a copy of was published so there is no 2012 result, but you could imagine TechTrader would be not too far off that mark if @tech/a had kept it up.

    ...

    Anyway that is my 2c contribution to the heated discussion above.

    The thing that I found missing from both equity return curves in the book and the chart @tech/a posted above is tax treatment. The annual net capital gains from the system would be quite hefty and trigger plenty of CGT, which if paid out of the trading capital would change the compounding equation quite a bit I imagine. But they are not included in any charts so the assumption for these curves is you must have plenty of spare capital to pay CGT to not interrupt the fidelity of the charts...
     
    mikeroxoz, Skate, peter2 and 2 others like this.
  20. tech/a

    tech/a No Ordinary Duck

    Posts:
    19,351
    Likes Received:
    3,499
    Joined:
    Oct 14, 2004
    Just a couple of things.

    Finish date was October 2008
    Reason I closed it was that the portfolio was closing trades but not giving new trades
    There were 3 remaining and the equity high had been $467k and I wanted to buy
    a property. Right or wrong I sold up.

    The universe was BT Margin allowed margin traded stocks.

    I know of a couple of people who have traded the original T/T until today and they are both
    very happy.
    They both had a loss in 2009 of 8 and 9 %.

    Me I trade a system based around the original method for my super.
     
    Skate and peter2 like this.
Loading...

Share This Page