[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Optimize it!



PureBytes Links

Trading Reference Links

Dear Tomasz,
Thank you for your comment.
My intention was not to apply variable exponential smoothing.
I worked another type of "smoothing", where the value of s1 is 
a function of the two most recent values of stochk(), something
like a weighted moving average.
The first purpose was the example of Optimization.
The second purpose is a bit more interesting.
In bearish Market conditions this "smoothing" is very operative
to reduce losses.
In some stocks, the backtesting Result with stochd() was -74%
and with this "smoothing" and f=0.9 the Result for the same
period was -34%.
This is the new info we can have with Optimizing.
Unfortunately I do not have bullish examples for a long period to
test the operation of "weighted" smoothing.
As for close averages, in many examples the quantity
Wav=[20*C+15*REF(C,-1)+10*REF(C,-2)+5*REF(C,-3)+REF(C,-4)]/51
behaved better than ma or ema or macd, especially in divergences.
I will revert on this type of smoothing later.
Best Regards
Dimitris Tsokakis 

--- In amibroker@xxxx, "Tomasz Janeczko" <amibroker@xxxx> wrote:
> Dear Dimitris,
> 
> Just a short comment:
> if you intention was to apply variable exponential smoothing in 3)
> 
> s1=f*STOCHK()+(1-f)*REF(STOCHK(),-1);
> 
> is NOT the correct way to do this.
> Exponential smoothing is a recurrent function and you would
> need an AMA for that:
> 
> s1=AMA( STOCHK(), f );
> 
> As it internally implements algorithm s1[ bar ] = f * stoch(k) + (1-
f) * s1[ bar - 1 ];
> 
> Best regards,
> Tomasz Janeczko
> ===============
> AmiBroker - the comprehensive share manager.
> http://www.amibroker.com
> 
> ----- Original Message ----- 
> From: Dimitris Tsokakis 
> To: amibroker@xxxx 
> Sent: Monday, August 27, 2001 3:59 PM
> Subject: [amibroker] Optimize it!
> 
> 
> 1. BUY AND SELL LEVELS
> Suppose you work with stochd(14) and you search the best level
> to buy and sell.
> 
> /*Optimized Levels*/
> SELLLEVEL=optimize("SL",70,60,80,1);
> BUYLEVEL=optimize(" BL ",30,20,40,1);
> s1=stochd();
> buy = cross( s1,BUYLEVEL);
> sell = cross( SELLLEVEL,s1);
> buy=exrem(buy,sell);
> sell=exrem(sell,buy);
> 
> For best levels SL=68 and BL=24, you may see with
> 
> BL=24;
> SL=68;
> graph0=stochd();
> graph1=BL;
> graph2=SL;
> graph2style=1;
> graph1barcolor=graph2barcolor=2;
> 
> 2. SHORT TERM, LONG TERM OR MIXED ?
> 
> /*Short and Long term Stochastic*/
> f=optimize("F",0.5,0,1.1,0.1);
> s1=f*stochd(14)+(1-f)*stochd(24);
> buy = cross( s1,30);
> sell = cross( 70,s1);
> buy=exrem(buy,sell);
> sell=exrem(sell,buy);
> 
> A result F=0.3 means that the "best stochastic" for the certain 
stock is
> an average of 30% stochd(14) and 70% stochd(24)
> 
> f=0.3;
> graph0=f*stochd(14)+(1-f)*stochd(24);
> graph1=30;
> graph2=70;
> graph2style=1;
> graph1barcolor=graph2barcolor=2;
> 
> 3. THE BEST STOCHD
> Stochd is a 3 days average of stochk. Is it the best for your 
stock?
> 
> /*The Best Stochd*/
> f=optimize("F",0.5,0,1.1,0.1);
> s1=f*STOCHK()+(1-f)*REF(STOCHK(),-1);
> buy = cross( s1,30);
> sell = cross( 70,s1);
> buy=exrem(buy,sell);
> sell=exrem(sell,buy);
> 
> An optimum result F=0.9 means that the best stochd function is
> 
> f=0.9;
> graph0=f*stochk()+(1-f)*(ref(stochk(),-1);
> graph1=30;
> graph2=70;
> graph2style=1;
> graph1barcolor=graph2barcolor=2;
> 
> and so on. 
> 
> Dimitris Tsokakis
> 
> 
> 
> 
> Yahoo! Groups Sponsor 
> 
> 
> 
> Your use of Yahoo! Groups is subject to the Yahoo! Terms of 
Service.