Rank: Advanced Member
Groups: Registered, Registered Users, Subscribers Joined: 7/25/2005(UTC) Posts: 1,042
Was thanked: 57 time(s) in 54 post(s)
|
Hi Shelley
I could provide you with code that alerts you when the monthly RSI crosses over 70, but what you need to understand is that this a dynamic process. The developing monthly RSI will have 20+ new values for the current month by the time the last daily bar is in place. The RSI might advance and retreat several times before the final monthly value is locked in.
You'll need at least two years of data for approximate RSI(10) values, and for more accurate values, probably 4 to 5 years (still only 48 to 60 monthly bars).
Create an indicator called "Monthly RSI", as below, and set "N" to the appropriate number of periods (months). Check the RSI values from this indicator by plotting it on a monthly chart and overlay it with the drop-down RSI function to verify that it's a good representation of RSI. Note down the last 2 or 3 values.
Now switch to daily periodicity and check the indicator's last 2 or 3 (monthly) values - they should be the same (or at least very close) as the values you noted down. Assuming all is OK, change the X axis a few times (right click in the date area along the bottom of the chart), removing one daily bar from the right of the chart each time. Notice the dynamic nature of the last monthly RSI value - if the daily CLOSE changes so does the last value of the monthly RSI.
If you're happy you can work with that then place "Fml("Monthly RSI")" in your exploration column (without quotes) and run it with a minimum of 500 bars (preferably 1000). Check a few results to make sure that the indicator works on more than just the test chart. If it does then you can refine your exploration to alert you of only the wanted RSI values, whether that be greater than, a crossover, or whatever.
The exploration will run slowly. This is to be expected when 1000 bars of a PREV-based formula are scanned.
Hope this helps.
Roy
MetaStock Tips & Tools
{Monthly RSI}
{© 2006 Roy Larsen, www.metastocktips.co.nz}
{Use with EOD charts}
{User settings}
N:=Input("Monthly RSI Periods",2,99,10);
Q:=Input("Mode, 0=Static 1=Dynamic 2=Delayed",0,2,1);
{0, update at last bar of current month}
{1, update on each new bar}
{2, update on first bar of new month}
{Timing module for monthly frames}
A:=DayOfMonth();
G:=LastValue(Highest(Sum(A>27,5))=5);
M:=G OR Month()<>ValueWhen(2,1,Month());
F:=G OR (M=0 AND PeakBars(1,Zig(A,1,$),1)=0);
A:=LastValue(Cum(1)-1)=Cum(1);
B:=ValueWhen(2,1,A);
J:=If(F,1,If(Alert(F,2)=0 AND M,2,0));
J:=If(A+LastValue(J)>2 OR B+(Q=1)=2,1,J);
J:=If(G,1,If(Q=2 OR Cum(J)<=1,M*2,J));
{CLOSE for monthly frames}
K:=ValueWhen(1,J,If(J=1,C,ValueWhen(2-G,1,C)));
{Plot results}
Pc:=1/N;
Ua:=ValueWhen(1,J>0,K); Da:=ValueWhen(2,J>0,K);
Ub:=If(Ua>Da,Ua-Da,0); Db:=If(Ua<Da,Da-Ua,0);
U:=If(Cum(J>0)=N+1,Cum(If(J AND Cum(1)<>1,Ub,
0))/N,ValueWhen(1,J>0,PREV)*(1-Pc)+Ub*Pc);
D:=If(Cum(J>0)=N+1,Cum(If(J AND Cum(1)<>1,Db,
0))/N,ValueWhen(1,J>0,PREV)*(1-Pc)+Db*Pc);
D:=If(D=0,U,D);
D:=ValueWhen(1,D>0,D);
R:=100-(100/(1+(U/D)));
If(ValueWhen(N+1,J,R)>0,R,R);
|