I was going through some exercises in Metastock Primer and I have this question below.
Question: Suppose you
wanted to vary the ROC() function based on the RSI. When the 14-period
RSI is getting near its overbought and oversold regions, the rate of
change might be far more important then when the RSI is in its
mid-ranges. Taking such a premise as truth, you might wish to use a
1-period rate of change in the overbought and oversold ranges and a 3
period rate of change elsewhere. Write a forumla to do this and name it
Variable ROC Average. Use the same 20-Period moving average and treat
values above 70 and below 30 as overbought and oversold ranges.
My answer was this:
If((RSI(14)>70) OR (RSI(14)<30),Mov(ROC(C,1,$),20,S), Mov(ROC(C,3,$),20,S))
This is the correct answer:
Mov((If(RSI(14)>70 OR RSI(14)<30,ROC(C,1,$),ROC(C,3,$))),20,S)
I thought they are logically the same but the graph produced are quite
different. They should be doing MOV(ROC(C,1,$),20,S) if it is RSI(14)>70) OR (RSI(14)<30 else Mov(ROC(C,3,$),20,S) right?
What is the difference between the 2 code? Why did they display differently on the chart? Pls help.