April 6, 2020 at 10:10 pm #57583
The Relative Index Comparison function RIC() was used in this tweet to scan for new relative 3 month highs in the S&P500 using the following script in a scan (change the comparison index to that of your market, eg XJO for Australia, FTSE for the UK, or NIFTY for India).123456789//Get relative value - RICR1=RIC(DATESEL=Last Year, INDEX=SPX:WI);C1=CLOSE(R1);// Get highest RIC for last 3 months;H1 = HIGHESTHIGH(C1, BARS=3, BACKTYPE=Months);//Is latest RIC > last 3 months?R1 > H1
When the RIC tool is placed on the chart it will be at its highest point over the last 3 months:
To link a watchlist to a scan and so that it automatically updates see this short video:April 7, 2020 at 1:54 am #57585deepak
- Topics: 41
- Replies: 27
- Posts: 68
ur tweet results are in percentage how ever when i am applying it in workbook its in true false may be because of below command.
//Is latest RIC > last 3 months?
R1 > H1April 7, 2020 at 2:20 am #57587
Thanks Deepak. The column in the tweet is a different measure and a different formula – it’s the performance relative to the SPX over the last 3 months:
RIC(DATESEL=Last Quarter, ZEROBASED=True, INDEX=SPX:WI)/100
February 3, 2021 at 8:08 pm #62215
- This reply was modified 1 year ago by Darren.
To change the RIC() lookback periods to something other than the default Last Month, Last Quarter, etc you can use this trick to set to something else.
The first line finds the date 10 bars ago (2 trading weeks) which is then used in the second line for the Start_Date= field.1234$A = BARDATE();RIC(DATESEL=User Defined, START_DATE=$A, INDEX=SPX:WI, ZEROBASED=True)
You can use this script to build options for all the different time frames you were after by adjusting the value on the first line. So for 6 weeks you’d use a 30 bar (6 x 5 trading days) offset:
$A = BARDATE();
The script can then be used in a Show View tool or Watchlist column:
1 user thanked author for this post.
- You must be logged in to reply to this topic.