bb113 (OP)
|
![](https://bitcointalk.org/Themes/custom1/images/post/xx.gif) |
September 16, 2013, 01:52:13 PM |
|
How about this method: 1)Get the gox historical daily prices 2)Calculate the day-to-day percent changes, ie (Price[n+1] - Price[n])/Price[n] 3)Create a markov chain starting at the most recent price 4)Sample a price change from the distribution of differences in the historical data (see topright panel below) 5)Update Price by one day in future 6)Goto 4 Example outputs: ![](https://ip.bitcointalk.org/?u=http%3A%2F%2Fs12.postimg.org%2F3rq9ajlrx%2FGox_Examples001.png&t=665&c=-SPR4OuqLL93AA) Overall Posterior Distributions: ![](https://ip.bitcointalk.org/?u=http%3A%2F%2Fs12.postimg.org%2Fomkirysqj%2FGox_Predict001.png&t=665&c=t1GQF4z96qBdJw) Interpretation: 30 days from today there 95% probability the price will be between 62.5 and 320.7 usd, 67% probability it is between 105.7 and 219.6 USD, and the expected value is either 181 or 169 usd depending on whether you prefer the mean or median as your estimator.
|
|
|
|
ElectricMucus
Legendary
Offline
Activity: 1666
Merit: 1057
Marketing manager - GO MP
|
![](https://bitcointalk.org/Themes/custom1/images/post/xx.gif) |
September 16, 2013, 02:11:00 PM |
|
Care to backtest it? (That is doing the predictions at a already past point of time so you can see how useful the model is.)
|
|
|
|
BombaUcigasa
Legendary
Offline
Activity: 1442
Merit: 1005
|
![](https://bitcointalk.org/Themes/custom1/images/post/xx.gif) |
September 16, 2013, 02:57:10 PM |
|
Bro, do you even imgur.com? I can't see your pictures.
|
|
|
|
bb113 (OP)
|
![](https://bitcointalk.org/Themes/custom1/images/post/xx.gif) |
September 16, 2013, 03:07:38 PM |
|
Here are the results if I had done this 1 year ago and predicted a year into the future (ie it does not include the price changes after 365 days ago). The actual prices are noted by the red text: ![](https://ip.bitcointalk.org/?u=http%3A%2F%2Fs12.postimg.org%2Fcf9xvbx8d%2FGox_Predict001.png&t=665&c=VPd1k4VYHfNjaA) Bro, do you even imgur.com? I can't see your pictures.
I tried going to that site and it wanted to install something as far as i could tell. This site is just the first one that comes up with a search( "postimg.org"). Not sure why it would not display for you.
|
|
|
|
oda.krell
Legendary
Offline
Activity: 1470
Merit: 1007
|
![](https://bitcointalk.org/Themes/custom1/images/post/xx.gif) |
September 16, 2013, 03:50:45 PM Last edit: September 16, 2013, 10:50:41 PM by oda.krell |
|
Really interesting. Thanks for sharing this. By the way, I can see the images fine.
Some notes/observations:
the 95% interval is, hm, sort of useless for our purposes, isn't it? The range is huge (as you would expect), so not much information can be gained from that. Except maybe to tell the uber-bulls that a 100k $/btc price next year is exceedingly unlikely :P
at a glance, the median appears to be more accurate than the mean. What is really puzzling is that in your backtest looking 1 year ahead, a) mean and median diverge a lot (350 vs 149), and b) the meanmedian is actually remarkably accurate. Just a lucky guess, or not, I don't know. But that's a pretty remarkable result for a relatively simple model, no?
Would be interesting to see how the model works in a "sliding" backtest, say: 1 week prediction, starting 1 year ago, moving forward 1 week each iteration. Looking at the result of your backtest, the median might turn out to be a pretty good predictor of the price one week later, which for trading purposes would be already very useful, but it would be *really* interesting to see how the model performs a week before April 10 2013, or a week before one of the other wild price swings in May.
EDIT: wrote 'mean', meant 'median'
|
Not sure which Bitcoin wallet you should use? Get Electrum!Electrum is an open-source lightweight client: fast, user friendly, and 100% secure. Download the source or executables for Windows/OSX/Linux/Android from, and only from, the official Electrum homepage.
|
|
|
BombaUcigasa
Legendary
Offline
Activity: 1442
Merit: 1005
|
![](https://bitcointalk.org/Themes/custom1/images/post/xx.gif) |
September 16, 2013, 03:56:55 PM |
|
I tried going to that site and it wanted to install something as far as i could tell. This site is just the first one that comes up with a search( "postimg.org"). Not sure why it would not display for you.
Sorry to hear that. This is what I see: https://i.imgur.com/dus4hIc.jpgI can't see the picture in your post: http://s12.postimg.org/8obt1tyij/Gox_Predict001.png, the new url is http://s12.postimg.org/omkirysqj/Gox_Predict001.png for me. It must be an error on your part or some silly protection scheme from postimg. Here are the results if I had done this 1 year ago and predicted a year into the future (ie it does not include the price changes after 365 days ago). The actual prices are noted by the red text:
Can you use a logarithmic scale? It's hard to understand what goes on from a flat line and an exponential J curve.
|
|
|
|
Odalv
Legendary
Offline
Activity: 1414
Merit: 1000
|
![](https://bitcointalk.org/Themes/custom1/images/post/xx.gif) |
September 16, 2013, 03:59:50 PM |
|
I can see the images fine.
|
|
|
|
bb113 (OP)
|
![](https://bitcointalk.org/Themes/custom1/images/post/xx.gif) |
September 17, 2013, 12:08:05 PM |
|
With regards to putting more constraints/dependancies, there is a nice linear relationship between the "acceleration of price change" (x axis) and percent chance in price one day later (y-axis): ![](https://ip.bitcointalk.org/?u=http%3A%2F%2Fs2.postimg.org%2Fmfhfaus21%2FGox_Rchange_Plot001.png&t=665&c=Xf7hdFf3jca1-A) In the figures above I sampled a change in price putting uniform weights on all, instead we can make some more likely to be chosen (shown by the heatmaps above for the points shown in black). In that case here is a repeat of the first figure: ![](https://ip.bitcointalk.org/?u=http%3A%2F%2Fs24.postimg.org%2Fn2u454vp1%2FGox_Predict001.png&t=665&c=7s2_vXgB-e-Gsw) Now the distribution shown in the heatmap just a normal distribution with standard deviation (.3) which is arbitrary. This appears to be a good skeleton for a model though. Really interesting. Thanks for sharing this. By the way, I can see the images fine. Some notes/observations: the 95% interval is, hm, sort of useless for our purposes, isn't it? The range is huge (as you would expect), so not much information can be gained from that. Except maybe to tell the uber-bulls that a 100k $/btc price next year is exceedingly unlikely ![Tongue](https://bitcointalk.org/Smileys/default/tongue.gif) at a glance, the median appears to be more accurate than the mean. What is really puzzling is that in your backtest looking 1 year ahead, a) mean and median diverge a lot (350 vs 149), and b) the meanmedian is actually remarkably accurate. Just a lucky guess, or not, I don't know. But that's a pretty remarkable result for a relatively simple model, no? Would be interesting to see how the model works in a "sliding" backtest, say: 1 week prediction, starting 1 year ago, moving forward 1 week each iteration. Looking at the result of your backtest, the median might turn out to be a pretty good predictor of the price one week later, which for trading purposes would be already very useful, but it would be *really* interesting to see how the model performs a week before April 10 2013, or a week before one of the other wild price swings in May.EDIT: wrote 'mean', meant 'median' This would be kind of a pain to assess the results of, you think just compare the median with the actual price for the statistic? I tried going to that site and it wanted to install something as far as i could tell. This site is just the first one that comes up with a search( "postimg.org"). Not sure why it would not display for you.
Sorry to hear that. This is what I see: https://i.imgur.com/dus4hIc.jpgI can't see the picture in your post: http://s12.postimg.org/8obt1tyij/Gox_Predict001.png, the new url is http://s12.postimg.org/omkirysqj/Gox_Predict001.png for me. It must be an error on your part or some silly protection scheme from postimg. Here are the results if I had done this 1 year ago and predicted a year into the future (ie it does not include the price changes after 365 days ago). The actual prices are noted by the red text:
Can you use a logarithmic scale? It's hard to understand what goes on from a flat line and an exponential J curve.Yes I could do that. There was an annoying technical reason it is not already like that.
|
|
|
|
bb113 (OP)
|
![](https://bitcointalk.org/Themes/custom1/images/post/xx.gif) |
September 17, 2013, 01:50:05 PM |
|
And here is 1 year back-testing. The median is not so accurate now but still I think this model is stronger (if it wasnt for the arbitrary standard deviation when assigning the percent change weights). Also the heatmaps in the last post should have had their axes multiplied by 100 to be percents. ![](https://ip.bitcointalk.org/?u=http%3A%2F%2Fs18.postimg.org%2Fr099gg1h5%2FGox_Predict001.png&t=665&c=a0mzNyTSwfHW8w)
|
|
|
|
bb113 (OP)
|
![](https://bitcointalk.org/Themes/custom1/images/post/xx.gif) |
September 17, 2013, 08:19:21 PM |
|
OK here are sliding backtest results. 210 days: ![](https://ip.bitcointalk.org/?u=http%3A%2F%2Fs10.postimg.org%2Fmi4dw591l%2F210.png&t=665&c=W06tA3EilRosdA) Monthly (30 days): ![](https://ip.bitcointalk.org/?u=http%3A%2F%2Fs14.postimg.org%2Fqzmc7g2sh%2Fmonthly.png&t=665&c=0B-2kvSele9WIg) Weekly (7 days): ![](https://ip.bitcointalk.org/?u=http%3A%2F%2Fs21.postimg.org%2Ffgf1jfmfr%2Fweekly.png&t=665&c=HjPbbtJaPLFkEg) Daily: ![](https://ip.bitcointalk.org/?u=http%3A%2F%2Fs21.postimg.org%2Fy17v48x93%2Fdaily.png&t=665&c=Aw9ek_c03ZPYVw)
|
|
|
|
oda.krell
Legendary
Offline
Activity: 1470
Merit: 1007
|
![](https://bitcointalk.org/Themes/custom1/images/post/xx.gif) |
September 18, 2013, 03:57:09 PM |
|
OK here are sliding backtest results.
I admit defeat. How do I read those latest results? Are the "sliding" test results only visible in the upper log chart? If so, how can I compare test result with actual price?
|
Not sure which Bitcoin wallet you should use? Get Electrum!Electrum is an open-source lightweight client: fast, user friendly, and 100% secure. Download the source or executables for Windows/OSX/Linux/Android from, and only from, the official Electrum homepage.
|
|
|
ElectricMucus
Legendary
Offline
Activity: 1666
Merit: 1057
Marketing manager - GO MP
|
![](https://bitcointalk.org/Themes/custom1/images/post/xx.gif) |
September 18, 2013, 05:33:11 PM |
|
It looks like a laggy trend follower to me, not particularly useful.
The black lines in the middle should be the median and the dotted lines the standard deviations.
|
|
|
|
bb113 (OP)
|
![](https://bitcointalk.org/Themes/custom1/images/post/xx.gif) |
September 18, 2013, 05:37:31 PM |
|
Those are the results of four different backtests: 1)210 days straight 2) Backtest for 30 days then update the distribution of price changes 3) Backtest for 7 days and do like in #2 4) Backtest one day at a time
Each of them also forecasts for the same time period into the future. I simply appended the results of each backtest on to the last one to create the topleft panels. The actual price data (daily VWAP) is shown by the blue line. The arrows at the bottom of this chart indicate the timepoints at which I plotted the distribution of estimates in the histograms below (just six evenly spaced intervals). The actual prices are indicated on the histograms by the point and blue text if it fell within the 95% HDI, but in red text if it did not for that timepoint.
You can see from the 3rd set of charts (weekly), that it did not perform very well during the large rise and fall. I've since added a further influence on the choice of price change: fit a lowess curve and determine the distance of each price from the curve in the historical data. Then use this correlation to pick a similar price change as occurred historically. Its running in the background now so...
|
|
|
|
bb113 (OP)
|
![](https://bitcointalk.org/Themes/custom1/images/post/xx.gif) |
September 18, 2013, 05:45:56 PM |
|
It looks like a laggy trend follower to me, not particularly useful.
The black lines in the middle should be the median and the dotted lines the standard deviations.
Yes, this is to be expected since it is based entirely on historical data. All it can do is give a range of scenarios similar to what has occurred in the past. However, once the basic model is determined, we can add in the influence of a prior distribution on the price change choice (ie make it more likely to choose positive changes if we feel bullish, or negative for bearish), which should improve the forecasting given that the prior used is actually valid. Another thing is to increase the tail risk if for example the price has been "stable too long" or there are lots of black swans sensed. Basically it will be a way to combine the "this is like 2011/2012/whatever" concept with the subjective impression due to current info on the fundamentals.
|
|
|
|
oda.krell
Legendary
Offline
Activity: 1470
Merit: 1007
|
![](https://bitcointalk.org/Themes/custom1/images/post/xx.gif) |
September 18, 2013, 06:19:47 PM |
|
Those are the results of four different backtests: 1)210 days straight 2) Backtest for 30 days then update the distribution of price changes 3) Backtest for 7 days and do like in #2 4) Backtest one day at a time
Each of them also forecasts for the same time period into the future. I simply appended the results of each backtest on to the last one to create the topleft panels. The actual price data (daily VWAP) is shown by the blue line. The arrows at the bottom of this chart indicate the timepoints at which I plotted the distribution of estimates in the histograms below (just six evenly spaced intervals). The actual prices are indicated on the histograms by the point and blue text if it fell within the 95% HDI, but in red text if it did not for that timepoint.
You can see from the 3rd set of charts (weekly), that it did not perform very well during the large rise and fall. I've since added a further influence on the choice of price change: fit a lowess curve and determine the distance of each price from the curve in the historical data. Then use this correlation to pick a similar price change as occurred historically. Its running in the background now so...
Still don't get it. I can't see a blue line (for actual price) in the topleft chart. And for test 4), if you backtested one day at a time starting about a year ago, shouldn't there be 365 of the lower histograms, each with a 1 day prediction period?
|
Not sure which Bitcoin wallet you should use? Get Electrum!Electrum is an open-source lightweight client: fast, user friendly, and 100% secure. Download the source or executables for Windows/OSX/Linux/Android from, and only from, the official Electrum homepage.
|
|
|
bb113 (OP)
|
![](https://bitcointalk.org/Themes/custom1/images/post/xx.gif) |
September 18, 2013, 06:34:54 PM |
|
Blue line is really dark due to image compression, so call it the thick black line that looks like the price history, the chart is getting busy so it may be kind of hard to see... It pretty much goes down the middle of the estimates. It is most obvious in the monthly chart The various colors in the background are the results of a random sampling of the simulation results. The thick grey line is the median estimate, the dotted lines towards the outside are the 67% and 95% HDIs in grey and black respectively. Sometimes they are hard to see now.
The reason there are not 365 histograms is because thats alot of histograms. Instead I chose six at equally spaced intervals, the timepoints that got chose are marked by the triangles at the bottom. You can see the start and end points of the backtesting in the monthly and weekly charts because the estimates are very tight early on then get less certain farther from the start point. The daily graph is high resolution enough that you cant really see this effect.
|
|
|
|
oda.krell
Legendary
Offline
Activity: 1470
Merit: 1007
|
![](https://bitcointalk.org/Themes/custom1/images/post/xx.gif) |
September 18, 2013, 10:38:59 PM |
|
I see it now. On the daily test I still can't really make out the difference between median and actual price, but I looked at the weekly result zoomed in and it's pretty clear there.
What is interesting is that weekly works quite well as a leading predictor even during volatile times, like the extreme run-up in before the April crash, but it completely fails when it comes to crashes -- the April 10th one, but even slightly less drastic ones, like the one on September 4th. (if I'm reading the chart correctly now)
Sorry if that's stating the obvious, but it's just that the gap is pretty noticeable. The method works well while a trend is continuing, but as it is now, it seems to have no chance to predict a sudden reversal.
|
Not sure which Bitcoin wallet you should use? Get Electrum!Electrum is an open-source lightweight client: fast, user friendly, and 100% secure. Download the source or executables for Windows/OSX/Linux/Android from, and only from, the official Electrum homepage.
|
|
|
bb113 (OP)
|
![](https://bitcointalk.org/Themes/custom1/images/post/xx.gif) |
September 18, 2013, 11:15:31 PM |
|
I see it now. On the daily test I still can't really make out the difference between median and actual price, but I looked at the weekly result zoomed in and it's pretty clear there.
What is interesting is that weekly works quite well as a leading predictor even during volatile times, like the extreme run-up in before the April crash, but it completely fails when it comes to crashes -- the April 10th one, but even slightly less drastic ones, like the one on September 4th. (if I'm reading the chart correctly now)
Sorry if that's stating the obvious, but it's just that the gap is pretty noticeable. The method works well while a trend is continuing, but as it is now, it seems to have no chance to predict a sudden reversal.
Look at the beta (.5,.5) distribution here: ![](https://ip.bitcointalk.org/?u=https%3A%2F%2Fupload.wikimedia.org%2Fwikipedia%2Fcommons%2Fthumb%2Ff%2Ff3%2FBeta_distribution_pdf.svg%2F500px-Beta_distribution_pdf.svg.png&t=665&c=_UejGieQsPgZdw) What I'm thinking is that when things get to the state we were at at the peak, noone really thinks it is going to level off. Either it will keep climbing or crash. So what you do at that point (in lieu of having a good peak indicator) is multiply the probabilities of choosing each price change by that distribution (transform min/max price changes to 0 and 1), thus using your judgement while forecasting to input large kurtosis risk. Actually I think the beta distribution goes infinite as it approaches zero and one so just pad the limits with .1 or whatever...
|
|
|
|
|
oda.krell
Legendary
Offline
Activity: 1470
Merit: 1007
|
![](https://bitcointalk.org/Themes/custom1/images/post/xx.gif) |
September 19, 2013, 04:08:27 PM |
|
I see it now. On the daily test I still can't really make out the difference between median and actual price, but I looked at the weekly result zoomed in and it's pretty clear there.
What is interesting is that weekly works quite well as a leading predictor even during volatile times, like the extreme run-up in before the April crash, but it completely fails when it comes to crashes -- the April 10th one, but even slightly less drastic ones, like the one on September 4th. (if I'm reading the chart correctly now)
Sorry if that's stating the obvious, but it's just that the gap is pretty noticeable. The method works well while a trend is continuing, but as it is now, it seems to have no chance to predict a sudden reversal.
Look at the beta (.5,.5) distribution here: ![](https://ip.bitcointalk.org/?u=https%3A%2F%2Fupload.wikimedia.org%2Fwikipedia%2Fcommons%2Fthumb%2Ff%2Ff3%2FBeta_distribution_pdf.svg%2F500px-Beta_distribution_pdf.svg.png&t=665&c=_UejGieQsPgZdw) What I'm thinking is that when things get to the state we were at at the peak, noone really thinks it is going to level off. Either it will keep climbing or crash. So what you do at that point (in lieu of having a good peak indicator) is multiply the probabilities of choosing each price change by that distribution (transform min/max price changes to 0 and 1), thus using your judgement while forecasting to input large kurtosis risk. Actually I think the beta distribution goes infinite as it approaches zero and one so just pad the limits with .1 or whatever... Did I mention I don't really know much about statistical methods? So I'll need to ask some dumb questions: that beta distribution is not motivated by anything bitcoin specific, right? You're assuming it is a good representation of peak/reversal likelihoods as a function of extreme price change, correct?. Also, I don't see how you get the actual multiplier that graph. What's the PDF that ranges from 0 to 2.5? Another idea/question: your random walk approach worked quite okay with price change as input. What do you think are the chances that you can get some complimentary information (maybe estimating reversal likelihood) by applying it to a different domain, say, btc volume, dollar volume, OBV. Not at all sure if that could work, but I'm wondering if price (change) is the only useful input. Any intuition about this?
|
Not sure which Bitcoin wallet you should use? Get Electrum!Electrum is an open-source lightweight client: fast, user friendly, and 100% secure. Download the source or executables for Windows/OSX/Linux/Android from, and only from, the official Electrum homepage.
|
|
|
|