PureBytes Links
Trading Reference Links
|
Dave and Dimitris,
Is it possible that Dimitri's InspectionPoints approach, or your
Continuous Equity Feedback method could help in the following
situation:
My trade signals are generated by OB/OS indicators in conjunction
with the underlying market trend. Market trend is determined either
by MA crossovers or the one day ROC of a moving average. The problem
of course is what MA to use. One that worked well in 1997 for example
was pretty useless in 1999. This can be seen using the following
simplified code where the MA has been optimized for each year.
period =
IIf(Year() == 1995, 105,
IIf(Year() == 1996, 29,
IIf(Year() == 1997, 143,
IIf(Year() == 1998, 4,
IIf(Year() == 1999, 1,
IIf(Year() == 2000, 25,
IIf(Year() == 2001, 150,
IIf(Year() == 2002, 43,33))))))));
Buy = ROC(MA(C,period),1)>0;
Sell = ROC(MA(C,period),1)<0;
Short=Sell;Cover=Buy;
Run on QQQ with no margin it produces a net% profit of 2677%, but
that is with perfect rear vision. I tried unsuccessfully to modify
your code to handle this (must spend more time with the user guide)
What do you think? Is it worth pursuing?
Keith
--- In amibroker@xxxxxxxxxxxxxxx, "Dave Merrill" <dmerrill@xxxx>
wrote:
> while Demitris' was looking into InspectionPoints, I've been
investigating
> continuous equity feedback as a way of setting parameters for
trading
> indicators. where InspectionPoints test past performance every
specified
> number of days, the code below tests performance for this stock and
adjusts
> parameter settings on every bar. it also skips the trade completely
if no
> parameter combination was profitable. the performance metric used is
> smoothed return over the prior 3 years.
>
> results have been more mixed than I expected. for certain stocks,
it works
> quite while, for many others, not well at all. testing the NASDAQ
100 from
> 1/1/94 to present, 51% of stocks made a profit, 42% lost, and 8%
didn't
> trade at all.
>
> since it does work very well on some stocks, one interesting next
step would
> be to trade it as a ranked portfolio, using past performance as
> PositionScore. however, for PositionScore to have the effect of
selecting
> only stocks that trade profitably this way, there have to be
significantly
> more simultaneous entry signals than available positions. this
requires
> widening the universe of stocks examined well beyond the N100. for
other
> systems I've done using that principle, I used the whole NASDAQ,
but with
> bar by bar optimization of each individual stock, this auto-
optimization
> system is quite slow. the N100 took somewhere upwards of 30 minutes
on my
> 800mHz PIII laptop, so running the whole NASDAQ as a scored
portfolio is out
> of reach for me I think.
>
> anyway, here's the code, for comments, bug finding, and food for
thought.
>
> dave
>
> ===========================
> // CONFIG
> has_min_vol = (MA(v, 50) > 1000000) or (MarketID(1) == "Mutual
Funds");
> is_min_price_long = c > 1;
> is_min_price_short = c > 5;
> equity_lookback_bars = 252 * 3;
> equity_lookback_smoothing = 5;
>
> // SIGNALS
> best_profit = 0;
> best_range = 0;
> best_smoothing = 0;
> for(range = 2; range <= 50; range++) {
> for(smoothing = 2; smoothing <= 50; smoothing++) {
> // calc indicator w those settings
> stoD = StochD(range, smoothing, smoothing);
> stoK = StochK(range, smoothing);
> sig = stoD - stoK;
> // calc buy/sell/short/cover w those settings
> long_signal = Cross(sig, 0);
> short_signal = Cross(0, sig);
> buy = cover = long_signal;
> sell = short = short_signal;
> buy = buy and is_min_price_long and has_min_vol;
> short = short and is_min_price_short and has_min_vol;
> // calc performance w those settings
> e = Equity(0, 0);
> e_ref = Ref(e, -equity_lookback_bars);
> profit = MA((e - e_ref) / e_ref,
equity_lookback_smoothing) * 100;
> // track settings w best performance and resulting
performance
> is_new_best = IIf(profit > best_profit, 1, 0);
> best_profit = IIf(is_new_best, profit, best_profit);
> best_range = IIf(is_new_best, range, best_range);
> best_smoothing = IIf(is_new_best, smoothing,
best_smoothing);
> }
> }
>
> // calc real signals w optimal settings
> stoK =
> MA(100*(C-LLV(L,best_range))/(HHV(H,best_range)-LLV
(L,best_range)),best_smoo
> thing);
> stoD = MA(stoK, best_smoothing);
> sig = stoD - stoK;
>
> // calc buy/sell/short/cover w optimal settings
> long_signal = Cross(sig, 0);
> short_signal = Cross(0, sig);
> buy = cover = long_signal;
> sell = short = short_signal;
> buy = buy and is_min_price_long and has_min_vol;
> short = short and is_min_price_short and has_min_vol;
>
> // don't buy or short unless profitable
> buy = buy and best_profit > 0;
> short = short and best_profit > 0;
------------------------ Yahoo! Groups Sponsor ---------------------~-->
Buy Ink Cartridges or Refill Kits for your HP, Epson, Canon or Lexmark
Printer at MyInks.com. Free s/h on orders $50 or more to the US & Canada.
http://www.c1tracking.com/l.asp?cid=5511
http://us.click.yahoo.com/mOAaAA/3exGAA/qnsNAA/GHeqlB/TM
---------------------------------------------------------------------~->
Send BUG REPORTS to bugs@xxxxxxxxxxxxx
Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
-----------------------------------------
Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx
(Web page: http://groups.yahoo.com/group/amiquote/messages/)
--------------------------------------------
Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
|