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

[amibroker] Re: how to trade only top percentile items under multiple criiteria



PureBytes Links

Trading Reference Links

Hi, for lack of any other responses, I'll refer you to post #114739
which may be of some help (though very expensive in your case).

http://finance.groups.yahoo.com/group/amibroker/message/114739

You could potentially modify the persistScores method provided in
that post to take an additional argument to use as the composite name
instead of hard coded to ~Position. That way you could call the
method 3 times; once with "RSI", once with "Price" and once
with "Vol".

e.g.

// Use your own logic for determining what scores to save
Buy = ...
rsiScores = IIF(Buy, RSI(14), 0);
priceScores = IIF(Buy, Close, 0);
volScores = IIF(Buy, Volume, 0);

persistScores("RSI", rsiScores);
persistScores("Price", priceScores);
persistScores("Vol", volScores);

The end result would be that you would have 3 sorted lists of
composites (~Price1 is highest, ~PriceX is lowest) accessible from
your backtester code.

e.g.

~RSI1, ~RSI2, ..., ~RSIX
~Price1, ~Price2, ..., ~PriceX
~Vol1, ~Vol2, ...~VolX

Your backtesting code could count the number of signals held by the
Backtester object at each bar (e.g. say 15), then iterate through
each of the composite lists to find the relative position of the
RSI/Price/Volume of each signal (e.g. price for first signal at bar
matches value held at ~Price5[bar] would suggest that that signal's
price was less than that of 4 other signals (~Price1[bar]...~Price4
[bar]) and the percentile would therefore be (15-4)/15 = 73.3.

You would need to establish some maximum number of signals for which
you were willing to track values in order to put a limit on the
number of composites (i.e. top 50 signals resulting in
~RSI1...~RSI50, ~Price1...~Price50, etc.).

Warning: This will result in a LOT of composites and will be VERY
slow. But, it may get you what you're after. I haven't tried out
this proposal, so make sure you test everything out if you decide
to go with it.

Mike

--- In amibroker@xxxxxxxxxxxxxxx, "loveyourenemynow" 
<loveyourenemynow@xxx> wrote:
>
> Happy 2008 to everyone!!
> 
> Let's say I want to only trade stocks in the top 50% under 3 
different 
> criteria ( volume , price and RSI for example) on any given day.
> I other words I backtest at portfolio level a given strategy and I 
then
> want to see cross-sectional selection effects under different 
ranking
> at the same time.
> Position score would partially achieve the goal (it doesn't give
> direct control over the percentile rank a far as I understand, since
> it is constrained only by number of max position an funds, while the
> number of signals is not fixed, so the top 50% could correspond to
> different numbers on different days).
> 
> I was thinking of creating a multidimensional array for each bar and
> sort it by different raws/columns values but it would be rather long
> and slow I suppose.
> 
> I would also need the number of raw signals on any given day.Can it 
be
> obtained without looping through the signal list, and counting?
> 
> 
> Any suggestion?
> 
> Thanks
> 
> Ly
>




Please note that this group is for discussion between users only.

To get support from AmiBroker please send an e-mail directly to 
SUPPORT {at} amibroker.com

For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/

For other support material please check also:
http://www.amibroker.com/support.html
 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/amibroker/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:amibroker-digest@xxxxxxxxxxxxxxx 
    mailto:amibroker-fullfeatured@xxxxxxxxxxxxxxx

<*> To unsubscribe from this group, send an email to:
    amibroker-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/