I am trying to do the following:
Get al list of the tickers where Close is higher than the Highest High Value and then rank them according to ROC value.
I have followed the tutorial:
But I can't seem to get the HHV list first. It seems to me that there would be a simple way to filter out the HHV values from the initial list and then rank them based on ROC but can't seem to find it.
Should clarify a bit. Are you trying to just return an exploration or ranking for some backtest?
Close can’t be higher then the highest high value. It can be equal but your list will be very small.
Are you wanting the close to be the highest close over “x” bars?
It is for backtesting yes. For example i want to have the results of all stocks that have their close higher or equal than HHV(Close, X), but i want them ranked by ROC or something else.
Perhaps I’m missing something but from your description, having your hhv(close) in your buy filter and a simple PositionScore based of ROC would do it.
Thats what i have now, but from the backtesting results it seems that It just looks in the top (20) ranked ROC's and looks for tickers with HHV(Close). I first want a list of all HHV(Close) signals and then rank them based on ROC.
@kenmartens perhaps something like this can help get you started in the right direction,
Condition = C >= HHV( C, 50 );
Score = IIf( Condition, ROC( C, 100 ), 0 );
I tested your solution but still seems to be returning the wrong results. Keep shooting thow I will keep testing
First, "SMS style" of writing is not good. You need to elaborate on what you really need and why you claim something is "wrong". Words like that are meaningless. Getting help requires precision in asking questions:
Some people come here and ask single-line SMS-style question (plus sometimes some random code) and expect "solution" without showing any effort made from their side.
Then all the good souls on this forum hopelessly try to figure out "what the heck original poster meant?"
So please follow the tips below so your question is more likely to get proper answer.
How to ask a good question
Follow the forum rules first:
How to use this site Please use the search field in this forum, the…
Secondly, use advice given here:
Continuing the discussion from
How do I learn AFL?:
Many new users with zero programming experience struggle when their formula works incorrectly. Here are few hints that everyone should use to make finding errors easier.
First of all: you have to get insight into what the formula is actually doing, not what you think it does.
Typically new user has no idea what is happening inside. Pretty often you make an assumption that things work one way but in fact they work differently. Do not assume t…
Sorry for the SMS Style of writing.
The solution was actualy in the tutorial i followed all along:
I just had to replace the categories with my HHV_ = HHV(C, 40) and at the end correct the score to:
score = IIf( rank <= 20 && HHV_ == 1, values, 0 );