I really love the Howard Bandy books too, but these are quite concentrated around mean reversion systems with low exposure to the markets. Urban's book has a broader set of trading systems beginning of month, bollinger band breakout applied to FX as well as stocks.
- [PDF] The Ultimate Algorithmic Trading System Toolbox + Website: Using Today s Technology To Help!
- make money online with binary options.
- Ernie Chan - Algorithmic Trading.
Next to this it provides many very useful and practical details on how to further improve an idea, based upon a basic entry rule LUXOR system , a step by step process which is very useful to follow step by step. Imagine an extreme case: suppose your model asks you to just buy the one stock that dropped the most in the previous day and hold it forever. In actuality, this strategy will most certainly perform poorly because in many cases the company whose stock dropped the most in the previous day will go on to bankruptcy, resulting in percent loss of the stock position.
The Ultimate Algorithmic Trading System Toolbox + Website (eBook)
But if your historical data do not include delisted stocks-that is, they contain only stocks that survive until today-then the backtest result may look excellent. This is because you would have bought a stock when it was beaten down badly but subsequently survived, though you could not have predicted its eventual survival if you were live-trading the strategy.
Survivorship bias is more dangerous to mean-reverting long-only stock strategies than to mean-reverting long-short or short-only strategies. This is because, as we saw earlier, this bias tends to infl ate the backtest performance of a long-only strategy that fi rst buys low and then sells high, whereas it will defl ate the backtest performance of a short-only strategy that fi rst sells high and then buys low.
Those stocks that went to zero would have done very well with a short-only strategy, but they would not be present in backtest data with survivorship bias.
How to Vote
For mean-reverting long-short strategies, the two eff ects are of opposite signs, but infl ation of the long strategy return tends to outweigh the defl ation of the short portfolio return, so the danger is reduced but not eliminated. Survivorship bias is less dangerous to momentum models. The profi table short momentum trade will tend to be omitted in data with survivorship bias, and thus the backtest return will be defl ated. You can buy reasonably priced historical data that are free of survivorship bias from csidata.
Other vendors include kibot. Or you can in fact collect your own survivorship bias-free data by saving the historical prices of all the stocks in an index every day. Finally, in the absence of such survivorship bias-free data, you can limit yourself to backtesting only the most recent, say, three years of historical data to reduce the damage. When you look up the historical daily closing price of a stock, it refl ects the last execution price on any one of these venues during regular trading hours.
Similarly, a historical daily opening price refl ects the fi rst execution price on any one of these venues. But when you submit a market-on-close MOC or market-on-open MOO order, it will always be routed to the primary exchange only. Hence, if you have a strategy that relies on marketon-open or market-on-close orders, you need the historical prices from the primary exchange to accurately backtest your model.
If you use the usual consolidated historical prices for backtesting, the results can be quite unrealistic. In particular, if you use consolidated historical prices to backtest a mean-reverting model, you are likely to generate infl ated backtest performance because a small number of shares can be executed away from the primary exchange at a price quite diff erent from the auction price on the primary exchange.
- AmiBroker (17 books).
- forex trading hours in pakistan.
- bearish bullish forex.
The transaction prices on the next trading day will usually mean-revert from this hard-to-achieve outlier price. The close and open prices on the U. A similar consideration applies to using high or low prices for your strategy. What were recorded in the historical data are usually the consolidated highs or lows, not that of the primary exchange. They are often unrepresentative, exaggerated numbers resulting from trades of small sizes on secondary exchanges. Backtest performance will also be infl ated if these historical prices are used.
Where can we fi nd historical prices from the primary exchanges? Bloomberg users have access to that as part of their subscription. Of course, just as in the case of storing and using survivorship bias-free data discussed earlier, we can also subscribe to direct live feeds from the primary exchanges and store those prices into our own databases in real time. We can then use these databases in the future as our source of primary exchange data. Subscribing to such feeds independently can be an expensive proposition, but if your broker has such subscriptions and it redistributes such data to its clients that colocate within its data center, the cost can be much lower.
Unfortunately, most retail brokers do not redistribute direct feeds from the exchanges, but institutional brokers such as Lime Brokerage often do. If we don't have access to such data, all we can do is to entertain a healthy skepticism of our backtest results.
(PDF) Ernie Chan - Algorithmic Trading | Alec Huang -
Venue Dependence of Currency QuotesCompared to the stock market, the currency markets are even more fragmented and there is no rule that says a trade executed at one venue has to be at the best bid or ask across all the diff erent venues. Hence, a backtest will be realistic only if we use historical data extracted from the same venue s as the one s we expect to trade on.
There are quotes aggregators such as Streambase that consolidate data feeds from diff erent venues into one order book. In this case, you may use the consolidated historical data for backtesting, as long as you can execute on the venue that formed part of the consolidated order book. Another feature of currency live quotes and historical data is that trade prices and sizes, as opposed to bid and ask quotes, are not generally available, at least not without a small delay. This is because there is no regulation that says the dealer or ECN must report the trade price to all market participants.
Indeed, many dealers view transaction information as proprietary and valuable information. They might be smart to do that because there are high-frequency strategies that depend on order fl ow information and that require trade prices, as mentioned in Chapter 7.
People Who Voted On This List (1)
The banks' forex proprietary trading desks no doubt prefer to keep this information to themselves. But using bid-ask quotes for backtesting forex strategies is recommended anyway, since the bid-ask spreads for the same currency pair can vary signifi cantly between venues. As a result, the transaction costs are also highly venue dependent and need to be taken into account in a backtest. Short-Sale ConstraintsA stock-trading model that involves shorting stocks assumes that those stocks can be shorted, but often there are diffi culties in shorting some stocks.
To short a stock, your broker has to be able to "locate" a quantity of these stocks from other customers or other institutions typically mutual funds or other asset managers that have large long positions in many stocks and arrange a stock loan to you. If there is already a large short interest out there so that a lot of the shares of a company have already been borrowed, or if the fl oat of the stock is limited, then your stock can be "hard to borrow.
In more extreme cases, hard to borrow may mean that you cannot borrow the stock in the quantity you desire or at all. After Lehman Brothers collapsed during the fi nancial crisis of , the U. Securities and Exchange Commission SEC banned short sales in all the fi nancial industry stocks for several months. So if your backtesting model shorts stocks that were hard or impossible to borrow, it may show a wonderful return because no one else was able to short the stock and depress its price when your model shorted it.

But this return is completely unrealistic. This renders short-sale constraints dangerous to backtesting. It is not easy, though, to fi nd a historically accurate list of hard-to-borrow stocks for your backtest, as this list depends on which broker you use. As a general rule, small-cap stocks are aff ected much more by short-sale constraint than are large-cap stocks, and so the returns of their short positions are much more suspect. Bear in mind also that sometimes ETFs are as hard to borrow as stocks. I have found, for example, that I could not even borrow SPY to short in the months after the Lehman Brothers' collapse!
The Ultimate Algorithmic Trading System Toolbox + Website (eBook)
An additional short-sale constraint is the so-called "uptick rule" imposed by the SEC. The original uptick rule was in eff ect from to , where the short sale had to be executed at a price higher than the last traded price, or at the last traded price if that price was higher than the price of the trade prior to the last.
For Nasdaq stocks, the short sale price must be higher than the last bid rather than the last trade. The Alternative Uptick Rule that took eff ect in also requires a short sale to have a trade price higher than the national best bid, but only when a circuit breaker has been triggered. A circuit breaker for a stock is triggered when that stock traded at 10 percent lower than its previous close. The circuit breaker is in eff ect for the following day after the initial trigger as well. This eff ectively prevents any short market orders from being fi lled.
So, again, a really accurate backtest that involves short sales must take into account whether these constraints were in eff ect when the historical trade was supposed to occur. Otherwise, the backtest performance will be infl ated. Futures Continuous ContractsFutures contracts have expiry dates, so a trading strategy on, say, crude oil futures, is really a trading strategy on many diff erent contracts.
Usually, the strategy applies to front-month contracts. Which contract is the "front month" depends on exactly when you plan to "roll over" to the next month; that is, when you plan to sell the current front contract and buy the contract with the next nearest expiration date assuming you are long a contract to begin with. Some people may decide to roll over 10 days before the current front contract expires; others may decide to roll over when there is an "open interest crossover"; that is, when the open interest of the next contract exceeds that of the current front contract.
Fortunately, most futures historical data vendors also recognize this, and they usually make available what is known as "continuous contract" data. We won't discuss here how you can go about creating a continuous contract yourself because you can read about that on many futures historical data vendors' websites. But there is a nuance to this process that you need to be aware of. The fi rst step in creating a continuous contract is to concatenate the prices of the front-month contract together, given a certain set of rollover dates.
Of course, to take care of every rollover, you would have to apply this back adjustment multiple times, as you go back further in the data series. Is our problem solved? Not quite. You really can't have both. An additional diffi culty occurs when we choose the price back-adjustment instead of the return back-adjustment method: the prices may turn negative in the distant past. This may create problems for your trading strategy, and it will certainly create problems in calculating returns. A common method to deal with this is to add a constant to all the prices so that none will be negative.
This subtlety in picking the right back-adjustment method is more important when we have a strategy that involves trading spreads between diff erent contracts. If your strategy generates trading signals based on the price diff erence between two contracts, then you must choose the price back-adjustment method; otherwise, the price diff erence may be wrong and generate a wrong trading signal. When a strategy involves calendar spreads spreads on contracts with the same underlying but diff erent expiration dates , this back adjustment is even more important.
This is because the calendar spread is a small number compared to the price of one leg of the spread, so any error due to rollover will be a signifi cant percentage of the spread and very likely to trigger a wrong signal both in backtest and in live trading. However, if your strategy generates trading signals based on the ratio of prices between two contracts, then you must choose the return back-adjustment method.