1 registered members (AndrewAMD),
1,089
guests, and 2
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Random walk vs Real price statistic
#471074
02/18/18 18:13
02/18/18 18:13
|
Joined: Dec 2017
Posts: 129 Halifax, NS
kujo
OP
Member
|
OP
Member
Joined: Dec 2017
Posts: 129
Halifax, NS
|
Hello, I've tried RandomWalk script that goes with Zorro (just changed dates a little bit). It compares distribution of price movements of EUR/USD price curve and random price curve: function run() { StartDate=2013; EndDate=2017; PlotHeight1 = 320; vars Price = series(price()); int num = NumRiseFall(Price,20); int x = 3*num; if(num < 0) x += 3; // eliminate the 0 gap plotBar("Price",x,num,1,SUM+BARS,RED); vars Random = series(0); Random[0] = Random[1] + random(); num = NumRiseFall(Random,20); x = 3*num+1; if(num < 0) x += 3; plotBar("Random",x,0,1,SUM+BARS,BLUE); } The following chart is generated: The Black Book says: In the chart, the height of the bars is equivalent to the number of rising or falling price series. The red bars are from the real EUR/USD price curve above, the blue bars from a curve of random numbers. The numbers on the x axis are the duration of a price movement in hours, at the right side for rising, and at the left side for falling prices. The height of a bar indicates how frequently such a rising or falling series occurs in the curve. For instance, the bar above the 3 at the right shows how often the price was rising for 3 hours in sequence. If prices would move totally random, the red bars had the same heights as the blue bars. We can see that this is not the case: rising/falling series of 3, 4, 5, or more hours occur more often in the real price curve than in the random data. 1-hour series - a price rising in the first and falling in the second hour, or vice versa - occur less often. Real prices tend to keep their direction. This effect causes the famous "fat tails" of price distributions. It exists with most assets and time frames, like minutes or days instead of hours. However, this effect almost or completely disappears in case of Close prices: if series(priceClose()) is used instead of series(price()). For example: I wonder how it could be explained? Thank you!
|
|
|
Re: Random walk vs Real price statistic
[Re: kujo]
#471075
02/18/18 18:28
02/18/18 18:28
|
Joined: Sep 2017
Posts: 235
Hredot
Member
|
Member
Joined: Sep 2017
Posts: 235
|
Imagine a curve that goes up by two price units in a second, then goes down by one price unit the next second. Repeat that many times. In this situation NumRiseFall will return a streak of one time step for going up as well as going down, suggesting that they be equal, but clearly overall the price is rising on average.
Considering close prices has more random jitter in it, whereas price is the average over the entire bar. Your observation shows that at one bar time-length the price on average is not really random, while below one bar time-length random noise seems to take over.
Time scale of measurements makes the difference here, I think.
And yes, it is true that Close prices are also equally spaced in time compared to price. Still, the difference is that price takes into account a collection of many measurements within a bar, while close is just a single measurement - which is enough to enlarge noise to signal.
Last edited by Hredot; 02/18/18 18:31.
|
|
|
Re: Random walk vs Real price statistic
[Re: kujo]
#471078
02/18/18 20:40
02/18/18 20:40
|
Joined: Dec 2017
Posts: 129 Halifax, NS
kujo
OP
Member
|
OP
Member
Joined: Dec 2017
Posts: 129
Halifax, NS
|
Jcl, in your book you write: With a probability slightly above randomness – about 52%, dependent on the observed price curve – the price will also rise during the third bar, allowing us to sell at a profit. Is this already the path to quick riches? Unfortunately not – even if we could eliminate all trading costs. The markets deny too easy profits. The 48% losing trades lose a bit more than the 52% winning trades, this way equalizing profit and loss. You can later test this with simple scripts and different assets. I wonder how you get 52% win rate. My backtest gives me only 49.4% with Spread = Slippage = Commission = 0. I assume it's because I can't enter a trade with an average price (that was used in distribution of price movements statistics above). My script: function run() { set(LOGFILE); StartDate = 2013; EndDate = 2017; BarPeriod = 60; Spread = Slippage = RollLong = RollShort = Commission = 0; vars Price = series(price()); int num = NumRiseFall(Price,20); if (NumOpenLong > 0) exitLong(); if ((num==2) and (NumOpenLong == 0)) enterLong(); } What am I missing? Thank you!
Last edited by kujo; 02/18/18 22:22.
|
|
|
|