Scanning for RVI


Category:
0
0

How can I change the code on the watchlist code listed below to create two scans, one for above 55 RVI and one for below 45 RVI using in the 2-minute, 5-minute, and 10-minute time frames?

Attachments:
Marked as spam
Posted by (Questions: 3, Answers: 1)
Asked on June 11, 2018 2:20 pm
103 views
0
Private answer

First, let’s tell folks where that piece of code came from: https://www.hahn-tech.com/ans/relative-volatility-index-rvi-custom-watch-list/

We do that because we will only be showing the changes in this post. Go to that previous post to get the rest of the code.

First, we delete this line:

AssignBackgroundColor(if RVI > 55 then Color.RED else if RVI < 45 then Color.GREEN else Color.BLACK);

Then we change the plot RVI to def RVI:

def RVI = (rviHi + rviLo) / 2;

Then we add the statements used to scan for above 55 and below 45.

plot scan = RVI > 55;
#plot scan = RVI < 45;

You can only run one of these at a time so we comment one of those statements. Just move the ‘#’ symbol to switch between the two scans.

Apply these changes and you can use this as a Study Filter for whatever time frame that is supported within the scan environment.

Marked as spam
Posted by (Questions: 37, Answers: 4091)
Answered on June 11, 2018 3:43 pm