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

Re: [amibroker] What a Great Ranking Tool



PureBytes Links

Trading Reference Links

Louis
You have actually been given enough information, perhaps not directly
to the question

Run the ranking afl and save the results into composite symbols
In your backtest code add condition to entry signals that the foreign
composite value is <500

Yes it is best to do as 2 parts because the ranking takes so long it
makes the backtest very long to do

-- 
Cheers
Graham Kav
AFL Writing Service
http://www.aflwriting.com



2008/7/13 Ken Close <ken45140@xxxxxxxxx>:
> You need first to define a function showing distance from 52 week high
>
> FromHigh = hhv(C,252) - c;
>
> Then you need to redefine this
>
>
> mOwnROC = ROC(C, 14);
>
> to mHi = FromHigh;
>
> Then you need to substiture properly into the code.
> If you do not understand the code or how to use it, then trying to modifiy
> it will probably not work.
>
> Ken
> ________________________________
> From: amibroker@xxxxxxxxxxxxxxx [mailto:amibroker@xxxxxxxxxxxxxxx] On Behalf
> Of Louis Préfontaine
> Sent: Friday, July 11, 2008 12:08 PM
> To: amibroker@xxxxxxxxxxxxxxx
> Subject: Re: [amibroker] What a Great Ranking Tool
>
> Hi,
>
> Let's say I want to sort them by how close they are to their 52 weeks high.
> How would you do that?   I am not sure to understand the code.
>
> Thanks,
>
> Louis
>
> 2008/7/6 Ken Close <ken45140@xxxxxxxxx>:
>>
>> Louis:
>>
>> The short answer is Yes.
>>
>> How to do it depends on what you consider Best?
>>
>> Assume Rank is the variable holding the rank value.
>>
>> Then Buy = Rank <= 500 AND some other buying condition.
>>
>> Ken
>> ________________________________
>> From: amibroker@xxxxxxxxxxxxxxx [mailto:amibroker@xxxxxxxxxxxxxxx] On
>> Behalf Of Louis Préfontaine
>> Sent: Saturday, July 05, 2008 10:17 PM
>> To: amibroker@xxxxxxxxxxxxxxx
>> Subject: Re: [amibroker] What a Great Ranking Tool
>>
>> Hi Ken,
>>
>> But is it possible to do this scanning 8000 tickers to find the best 500
>> and automatically includ them in the backtester?  I understand that it is
>> possible to manually select the best one thanks to the ranking, but is it
>> possible to do all this automatically to make the backtest as reliable as
>> possible?
>>
>> Thanks,
>>
>> Louis
>>
>> 2008/7/5 Ken Close <ken45140@xxxxxxxxx>:
>>>
>>> Louis:
>>>
>>> The code needs additional statements added to it before it can be made
>>> into a backtestable system.  The numbers represent ordinal rankings, and you
>>> intuitively think that low ranking values mean "better" symbols.  Well,
>>> depending on what indicators you have chosen, the low value ranks may or may
>>> not be the best ones to buy.  Thus, you really need to think of a set of
>>> conditions which should be in Buy situations and which should be in Sell
>>> situations.  Another way to backtest such a system is to set up a Rotational
>>> Trading model and use the Rank as the PositionScore.  Even in this, you have
>>> to alter the ranking (or reverse it) before it can be a good PositionScore
>>> variable.  There are so many ways to possibily use this kind of ranking to
>>> make a trading system, that more specifics are hard to give.  I know this is
>>> not what you wanted or expected to hear but that is what the situation is.
>>>
>>> HTH,
>>>
>>> Ken
>>>
>>> ________________________________
>>> From: amibroker@xxxxxxxxxxxxxxx [mailto:amibroker@xxxxxxxxxxxxxxx] On
>>> Behalf Of Louis Préfontaine
>>> Sent: Saturday, July 05, 2008 8:17 PM
>>> To: amibroker@xxxxxxxxxxxxxxx
>>> Subject: Re: [amibroker] What a Great Ranking Tool
>>>
>>> Hi everyone,
>>>
>>> This seem interesting.  Is there a way to add this to a backtest so the
>>> backtest would consider let's say the 500 best results?
>>>
>>> I'll try to be more clear: if I can spot a condition for having a symbol
>>> in my watchlist but I want a maximum of 500 tickers in my watchlist, can I
>>> do this by using some ranking that would go automatically in the backtest?
>>>
>>> Thanks,
>>>
>>> Louis
>>>
>>> 2008/7/5 Ken Close <ken45140@xxxxxxxxx>:
>>>>
>>>> Paul Ho has come up with a supurb ranking tool.  I have expanded it to
>>>> two indicators.  Feel free to expand the code structure to any number of
>>>> indicators.
>>>>
>>>> Possible next step: stick the Tot_Rank values into the OI field for the
>>>> symbols, then Plot the Ranks for a visual representation of "where the
>>>> symbol is over time".
>>>>
>>>> The possibilities are endless (or at least enlarged because of Paul's
>>>> code idea).  Thanks Paul for your creative input.
>>>>
>>>> Ken
>>>>
>>>>
>>>> //  Ranking_Alt01.afl    KSC    07/05/2008
>>>>
>>>> //  Original code by Paul Ho, Amibroker list 07/05/2008
>>>>
>>>> //  Modifications and expansions by Ken Close 07/05/2008
>>>>
>>>>
>>>>
>>>> //  Will ordinal rank every symbol in watchlist for every bar.
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> mOwnROC = ROC(C, 14);
>>>>
>>>> mOwnRSI = RSIa(C, 14);
>>>>
>>>> mRoc = 0;
>>>>
>>>> mRSI = 0;
>>>>
>>>> list = CategoryGetSymbols(categoryWatchlist, 16);
>>>>
>>>> ROCcount[0] = rocrank[0] = 0;
>>>>
>>>> RSIcount[0] = RSIrank[0] = 0;
>>>>
>>>> for(i = 0; (sym = StrExtract(list, i)) != ""; i++)
>>>>
>>>>   {
>>>>
>>>>    SetForeign(sym);
>>>>
>>>>    mRoc = ROC(C, 14);
>>>>
>>>>    mRSI = RSIa(C, 14);
>>>>
>>>>    RestorePriceArrays();
>>>>
>>>>    n = !IsNull(mRoc);
>>>>
>>>>    m = !IsNull(mRSI);
>>>>
>>>>    roccount += n;
>>>>
>>>>    rsicount += m;
>>>>
>>>>    rocrank = IIf(Nz(mRoc) > mOwnROC, Rocrank + n, rocrank);
>>>>
>>>>    rsirank = IIf(Nz(mRsi) > mOwnRSI, Rsirank + m, rsirank);
>>>>
>>>>    Totrank = rocrank + rsirank;
>>>>
>>>>   }
>>>>
>>>> ROCn = ROC(C, 14);
>>>>
>>>> RSIn = RSIa(C, 14);
>>>>
>>>> Filter = 1;
>>>>
>>>> Buy = Sell = 0;
>>>>
>>>> AddColumn(ROCn, "ROCn",1.2);
>>>>
>>>> AddColumn(RSIn, "RSIn",1.2);
>>>>
>>>> AddColumn(mRoc, "MROC", 1.2);
>>>>
>>>> AddColumn(ROCrank, "ROCRank", 1.0);
>>>>
>>>> AddColumn(RSIrank, "rsirank",1.0);
>>>>
>>>> AddColumn(Totrank, "Totrank", 1.0);
>>>>
>>>>
>>>>
>>>> //  To check the sorting, run on a watchlist, then click once on the
>>>> date column,
>>>>
>>>> //  Then shift click on one of the indicators, ie, RSIn, and you will
>>>> see the
>>>>
>>>> //  ordinal values in order.
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>
>
> 

------------------------------------

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/