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

[amibroker] Re: RSI -Last 5 highest values of the last 200 bars.



PureBytes Links

Trading Reference Links

You may see both top10 and bottom10 in the same graph.

// Highest 10/Lowest 10 from 200
R=RSI();
X0=RSI();Y0=RSI();
L1=LastValue(Cum(1));
N=200;// the lookback period
TOP=10;// the topX calibration
for(K=1;K<=TOP;K++)
{
X1=LastValue(HHV(X0,n));
BAR1=LastValue((ValueWhen(X0==X1,Cum(1)-1)));
X0[BAR1]=-10;
Y1=LastValue(LLV(Y0,n));
BAR2=LastValue((ValueWhen(Y0==Y1,Cum(1)-1)));
Y0[BAR2]=110;
}
COLOR=IIf(X0==-10,colorRed,IIf(Y0==110,colorBrightGreen,colorBlack));
Plot(IIf(Cum(1)>L1-N,R,-1E10),"RSI",COLOR,2);

For easier reading select Scaling : Custom min=0, max=100
Dimitris Tsokakis
--- In amibroker@xxxxxxxxxxxxxxx, "run_for_your_life2003" 
<run_for_your_life2003@xxxx> wrote:
> I read this on the message board but what do I add to the AFL code 
> that it also looks at the lowest low 5 values  of the 200 bars.
> 
> Could anyone tell me what to add so it looks at the lowest 5 RSI 
> values  together with the last 5 highest values of the 200 bars.?
> I'm be using the 50% mark as the zero mark of the RSI.
> 
> Comments with AFL code:
> /*
> 
> Since we paint the top 10 points Outside the loop execution, we 
know 
> all the rest details, when it happened, the respected value, 
Outside 
> the loop, 
> consequently the result is ready for any further use.
> The trick was to find the Highest value, find the bar it happens 
AND 
> then, in the very next step, make this value negative [-10 in the 
> example]. 
> The next cycle of the loop will search for the 2nd Highest value 
etc.
> for other indicators, replace -10 with another, enough negative 
> value, lower than the usual indicator values, to ensure that you 
> will excude this
> bar from the next cycle of the loop. if you do NOT know the 
negative 
> values, a Lowest(Indicator)-1 is enough.
> */
> 
> // Top 5 from 200
> R=RSI();
> L0=RSI();
> L1=LastValue(Cum(1));
> N=200;// the lookback period
> TOP=5;// the topX calibration
> for(K=1;K<=TOP;K++)
> {
> H1=LastValue(HHV(L0,n));
> BAR1=LastValue((ValueWhen(L0==H1,Cum(1)-1)));
> L0[BAR1]=-10;
> }
> Plot(IIf(Cum(1)>L1-N,R,-1E10),"",IIf(L0==-
10,colorRed,colorBlack),2);
> 
>  Title = Name()+"   "+FullName()+
> "  RSI Count=200  Last 5 High = Red (Sell Zone)";


------------------------ Yahoo! Groups Sponsor ---------------------~-->
Buy Remanufactured Ink Cartridges & Refill Kits at MyInks.com for: HP $8-20. Epson $3-9, Canon $5-15, Lexmark $4-17. Free s/h over $50 (US & Canada).
http://www.c1tracking.com/l.asp?cid=6351
http://us.click.yahoo.com/0zJuRD/6CvGAA/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/