how toPlot a three-period RSI of a one-period rate of change (the daily net change).

sanjn84

Active Member
#1
hi
can any seniour here explain plz ,
how to Plot a three-period RSI of a one-period rate of change (the daily net change). in amibroker.
i am reading smart street , in which a stratgery momentum pinball is mentioned , i don't understand how to plot this one , can some body help me plz........
 

johnnypareek

Well-Known Member
#2
Re: how toPlot a three-period RSI of a one-period rate of change (the daily net chang

here it is

HTML:
C=ROC(C,1);
rs=RSI(3);
Plot(rs,"3 RSI of 1 Day ROC",1,1);
Plot(MA(rs,3)," Signal 3 RSI of 1 Day ROC",9,1);
Plot(70,"OB",4,1); 
Plot(30,"OS",5,1); 
Plot(50,"MID",6,1);
enjoy
 

sanjn84

Active Member
#3
Re: how toPlot a three-period RSI of a one-period rate of change (the daily net chang

here it is

HTML:
C=ROC(C,1);
rs=RSI(3);
Plot(rs,"3 RSI of 1 Day ROC",1,1);
Plot(MA(rs,3)," Signal 3 RSI of 1 Day ROC",9,1);
Plot(70,"OB",4,1); 
Plot(30,"OS",5,1); 
Plot(50,"MID",6,1);
enjoy
thanks, jonny sir , u always helps me ........god bless u.....
 
#4
well i am late to a party. dont know if anyone out here. i have a question.

how can i scan/explore the stocks using this in ami with values higher than 70 or below 30 ?
 

asnavale

Well-Known Member
#5
Re: how toPlot a three-period RSI of a one-period rate of change (the daily net chang

here it is

HTML:
C=ROC(C,1);
rs=RSI(3);
Plot(rs,"3 RSI of 1 Day ROC",1,1);
Plot(MA(rs,3)," Signal 3 RSI of 1 Day ROC",9,1);
Plot(70,"OB",4,1);
Plot(30,"OS",5,1);
Plot(50,"MID",6,1);
enjoy

Johnny, that is not correct. C is a reserved symbol in Amibroker language. It stands for Close price. You can not use C as any other variable. Therefore, you can not write C = ROC(C, 1);

In addition, what Sanju asked is 3 period RSI of 1 period ROC of Close. What you have given is 3 period moving average of 3 period RSI of Close.

The correct code is

C-like:
R = RSIa(ROC(C, 1), 3);

Plot(R, "RSI(3) of ROC(1)", color, style,.....);
color, style etc. are as per your choice.

RSI calculates the RSI of Close only, not any other field. RSIa calculates RSI of any field like High, Low, Open, ROC etc.

I hope it is clear.

-Anant
 

trash

Well-Known Member
#6
Johnny, that is not correct. C is a reserved symbol in Amibroker language. It stands for Close price. You can not use C as any other variable. Therefore, you can not write C = ROC(C, 1);
What you are saying is incorrect.

You can assign to OHLC arrays. It is not required for functions like RSI since there is RSIa.
But it may be useful for functions depending on OHLC and not having array arguments e.g. StochK , MACD, ....
and you want a function to calculate using different arrays other than default prices.

If you want to restore original OHLC then all there is required is calling RestorePriceArrays afterwards.
 

asnavale

Well-Known Member
#7
RestorePriceArrays was missing in your code. That is what I meant. It is always a good practice to restore them.

-Anant
 

trash

Well-Known Member
#8
RestorePriceArrays was missing in your code.
I have not posted any code. I am not ID @johnnypareek.

That being said your previous quoted statement was wrong. (And you did not mention any restoring. I did. But even without restoring it is not wrong to assign custom arrays to OHLC e.g. single AFL just plotting/outputting MACD() with custom array.)
 

trash

Well-Known Member
#9
What you have given is 3 period moving average of 3 period RSI of Close.
BTW upper bold one is incorrect too.
It is 3 period MA of 3 period RSI of ROC(C,1);

He was using the same rs variable. And "rs" is not calculating using default Close but ROC(C,1) since latter one is assigned to first one before. The code in post #2 is correct. And with or without using RestorePriceArrays it ouputs same results in both cases.
 

asnavale

Well-Known Member
#10
I have not posted any code. I am not ID @johnnypareek.

That being said your previous quoted statement was wrong. (And you did not mention any restoring. I did. But even without restoring it is not wrong to assign custom arrays to OHLC e.g. single AFL just plotting/outputting MACD() with custom array.)

Sorry for the mix up of IDs.

-Anant
 

Similar threads