.
I repost my question from Yahoo Amibroker Groups title "Why crazy Stochastics results"? Mr Tomasz Janeczko said Stochastics died last century. Mr Janeczko is genius but when he give negative answer it stops other people from posting good help and discussion.
My code is below. I grateful if someone here gives technical explanation of crazy results. Even a link to a site would be fine.
Scenario: I use similar to Buy = StochD < OversoldLimit
Purpose: Optimize OversoldLimit
Expected result: Best results with plateau between 20 and 40. (See fourth screenshot below)
Actual results: Best result is 94 !!! See first screenshot. Second screenshot is slightly rotated. This is very smooth line. No spikes. But I think is impossible. Normal values are 30 for oversold, and 80 for overbought.
Another example. To avoid using my code in case of my errors, I used code from Dr Howard Bandy's book "Quantitative Trading Systems". Figure 10.3. Stochastic of the RSI.
I made one difference. Dr Bandy used crossover of fast/slow. I changed to Buy < oversoldLimit. Optimized. Of course I cannot show this copyright code.
Third screenshot shows 3D chart for Nett Profit v oversoldLimit. Now everything is spikes. Spikes means that indicator or system is not robust. I expect to see similar to fourth screenshot.
I grateful for explanation of these strange results. Is possible that Stochastic crossover still works, but upper and lower limits no longer work?
Thanks
-----------------------------------------
SetOption( "InitialEquity", 999999 ) ; // out of the way
SetOption( "MaxOpenPositions", 9999 ) ; // out of the way
SetPositionSize( 1000, 1 ) ;
SetTradeDelays( 0, 0, 0, 0 );
Buy = Sell = 0 ;
BuyPrice = Open ;
SellPrice = Close ;
Ema100 = EMA( C, 100 ) ;
trendEma100 = ( Ema100 - Ref(Ema100, -5 ) ) ;
trendEma100OK = trendEma100 > 0 ; // 5-day trend rising
// stochastic
lowerLimit = Optimize( "lowerLimit", 20, 0, 100, 2 );
stochSlow = StochD( 14, 3, 3 ) ;
stochSlowOK = stochSlow < lowerLimit ;
BuySignal = trendEma100OK AND stochSlowOK ;
Buy = Ref( BuySignal, -1) ;
buyStop = Ref (H, -1 ) * 1.01 ;
Buy = Buy AND H > buyStop ;
BuyPrice = Max( buyStop, Low );
//n-bar stop for testing
Sell = 0 ;
holdDays = 4 ;
ApplyStop( stopTypeNBar, stopModeBars, holdDays, 1 );
//
.
I repost my question from Yahoo Amibroker Groups title "Why crazy Stochastics results"? Mr Tomasz Janeczko said Stochastics died last century. Mr Janeczko is genius but when he give negative answer it stops other people from posting good help and discussion.
My code is below. I grateful if someone here gives technical explanation of crazy results. Even a link to a site would be fine.
Scenario: I use similar to Buy = StochD < OversoldLimit
Purpose: Optimize OversoldLimit
Expected result: Best results with plateau between 20 and 40. (See fourth screenshot below)
Actual results: Best result is 94 !!! See first screenshot. Second screenshot is slightly rotated. This is very smooth line. No spikes. But I think is impossible. Normal values are 30 for oversold, and 80 for overbought.
Another example. To avoid using my code in case of my errors, I used code from Dr Howard Bandy's book "Quantitative Trading Systems". Figure 10.3. Stochastic of the RSI.
I made one difference. Dr Bandy used crossover of fast/slow. I changed to Buy < oversoldLimit. Optimized. Of course I cannot show this copyright code.
Third screenshot shows 3D chart for Nett Profit v oversoldLimit. Now everything is spikes. Spikes means that indicator or system is not robust. I expect to see similar to fourth screenshot.
I grateful for explanation of these strange results. Is possible that Stochastic crossover still works, but upper and lower limits no longer work?
Thanks
-----------------------------------------
SetOption( "InitialEquity", 999999 ) ; // out of the way
SetOption( "MaxOpenPositions", 9999 ) ; // out of the way
SetPositionSize( 1000, 1 ) ;
SetTradeDelays( 0, 0, 0, 0 );
Buy = Sell = 0 ;
BuyPrice = Open ;
SellPrice = Close ;
Ema100 = EMA( C, 100 ) ;
trendEma100 = ( Ema100 - Ref(Ema100, -5 ) ) ;
trendEma100OK = trendEma100 > 0 ; // 5-day trend rising
// stochastic
lowerLimit = Optimize( "lowerLimit", 20, 0, 100, 2 );
stochSlow = StochD( 14, 3, 3 ) ;
stochSlowOK = stochSlow < lowerLimit ;
BuySignal = trendEma100OK AND stochSlowOK ;
Buy = Ref( BuySignal, -1) ;
buyStop = Ref (H, -1 ) * 1.01 ;
Buy = Buy AND H > buyStop ;
BuyPrice = Max( buyStop, Low );
//n-bar stop for testing
Sell = 0 ;
holdDays = 4 ;
ApplyStop( stopTypeNBar, stopModeBars, holdDays, 1 );
//
.