Running multiple variations of the same strategy

Viewing 2 posts - 31 through 32 (of 32 total)
  • Author
    Posts
  • #55913 quote
    Vonasi
    Moderator
    Master

    I guess the big similarity is that we receive one initial signal (go long for example) and then increase the position size. We learn that not all trades up to the maximum position size must be taken since some strategy-indicator combinations will just not get to the point of entering the market

    It is exactly this that makes it quite difficult to backtest accurately. If you have a backtest bell curve and decide to enter at the top and two positions either side it is not always guaranteed that all five positions will open. You will also want to optimize again and if for example your first optimization says that a variable set at 1 2 3 4 and 5 straddles your bell curve and then a day or two later 3 4 5 6 and 7 straddle the bell curve then if you are still opening bets on 1 and 2 you are well off the mark with those bets – but just imagine if you were only allowed to place one bet and then you would find that it is still on 3 which used to be the best place but is now on the edge of being the worst place. For me this is why I feel that diversification of a key variable in a strategy is probably a benefit – an unproven theory thus far by myself but one worth continuing with I think. 

    Thanks for everyone’s input so far. I believe that discussions on the theory of position sizing, diversification and methodology are as important as finding that winning combination that gives a strategy an edge.

    #56178 quote
    Derek
    Participant
    Veteran

    Since I don’t know if a picture of my notebook is really helpfull for anybody, here is a little guide and toolkit to test the method we are discussing. This way everybody can check for themselves.

    We can backtest a different set of indicator values with PRT. Run a simple backtest with the respective range for the indicator value. Sort the results according to the indicator you are testing. Don’t close the result list! Prorealtime provides a reasonably good result table IMO.

    Here is the position sizing function:

    MAXSHARES = (COUNTOFLONGSHARES <= 5)
    If longonmarket and COUNTOFLONGSHARES <= MAXSHARES then
    Buy 1 contract at market
    //Buy 5 contracts at market
    Endif
    
    Set stop loss positionsize×X
    Set target positionsize×X

    Time dependent entry and exit variables can also be tested with adapting values.

    In this example the system initiates the sequence of trades with a time lag:

    If (entrycondition = true) and longonmarket and COUNTOFLONGSHARES <= MAXSHARES and BARINDEX-TRADEINDEX(1)>=X then
    Buy 1 contract at market
    Endif

    This will help to calculate returns for a long term etf strategy buying regularly like Casper’s great piece. https://www.prorealcode.com/topic/vusa-daily-buy-and-hold-v2-0/
    If we buy a real etf and not a cfd on a etf the cost calculation is a lot more easy.

    Another possibility is to wait for better prices before adding more positions:

    If longonmarket and COUNTOFLONGSHARES <= MAXSHARES and close < tradeprice[1] then
    Buy 1 contract at market
    Endif

    Maybe somebody else provides the code to withhold the first trade before the price drops. In the example above, at least we don’t miss any big move completely. A more classic trendfollowing approach is waiting for the price to actually go up first. I added the example because it’s also included in the book chapter mentioned in my last post.

    Of course a time based exit with adapting values can also be implemented. For every new trade, the exit is delayed.

    If onmarket and BARINDEX-TRADEINDEX(1)>=X then
    Sell at market
    Endif

    As usual more complex functions can be applied to change the indicator values. This way we can test different distributions other than linearity. In the examples above X marks the indicator which is tested. An example for an exponential distribution:

    X = round(exp(indicator value)-1)×100  //the round can be excluded if not needed

    For full enjoynment, here is a helpful formula collection:
    http://www.itl.nist.gov/div898/handbook/eda/section3/eda366.htm

    I hope this helps for testing this method in Proorder. Improvements and necessary corrections to the code snippets are welcome.

Viewing 2 posts - 31 through 32 (of 32 total)
  • You must be logged in to reply to this topic.

Running multiple variations of the same strategy


General Trading: Market Analysis & Manual Trading

New Reply
Author
author-avatar
Vonasi @vonasi Moderator
Summary

This topic contains 31 replies,
has 10 voices, and was last updated by Derek
8 years, 1 month ago.

Topic Details
Forum: General Trading: Market Analysis & Manual Trading
Language: English
Started: 12/11/2017
Status: Active
Attachments: No files
Logo Logo
Loading...