There are many ways to approach trading as a machine learning problem. Most people start with the idea of a rolling forecast of the market. The simplest and perhaps most natural idea is to attempt to predict the move of the market over a specific time (or other defined interval). A variant of this, permitting the powerful range of classification tools, is to merely try to predict the direction of the market. A more sophisticated idea is to predict some linear transform of future prices (for example a moving average or exponential moving average. One advantage of linearity here is that it corresponds (at least in principle) to an exit strategy. A refinement to all of these ideas is to also predict the uncertainty on the predictions, which is very useful for making decisions.
While all of these are feasible (if non-trivial) and potentially profitable, they fail to take into account one aspect of trading, which is that we only really need occasional useful knowledge: being ignorant of what the market is likely to do next most of the time is not only the norm, it is ok.
With this in mind, the idea is to instead focus on ideal trading opportunities as the thing we try to predict, and to design a system to attempt to say how similar to an ideal opportunity a particular market is.
With hindsight, the idea trading opportunity is when price never turns against a trade and that trade achieves some target. Moreover, this can be refined further by noting that we can ignore entries which occur during an earlier trade.
Ignoring the subtle point of perfect tests of a price, this leaves us with the idea of identifying major extremes of a market, where price has moved up at least a certain amount before and moves down at least the same amount afterwards. Between such extremes we have our historical ideal trades. This is what we can use as our class of positive examples for training a machine learning tool for classification.
Such a view of historical price action - extremes associated with a specific price scale R - is closely related to the range charts used by some technical traders. It is also related to the idea of a trailing stop.
One important aspect is that the ratio of the sizes of the moves to R indicates the trend strength in a particular direction. Where the ratios are high in one direction, the trend is clearly in that direction. The ratio of the average moves in the two directions gives a measure of strength of a trend which has a similar interpretation on different scales R (although for a specific market, the ratios vary with R). Where the moves are a sizeable multiple of the scale R in both directions, the market is rangy in a way which is potentially profitable on the chosen scale. Where it is low in both directions, the scale is inappropriate for trading.
In the above, "high" can be defined as "significantly above 2" for the simple reason that a trailing stop is profitable if the average move is at least twice the size of the trailing stop. In a trend, one direction can have ratios significantly above 2 and the other can have ratios significantly below 2, which is a time we ideally only want to be trading in one direction on that particular scale R.
It is possible for the situation to be quite different on different scales: for example a rangy market can be trending on lower or higher scales and vice versa. With this single concept, all these things can be methodically quantified.
Determinismus
Thursday, 2 July 2015
Saturday, 27 June 2015
Price action in an efficient market
At any time in any market, we can choose an offset to the price d (think of it as either a possible target price for a trade or a possible stop loss price for a trade) and consider the probability distribution of the maximum move in the opposite direction before the price d is reached. By a simple translation, make the current price 0 to simplify and clarify the notation.
Then if the efficient market hypothesis (EMH) was true (don't worry, it isn't ;) ), the probability distribution would have to be such that any choice of target to go with the stop d or any choice of stop to go with the target d would have to be unprofitable. Neglecting spreads and transaction costs, the inequalities in both directions imply that any such trade would have to break even.
This implies that for every offset in the opposite direction f the odds of the maximum extension of the price graph exceeding this point before reaching price d must be d : f . To put it another way, the probability of exceeding -f must be d / (d+f) = 1 / (1 + d/f).
This requirement provides us with a precise cumulative frequency for the probability of the extreme. To find the implied probability distribution, we simply differentiate w.r.t. f. This gives us the predicted distribution of extremes of moves (the sign is because the cumulative distribution is reversed).
E(f) = d / (d + f)^2
With a stop d = 1, here are the cumulative frequency and probability density graphs of extensions in the opposite direction implied by the EMH. All others have to be the same other than a multiple of d.
Note of course these graphs can be interpreted as the probability of hitting a stop before a chosen target as the bid-ask spread is ignored.
Price action topology
Relative price action forward or backward from a time forms a continuous function f, with f(0) = 0.
Key to trade management by stops and targets are the extremes of this price action. Let E be the set of positive reals e s.t. f(e) does not lie in f( [0, e) ). An extreme of a continuous function f: [0, Inf) -> (-Inf, Inf) is an extreme e s.t. all extremes in some future neighbourhood of e are of the opposite sign.
The image under f of E consists of semi-open intervals of the forms (p_i, p_i+1] and [n_i+1, n_i), where {p_I} are positive extremes and {n_i} are negative extremes and the latter interval is in reverse temporal order (taking time as the domain of f).
Subscribe to:
Posts (Atom)