Waiting time to re-enter the market

Posted on 12th December 2011 in Research

(Fotis, Reason for Edit: Graphs)

 

Greetings to all,

 

I have been re-visiting the issue of the waiting time to re-enter the market, one a signal has been issued to exit from the current trade (e.g. when the current price drops below the entry price, in any of the two variations we have explored). Although in our code we have provided the option of a threshold parameter as a % of the entry price to fine-tune the exit strategy, we still have had questions about an approach that deals with “how many days should I wait before re-entering, if I do not want to wait until the next buy signal is issued and the standard moving average is still on?”

 

First, here is a reminder: if one looks at the price path itself then, once an exit signal is issued, the waiting time for a return to the origin (i.e. the last entry price) may be infinite – depending on certain assumptions underlying the nature of the random walk that prices follow. Therefore, once you exit you: (a) either wait for the next signal to re-enter or (b) you go short on the asset. How fast you exit is controlled by the threshold parameter.

 

Suppose now that instead of looking at the price we look at the intervals between signals, whether from the standard or the improved moving averages (in fact the following discussion applies to any signal variable). For concreteness consider the intervals you are out of the market and count the number of days per interval. Then, you generate a new time series of waiting times or durations which you can try to fit to an appropriate distribution. These durations correspond to the number of days you have to wait to have a new entry, whether this is issued by a new buy signal or be having the current price rise above the last entry price. It should be clear that the properties of such a series of waiting times is data and method dependent; however, can we draw some useful conclusions by modeling it?

 

The four figures below give a preview of some work-in-progress on this issue. They contain QQ plots of the durations for all 9 signals that our code returns benchmarked on the geometric distribution (which is suitable to this kind of analysis). Figures 1 and 1a are for SPY with the exponential and the weighted moving averages respectively, while Figures 2 and 2a are for EWJ again with the exponentiala and weighted moving averages. For both series the star date is 1993 and the look-back periods were 20 and 100 days; an exit threshold of 3% was also used.

 

The results show some consistencies that are surprising yet useful: (a) the fit of the geometric distribution is extremely good for both ETFs when the fast moving average is used, either in standard form or in the two improved forms (first vertical panel of three figures on the far left of each picture); (b) the fit decreases when we go to the slower moving average and decreases even more when we go to the moving average cross-overs; (c) the fit on (b) improves when we change from the exponential to the weighted moving average, again for both ETFs; (d) note that there appears to be a “kink” or discontinuity in the figures for the slower moving average and the moving average cross-over: this might imply that the waiting times cannot be modeled by a single probability in the geometric distribution but that probability might be dependent on the duration itself.

 

The above suggest two avenues of research that we are pursuing: first, how general is the result in (a) above and if it is how can we use it for more effective trading? For example, we could use the average waiting time implied by the geometric distribution to work out strategies for re-entry. Second, if the probability that determines re-entry depends on the duration itself how can we model it? I have made a modification to the standard geometric distribution that appears to be working and more results will be posted once we perform additional tests.

 

Hope you find this useful so please let us know of your thoughts.

comments: 0 »

Sample of output from Ichimoku clouds

Posted on 9th December 2011 in Research

(Fotis, Reason for Edit: Graphs)

Greetings to all,

We are posting some output from a code that we are developing for Ichimoku clouds and their trading. This is a project for the near future but it would be nice to hear some opinions as to whether people are using them and to alert us if there is something in R for doing this – if there is we certainly missed it so please let us know.

The first figure uses the standard cloud terminology and has the standard settings of (9,26,52) days for constructing the various cloud lines.

The second figure has the settings (20,100,100) and we used those for a simple trading exercise (clearly the standard settings did not work with it). All figures are for SPY from 2000. Hope that you find this interesting.

 

comments: 0 »

Experiment and let us know!

Posted on 7th December 2011 in Research

Greetings to all,

Now that the code for the work in our first paper is uploaded it would be great if you test it with your own settings and share with everyone your results. The code has incorporated a number of additions that make backtesting easier and has been written with comments and explicit commands (rather than packages) to ensure portability to other applications that you have. The main features are as follows:

  • results for both price cross-overs and moving average cross-overs.
  • results for the standard moving averages, the improved moving average and a modified version of the improved moving average where, after an exit we re-enter once above the current entry price (i.e. we do not wait for a new signal).
  • there are options for three types of moving averages, simple, weighted and exponential.
  • there is an option for an exit threshold to reduce the number of exits that happen in the short-run.
  • results are returned ready to post-process and plot (they are aligned).
  • we provided a couple of additional functions that you could use.

We would be delighted to hear your opinion and results on the use of this material. We also would like to thank all of you that contributed to this project by so many constructive comments.

    comments: 0 »

    Q&A on the improved MA approach

    Posted on 5th December 2011 in Research

    Greetings to all,

    We have been very fortunate to receive many interesting questions on the use and potential of the improved MA approach presented in our papers. With the help of your interaction we have cross-checked our code and results, and we will be posting a full working version of the code for backtesting soon.

    Now, here are some pointers based on the questions that we received. We hope that you find them useful and we look forward to your comments.

    1.  Our method is (obviously!) not a “universal” method: that is, it will not outperform in an arbitrary parameter combination the standard MA approach or the buy & hold (B&H) approach.
    2. Our method, on the other hand, does outperform on average the standard MA approach, based on our analysis so far. The statement “on average” is important: it means that across parameter combinations and MA schemes (simple, weighted, exponential etc.)  is performing better than the standard MA approach.
    3. When the standard MA approach does not outperform the B&H approach we cannot know beforehand whether our approach will outperform the B&H as well.
    4. The choice of MA scheme, either simple, weighted or exponential, does change performance! This is important as backtesting should be conducted using all of these schemes rather than just one. This has been well documented in the papers where some preference was found for the weighted moving average on price cross overs and the exponential moving average on moving average cross overs.
    5. Trading costs were not accounted in the paper: they are an issue in most markets but most probably not in the FX market. Other trading frictions and issues of intraday variation were not discussed.
    6. Our choice of evaluation periods (different starting dates but same ending dates) can be seen as rather positive than negative: it allows us to compare the “strength” of the method if we were to start on different times and see how well we fared until now.
    7. Is there a problem of data snooping? Yes and no: on the one hand we present a large number of combinations (not that large really but so be it!); on the other hand, we were never interested in the performance of any individual parameter combination but on average performance. All discussion in the papers, and our first two pointers above, are about this average performance. Thus some part of data snooping is impounded.
    8. In our analysis we used the dividend adjusted closing prices and, again, this can be a pro or a con for the evaluation of the method. We have heard different opinions of this but the results on other tests are rather similar.
    9. A question that appeared more than once was this: when you exit a trade, when the closing price is less than the entry price,  why wait for another signal to re-enter and not enter directly when the closing price becomes higher than then current entry price? The answer to this is two-fold: first, the same theory for going up applies when going down: once you crossed below the entry price the chances are in favor of going down in the next periods; second, the average waiting time for such a re-cross can be infinite, thus there is no point to wait! This latter observation is important and is reversed only in special cases where a local drift appears in the random walk. This local drift cannot be known in advance but if it does occur such reversals in finite average waiting time can occur. In the end, why take the chances? You would be better off going to the long/short approach we suggest in the second paper!
    10. Are there “ideal” conditions for the improved MA approach? Indeed there can be if prices follow a random walk with constant drift; then, asymptotically, you will probably have the improved MA approach outperforming the standard MA approach. Is this assumption on the drift realistic? Well, a constant drift may hold for extended periods of time but fail at others, i.e. we can have a locally constant drift: compare the price paths of SPY and GLD as an example. 
    11. Can you compare your approach to a fixed trailing stop? No! The whole idea behind our approach rests on the revisions that occur in the entry price so a comparison with a fixed trailing stop is feasible on performance grounds but not on the underlying intuition of the method.

    Hope that the above will be helpful to further understand and successfully implement our method. Please be patient before drawing conclusions on its efficacy and please come back to download the code that we will be providing!

    Many thanks!

    comments: 0 »

    New page and new stuff

    Posted on 30th November 2011 in Research

    We are starting off a downloads page where we are going to be posting various material that you can freely download. To kick-off things you will find a nice excel template that implements standard (not ours!) moving average cross-overs but has additional material, like Fibo retracements, RSI and strategy evaluation. Just upload your data in the data template and refresh all formulas and you are set to go. Please note that the first trade signals have to be inputed manually in the “indicators” worksheet. This is older material and it may have errors, so scan it first to check.

     

    comments: 0 »