I thought of the following strategy:

  1. Choose some good ETF (doesn't really matter how I choose it for my question) - let's call it E.
  2. While price of E is higher than 90% of its peak historical price (example: if peak is 100$ so enter this loop if price > 90$)
    2.1. Wait
  3. Buy n units of E (now the price <= 90% of the peak). Let's mark the buy price at p.
  4. While price of E < (1.05 * p)
    4.1. Wait
  5. Sell E(now we have at least 5% profit).
  6. Return to 2

I tried to look at some sites for backtesting it, but didn't find how.
Do you know any place where I can backtest this strategy?

  • Questions seeking product, service recommendations or other off-site resources are off-topic.
    – Flux
    Nov 5 '20 at 18:10
  • Yes. It is actually TRIVIAL Start programming it in a platform, then test it.
    – TomTom
    Nov 5 '20 at 18:42
  • 1
    Seems a similar approach as an earlier question, Buying shares when the price goes down 2% and selling shares when it goes up 2% (but I've not thought about it enough to say whether it's a dupe or not). In my answer to that question, based on historic FTSE data rather than an ETF, there was never a "universally good" pair of figures (5% in your example) that worked better than just buy and hold. Some figures worked better for some periods, but failed miserably for others.
    – TripeHound
    Nov 5 '20 at 21:41
  • Let's assume that you like the invest, maybe trade strategy that you spelled out. Would it interest you if you could make 5% in 3 weeks if your ETF only increased 2.5% ? (I'm basing this on the SPY). Nov 5 '20 at 22:59
  • 4
    Downvoters: I think this is actually a good question and not asking for product, service recommendations or other off-site resources - my reading is that OP is asking how to approach the process of backtesting which fits with either personal finance or quant but is too simple for the quant stack. I read this as asking "how do you backtest" not "what software or service should I use to backtest"
    – MD-Tech
    Nov 6 '20 at 13:40

'Backtesting' will likely not be meaningful to you given you seem quite new to investing. You are at risk of becoming overconfident that your simplified 'strategy' has value, and if the data you select to backtest looks good, that confidence could increase. But historical results do not indicate future performance.

"Buy Low and Sell High" is a great strategy - unfortunately it is retrospective. What is 'Low'? What is 'High'? These are relative terms. What happens in your strategy if a 5% gain is never reached? Such gains are not guaranteed. (Even 'Sell when it gains 1%' is not guaranteed, if you happen to buy at what is later known to be a peak).

I recommend you look into 'value investing', and consider simply contributing to your savings every paycheck, dumping funds into a diversified low-fee index fund, keeping enough savings in cash to pay for 3-6 months of your monthly expenses. Don't try to actively trade until at least you have more experience [and many people, even some who have some knowledge on the subject, decide to never actively trade].

  • While your answer has merit, most of it does not address the OP's question which asks for a way to backtest his idea. Nov 6 '20 at 15:07
  • If someone with a learner's permit and keys to a rented Ferrari in his hand asked you for directions to the Autobahn, the correct answer wouldn't be "Take a left turn at Albuquerque-bürg ", it would be "Practice with your Honda Civic first". Nov 6 '20 at 15:26
  • You've jumped to the conclusion that one jumps into a Ferrari the minute you get a driver's permit. Back on topic, the purpose of backtesting to is test the viability of ideas and that is the prerequisite for paper trading not Formula One racing. Nov 6 '20 at 15:57
  • @BobBaerker I hear what you're saying and don't disagree - it's just that from my reading of the OP's question, they believe that a very simplistic model, perhaps the first they've thought of, is a key to success, and that confidence is not uncommon amongst new, young investors. I see the overconfidence I had myself when I was younger, and am giving the warning I wish I had had at the time (not for financial modelling per se, but similar naive overeager appetite for risk). Nov 6 '20 at 16:12

You can test this in a crude way in Excel.

For more precise results, there are backtesting programs (such as Metastock) that you can purchase as well as online brokers that offer sophisticated tools as well (for example, TradeStation).

There are a number of issues with your strategy. In a volatile market you might get a number of successful trades. In a trending market, you might be out of the market for a long time and in a down market, you might be a bag holder for some time as well.

It's worthwhile to backtest simple strategies with the ultimate goal of finding a strategy that has some merit but that can take years to achieve and for some, perhaps never.

  • How does backtesting work in Excel? Does it involve writing macros using VBA?
    – Flux
    Nov 6 '20 at 2:14
  • 2
    A macro is a recording of a sequence of inputs that makes tasks easier. How one uses the tool is situation specific. The essence of backtesting is creating mathematical tests. If you can put your criteria in a formula, you can test it. The more if/than formulas, the harder it becomes to use Excel. As I mentioned in my answer, there are more sophisticated tools out there for the testing of complex strategies. Nov 6 '20 at 3:33
  • you would be surprised how many small to medium size investment companies use Excel for backtesting their strategies. I actually know an investment bank (who will remain nameless) who were using Excel as an OMS up until a few years ago. VBA really shouldn't be used for trading
    – MD-Tech
    Nov 6 '20 at 13:16

Not the answer you're looking for? Browse other questions tagged or ask your own question.