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

Dump it Here

Discussion in 'Beginner's Lounge' started by Skate, Dec 17, 2018.

  1. Boggo

    Boggo

    Posts:
    3,178
    Likes Received:
    368
    Joined:
    Mar 28, 2006
    This is an extract from Kevin Davey's book "Building winning algorithmic trading systems".
    May not be relevant to this discussion but an interesting view from an award winning trader.

    (click to expand)
    Kevin Davey extract.png
     
  2. Skate

    Skate

    Posts:
    1,354
    Likes Received:
    5,151
    Joined:
    Dec 28, 2013
    Process
    It was an extensive process that involved 1,000's of hours. I did most of my testing while cruising around the world, the serenity was to die for & my wife just loved it. (2014 & 2016 World cruise, 2015 Cherry Blossom Cruise, Pacific Rim & all of Asia, I kept doing back to back cruises so I could work without interruption)

    Challenge
    To get the parameter just right was a challenge, optimising to get a base, than more coding, tweaking constantly. Most would realise one simple parameter just out of kilter & it will bring you undone in a big way. Choosing parameter values can be tricky.

    Complexity of code
    It depends on system & the complexity of code being used. Amibroker optimization methods work best in continuous parameter & Amibroker Backtesting needs static figures to find optimum values. My strategy is adapting in real time whereas optimisation & Backtesting is only useful on know past data.

    Pre-auction
    Amibroker backtesting has no ability to operate in the pre-auction, where this is the heart of the strategy. I've explained & shown pictures of the simplicity of my strategy, push one [Explore] button & it reports (a) what to buy (b) Qty of shares to buy & (c) what to offer in the pre-auction. There is nothing flashy in the way I trade. Also I don't use a static position sizing model, that's another issue Amibroker has in backtesting & system development.

    Skate.
     
  3. Zaxon

    Zaxon The voice of reason

    Posts:
    662
    Likes Received:
    586
    Joined:
    Aug 5, 2011
    If you unsubscribe to Norgate data, do you lose the data you've already downloaded?
     
    Skate likes this.
  4. Skate

    Skate

    Posts:
    1,354
    Likes Received:
    5,151
    Joined:
    Dec 28, 2013
    Yes, I had purchased the Historical package originally. Transfering to NDU its a completely different Data subscription packages.

    You start fresh with NDU. They credit any unused Data that has he prepaid & turn it into a discount when the new subscription is purchased.

    Skate.
     
    tyson2710 and JimmyJames80 like this.
  5. Zaxon

    Zaxon The voice of reason

    Posts:
    662
    Likes Received:
    586
    Joined:
    Aug 5, 2011
    OK. I noticed under AmiBroker data options, there are several and many require running an import tool. Presumably that data then lives inside ABs database somewhere. I assumed Norgate Data was the same, in which case, once your Norgate subscription had finished, its downloaded data would still be available somewhere within AB. Based on what you're saying, this isn't the case?
     
    Skate likes this.
  6. Skate

    Skate

    Posts:
    1,354
    Likes Received:
    5,151
    Joined:
    Dec 28, 2013
    "I assumed Norgate Data was the same, in which case, once your Norgate subscription had finished, its downloaded data would still be available somewhere within AB. (Wrong) Based on what you're saying, this isn't the case (Correct)"

    Norgate uses a new data "format". The old data is incompatible with the new plugin & downloader. (NDU)

    Skate.
     
    tyson2710 and JimmyJames80 like this.
  7. qldfrog

    qldfrog

    Posts:
    2,816
    Likes Received:
    1,124
    Joined:
    Jun 8, 2008
    About the number of positions:
    The way i see it:
    If you have a perfect scoring methodology and a binary buy: we are sure of a win, why indeed limit ourselves, the more the better and the safer should a black swan happens on one of our selection.
    But we do not lvie in such a nice binary world.
    our buy signal is an indication and the score is an order of purchasing priority.
    By limiting our buy numbers overall we reduce the lower score entries.it becomes basically another parameter in the buy trigger...
    with a more stringent buy, the number of positions could be illimited.it should also improve the overall results
    So yes you can get 50 positions..with a well rehearsed system
     
    Skate likes this.
  8. peter2

    peter2

    Posts:
    3,173
    Likes Received:
    4,038
    Joined:
    Jan 12, 2008
    @Skate Very interesting that your testing shows 53 is optimal number of positions whereas most trend following systems indicate 15 - 17 with most people happy to use 20.

    Why is there such a difference if all systems are trend following systems?

    Three entry strategies would get you into trends earlier than most and you mentioned that you're not doubling or tripling up when multiple systems select the same stock. I would accept that your exit strategies would exit slightly earlier than most trend following exits. So overall I accept that the Hybrid strategy will do a slightly better job than most mainstream trend following systems but I fail to understand why there's a huge difference in the optimal number of portfolio positions between apparently similar systems.

    I'm not interested in the actual optimum number. I'm trying to understand the difference between 17 and 53. My knowledge and experience would say that a portfolio with 50 positions would not beat the market index. Clearly this has been challenged by skate's work.
     
    JimmyJames80 likes this.
  9. Zaxon

    Zaxon The voice of reason

    Posts:
    662
    Likes Received:
    586
    Joined:
    Aug 5, 2011
    OK. Thanks for that.
     
  10. Skate

    Skate

    Posts:
    1,354
    Likes Received:
    5,151
    Joined:
    Dec 28, 2013
    (re-post)
    I shouldn't have to repeat my posts but for others who may not have read them - I'll reference the post in answering questions.

    peter2 said
    "Very interesting that your testing shows 53 is optimal number of positions whereas most trend following systems indicate 15 - 17 with most people happy to use 20"

    (peter2) 1. "most trend following systems indicate 15 - 17"

    Admittedly a single trend following system rule of thumb is around 15 to 20 positions & just because the majority share that view doesn't automatically make it the correct position size for my 3 system Hybrid Strategy trading a large account.
    Tribal views of the majority (re-post) Jan 4, 2019#625
    Wrong does not cease to be wrong because the majority share in it

    (peter2) 2. "most people happy to use 20"
    That's okay, what suits one may not suit another, whereas I'm happy to use 40
    Alternative view (re-post) Jan 30, #1348
    When it comes to trading there is no right or wrong way. If you disagree with me, don't tell me so, you'll hurt my feelings, all I ask is for you to explain your alternative view, keeping "on point".

    Hybrid Strategy
    My hybrid strategy is a combination of 3 systems & all are trend following systems. Classic trend following systems have a common thread that I have listed just below, their parameters settings dictate the entry & exit points & overall trading results.

    Classic trend following (re-post) Jan 30, #1365
    The setup and exits are classic trend following signals. Enter on a confirmed uptrend, exit when the trend turns down.

    I'm a classic trend follower (re-post) Feb 7, #1494
    I enter on a confirmed uptrend, exit when the trend turns down. I jump on breakout & ride the trend till it's ends. It's a simple method of trading that I find profitable.

    Trend following is popular (re-post) Jan 30, #1349
    The only real issue with trend following is that most Trend following Systems are highly correlated and tend to track the broader market movements at the same time.

    (peter2) 3. "Why is there such a difference if all systems are trend following systems? - I fail to understand why there's a huge difference in the optimal number of portfolio positions between apparently similar systems"

    Explanation

    First, all trending following systems are not the same, there are some systems that are better when it comes to accuracy & some pickup the breakouts signals sooner. The same trend following system with different parameters settings will give different trading results. Doing the same as everyone else gives you no edge when it comes to trading. With a large trading account 'Slippage & Liquidity' are a constant source of irritation.
    Lousy picks (re-post) Dec 17, 2018#32
    All investors will buy their fair share of both good and bad stocks. Even the best investor has plenty of lousy picks along the way, but it is the manner in which you handle those investments after their purchase that ultimately determines your level of success. If you sell your good stocks too early and hold on to your bad stocks too long, it doesn’t much matter how good your stock selection might be.

    (peter2) 4. "I'm trying to understand the difference between 17 and 53. My knowledge and experience would say that a portfolio with 50 positions would not beat the market index. Clearly this has been challenged by skate's work"

    I have been a trader for a short 3 1/2 years so my trading experience is limited. In my defence I have worked extremely hard to develop my Hybrid Strategy. F.Y.I. my backtesting results mirror my actual trading results. I've previously posted my equity curve to indicate trading has not been a smooth ride, but profitable.

    REAL equity curve
    (re-post) Jan 17, 2019 #890
    I have posted my "REAL equity curve" before on this thread but the chart is current as of last Friday - this week is panning out great. The equity curve is from January 2016 (I started trading July 2015 & didn't keep midyear records preferring to start the year off fresh) Have a look at every dip, that cost me an absolute fortune (to me at least)

    UPDATED today 13th February 2019 (results reflective as of Friday 9th February 2019)
    Equity curve Capture.JPG

    Would I share single run backtest
    After explaining my Hybrid strategy back on 17th January @willy1111 asked if I was willing to share a single run backtest from 1 July 17 to 30 June 2018, showing return, drawn down, # of trades, percent winners, ave win %, ave lose %.

    Response
    A single run backtest from 1 July 17 to 30 June 2018 - sure no problems

    The challenge Post # 867
    https://www.aussiestockforums.com/posts/1010309/

    The Backtest Results Post # 871
    https://www.aussiestockforums.com/posts/1010315/

    The backtest report (The report had fixed parameters for demonstration purposes)
    $600,000 Portfolio
    40 positions
    Fixed $15,000 positions

    The FACTS of the way I trade
    My trading portfolio (in excess of $1m)
    Variable position sizing (38 to 53 positions)
    Variable $15k to $50k positions sizes (have taken a few 100k & 200k positions)
    I have posted a true & accurate Trading Equity curve (Jan 2016 to current as above)

    (peter2) 5. "I'm trying to understand the difference between 17 and 53"

    A picture paints a thousand words
    Let me display a backtest result for my Hybrid Strategy using 5, 10, 15, 20 & 40 positions & let you be the judge. I'll use the same time period @willy1111 request for comparison in his previous post. (backtest is from 1 July 17 to 30 June 2018) On the far right of the chart is the equivalent of buying & holding the All ordinaries (XAO)

    2017-2018 Combined Position Trading Results Capture.jpg

    I'm trust this sheds more light on how I trade the Hybrid strategy & how the strategy performs using a variety of position sizes & why 40 positions is my preferred position size.

    Skate.
     
  11. Gringotts Bank

    Gringotts Bank

    Posts:
    6,137
    Likes Received:
    535
    Joined:
    Jun 30, 2007
    1 - My experience is that when one tiny parameter tweak kills a system, the system lacks robustness.
    2- What do you mean by continuous parameter please?
     
  12. willy1111

    willy1111

    Posts:
    311
    Likes Received:
    276
    Joined:
    Jun 17, 2006
    When looking at the results of the 15 Positions and 40 Positions, what I notice is the difference in exposure. 15 Positions has exposure of 37% whilst 40 Positions has exposure of 70%. I imagine it is to do with the fixed $15K position size whilst running the backtest.

    I also imagine the results would be more closely aligned if you were to use Position code based on % rather than fixed $ as in SetPositionSize(2.5,spsPercentOfEquity); for 40 positions and SetPositionSize(6.66,spsPercentOfEquity); for 15 positions.

    I realise this is not the way you trade, purely an academic/educational exercise for other members :)
     
  13. ducati916

    ducati916

    Posts:
    1,909
    Likes Received:
    474
    Joined:
    Feb 13, 2006
    1. The premise would be contained within an inductive argument.
    1(a). The premises of a deductive argument must be true.

    2. No it is not a guess. A deductive argument is productive of necessary conclusions. An inductive argument has the capacity to produce probable conclusions only.

    2(a). True.

    ducati916 said:
    3. Correct. And legal proof is based upon an inductive argument. You have the crime, which is the effect or outcome, you are reasoning backwards to elicit the cause [whodunnit].

    What I should have stated was that 'in this example'....the legal proof is based upon an inductive argument.

    jog on
    duc
     
  14. ducati916

    ducati916

    Posts:
    1,909
    Likes Received:
    474
    Joined:
    Feb 13, 2006
  15. Gringotts Bank

    Gringotts Bank

    Posts:
    6,137
    Likes Received:
    535
    Joined:
    Jun 30, 2007
    It's not what I do. I'm asking Skate why he appears to be re-optimizing on the run. My experience is that re-optimizing bar-by-bar leads to failure in real life trading.
     
  16. rederob

    rederob

    Posts:
    3,304
    Likes Received:
    755
    Joined:
    Jan 29, 2006
    1. The premise would be contained within an inductive argument. Premises are in all arguments
    1(a). The premises of a deductive argument must be true. Premises can be true or false
    2. No it is not a guess. False - it cannot be known without seeing the premise/s.
    A deductive argument is productive of necessary conclusions. An inductive argument has the capacity to produce probable conclusions only. You cannot preordain the type of argument. Without a premise there is no argument.
    To conclude that "Ms Brown is the robber" without seeing the evidence would be a guess.
     
  17. Skate

    Skate

    Posts:
    1,354
    Likes Received:
    5,151
    Joined:
    Dec 28, 2013
    1 - "My experience is that when one tiny parameter tweak kills a system, the system lacks robustness"
    I'll take that as a comment as it bears no resemblance to what I've posted.

    Challenge (re-posted)
    To get the parameter just right was a challenge, optimising to get a base, than more coding, tweaking constantly. Most would realise one simple parameter just out of kilter & it will bring you undone in a big way. Choosing parameter values can be tricky.

    2- What do you mean by continuous parameter please?
    For a better understanding, substitute the word "with fixed parameters" in place of "in continuous parameter"

    Complexity of code (re-posted)
    It depends on system & the complexity of code being used. Amibroker optimization methods work best in continuous parameter & Amibroker Backtesting needs static figures to find optimum values. My strategy is adapting in real time whereas optimisation & Backtesting is only useful on know past data.

    Skate.
     
    tyson2710 and JimmyJames80 like this.
  18. Gringotts Bank

    Gringotts Bank

    Posts:
    6,137
    Likes Received:
    535
    Joined:
    Jun 30, 2007
    Skate, can you define what you mean by fixed parameter please? Do you mean a single value of an array? When you choose a parameter, what exactly are you choosing?

    When AB optimizes, it's finding the best fit value for an array, using historical data, yes? What do you mean by "adapting in real time"? The only data we ever have access to is historical. If I fit my code to any dataset, I'm fitting it to historical data. If I re-fit my code as each new OHLCV is printed, I will end up with an overfitted code - ie. one which will fail in real trading.
     
  19. Skate

    Skate

    Posts:
    1,354
    Likes Received:
    5,151
    Joined:
    Dec 28, 2013
    1. "When looking at the results of the 15 Positions and 40 Positions, what I notice is the difference in exposure. 15 Positions has exposure of 37% whilst 40 Positions has exposure of 70%. I imagine it is to do with the fixed $15K position size whilst running the backtest"

    Correct

    2. "I also imagine the results would be more closely aligned if you were to use Position code based on % rather than fixed $ as in SetPositionSize(2.5,spsPercentOfEquity); for 40 positions and SetPositionSize(6.66,spsPercentOfEquity); for 15 positions. I realise this is not the way you trade, purely an academic/educational exercise for other members"

    (a) I'm dumbfounded why you would want to trade a $600k account with 15 positions ($40k per position) ballooning out to (80k positions) within 12 months. The logic is missing on me. Talk about slippage & liquidity issues. This also creates issues of not being able to trade the backtest code in the pre-auction.
    (b) $600k using 2.5% of Equity ($15k per positions) balloons to ($25k positions) within 12 months. Ballooning position sizing in itself can create additional issues with dire consequences.

    3. "I realise this is not the way you trade, purely an academic/educational exercise for other members"

    Lets do the exercise, so others can understand the difference between: (1) a 15/40 positions portfolio or (2) the difference between trading larger position sizes in dollars $15k/$40k positions or is it to show (3) that limiting a portfolio to 15 positions you're pulling the handbrake on so hard that it restricts the time in the markets, restricting your portfolio's performance

    That's the equivalent of having a full time job & the boss cut your hours back so you have a part time job, no I'm not in favour of that, one little bit.


    SetPositionSize(2.5,spsPercentOfEquity);
    $600K 40 positions @ $15k positions
    SetPositionSize(2.5,spsPercentOfEquity); Capture.JPG


    SetPositionSize(6.66,spsPercentOfEquity);
    $600K - 15 position @ $40k positions
    SetPositionSize(6.66,spsPercentOfEquity); Capture.JPG

    Summary

    1. Net profit
    2. Exposure
    3. Annual Returns %

    All items above (1), (2) & (3) are a direct reflection of bet sizing.

    Skate.
     
  20. willy1111

    willy1111

    Posts:
    311
    Likes Received:
    276
    Joined:
    Jun 17, 2006
    Precisely - and from an academic view - looking purely at the results of the backtest - reducing to 15 positions results in a much higher % return. An increase from 66.75% to 94.56% with less than half the amount of trades or work.

    Perhaps the above is the missing link other members are failing to understand between academic discussion of position size versus real world trading. The liquidity and slippage issues created by having larger positions.
     
    Skate, rnr and debtfree like this.
Loading...

Share This Page