Sure this is covered by existing technicals but anyway a spin off of trying to characterise the nature of stock charts was looking at the dy/dx or speed of a chart.
Take a 20 day moving average (in blue) of the log daily closing stock price (in heavy black - in reverse with most recent to the left) then calculate the difference between successive days (magenta) - this is an approximation of the instantaneous gradient of the M.A. (with x=1 day). Take a 10 day moving average of the gradient for clarity (green).
Where the green passes 0 the gradient is at a turning point (from simple calculus). If the gradient is heading up then the curve is moving away from a low and if it is heading down through 0 then it is moving away from a high. Thus we buy when the green line passes up through 0 and sell when it passes down through 0. The best signal seems to be to buy as the green line passes down through 0 and sell as the gradient approaches its lowest level.
A simple enough signal which so far seems to work. Only tested on two graphs (this is the second: a 1 year passage of the FTSE last year). Will test this fully in the completed genetic algorithm once a model of stock behaviour has been isolated.
20 days was used simply because it is commonly used in technicals and it provides a suitable smoothing at the scale of a year. No smoothing and the speed chart just scratches up and down pointlessly. 10 days again was arbitrary, just enough to smooth the speed. This means however that the green line is some 30days behind the black stock price line - and maybe it is just luck that this syncs with the chart. Really the green line ought to b
e displaced to the left 30days - to be done...
Another approach might be to get the gradient by regression. Here the magenta line is a regression of the 20 days previous (speed) and the blue line is a 10 day regression of that line (acceleration). It is much smoother so gives more accuracy. Green lines from left to right are buy signals (when blue line peaks above magenta); red lines from left to right are sell signals (when magenta passes below blue).
No comments:
Post a Comment