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!