# Historical Screening Variables - Samples

The concept of Historical Screening Variables is that you can run screens, not only on current data, but also in the past data. This enables a user to for example, actually specify the direction of a trend indicator, as opposed to just screening on its current value. For example, one could not only specify that the RSI 14 is over 70 today, but also that 4 days ago it was under 50, and 8 days ago it was under 40 and so on. You can imagine the unlimited possibilities that go with the powerful and totally unique feature found only in Chartsmart.

When you go to the YOU SPECIFY tab and enter a formula in the
custom formula box
for any of the custom calculated lists, you can try pasting one of the formulas below to see how it works. These are only a few examples and the possibilities are limitless. A few important notes you should remember are:

1) You can use any of the technical variables from our
basic variables
but you cannot use the fundamental variables. Specifically you can put a number value in front of the variable indicating how many trading days ago it was from. You cannot do that with any fundamental variables though.

2) You are required to download our backtest files when you do your daily updates. These contain the historical values of all the variables. There is one backtest file for each trading day. Hence if you use the RSI variable #8RSI14# that would mean you are using the 14 day RSI that we calculated in the backtest file 8 trading days ago. If you in the same formula you used #8H50# then that would be in the same backtest file. When you create your formula Chartsmart tells you which backtest files you will need and it downloads them for you automatically. We post on our site each backtest file for every day going back up to 10 years so you basically can get variables going back every day to 10 years ago.

3) You must always enclose the variable with a # on the left and right side of the variable (ie. #92H50#)

You should watch the following 2 videos to learn how to use historical variables. The first video is on creating your own historical variables and the second video helps show you how to download your backtest files.

Note that you really should watch all the videos under the section called "advanced screening and features" on our videos page for Chartsmart features and functions.

**Increasing RSI -**This simple formula shows how you can set the current RSI to over 60 for example then specifying that on both 5 and 10 days before it did not exceed 50. This way it will be showing an increasing trend.

#rsi14#>60.and.#5rsi14#<50.and.#10rsi14#<50

**Closing price today exceeds the highest closing price in the previous 7 trading days -**This formula shows how you can use the basic variables open, high, low, close, volume, trades and so on to place some vary specific filter criteria.

#close#>max(#1high#,#2high#,#3high#,#4high#,#5high#,#6high#,#7high#)

**MACD crossover after a long period where there was no crossover -**This shows not only a MACD crossover it specifies that 5 days, 10 days, and 15 days ago that the signal line is above the macd line. Though they may have crossed, in most cases this means there will have been no crossover. This usually occurs when a security is on a constant trend downward, possibly making the crossover when it occurs more significant.

(#sig1225#<#exp12#-#exp25#.and.#1sig1225#>#1exp12#-#1exp25#).and.#5sig1225#>(#5exp12#-#5exp25#).and.#10sig1225#>(#10exp12#-#10exp25#).and.#15sig1225#>(#15exp12#-#15exp25#)

**Low stochastic and RSI Plus RSI up 2 days in a row -**Using the regular tech tab you can set the stochastics and rsi ranges below then use a custom calculated list for the custom formula. The custom formula counters the weakness trend in the other 2 criteria (low rsi and stoch) by also specifying the RSI has risen in the last 2 days.

Custom Formula #rsi14#>#1rsi14#.and.#1rsi14#>#2rsi14#

Set stoch (slow D line) = k%=15 the d%=5 line is <=15

Set RSI - Most Recent 14 day RSI value <=30

**Chalkins 21 day Money flow Crossover -**This formula specifies that the current day ch21 is over 0 but on 1, 3, 5, and 7 days before it was always under. This means there was a crossover in the last day plus it likely did not crossover since 7 days ago.

#chaik21#>0.and.#1chaik21#<0.and.#3chaik21#<0.and.#5chaik21#<0.and.#7chaik21#<0

**Formula just below for the CUP and Handle-**This formula looks back about 142 trading days (92+50 days) and then looks for a decrease in value over a period starting 60 trading days ago to 110 trading days ago. The decrease in value must be at least 15% of the highest value in a 50 day period from 110 trading days ago to 50 trading days ago. then the current close is compared to the same period and then the following weeks to determine if the stock has continued to increase in value but has still not reached the handle.

(#92h50#>(1.15*#60H50#)).and.(#92h50#>#CLOSE#).AND.(#CLOSE#>(1.1*#60H50#)).AND.(#8WKC0#>#22WKC0#).AND.(#102WKC0#<#92H50#).AND.(#CLOSE#>#15WKC0#)

**7) Asymptopic Price Decline over 150 trading days -**This formula looks back about 150 trading days then specifies that the price then was at least within 30% of the high of the range, then it specifies that over 75 days ago that it had declined to at least 40% of the range then currently it trades within 30% of the low of the range. Usually this screens out a lot of OTCBB charts. It is a good example though of how you can create your own price patterns.

#150last#/(#150last#-#last#)>.7.and.#75last#/(#150last#-#last#)<.4.and.#last#/(#150last#-#last#)<.3.and.#close#>0

**Declining PE ratio -**ChartSmart pro will let you specify screens for the direction of the PE ratio. For example, the following formula would mean the pe is currently less than 10, 100 days ago it is more than 20 and 200 days ago it is more than 30. Of course relationships can be drawn between the pe ratios and the duration of the trend can be expanded. In ChartSmart, you can check the results by running the screen then clicking on the current day, determine the close and eps off the menu in the upper left, then do the same clicking on the daily chart 100 and 200 trading days prevous to today and if you calculate the pe's you will see the trend.

(#last#/#eps#)<10.and.(#100last#/#100eps#)>20.and.(#200last#/#200eps#)>30.and.#eps#>0

**Constricting 20 day Bollinger Bands -**This formula basically says the bollinger band dif is less than 5 days about by 30% and the same with 10 days ago plus the current top of the bollinger is very close to the top of the range for the day. If you put the daily bollinger band on for 20 days it shows a tightening band close to the volatility on the day. Limited here only by your imagination. Unfortunately because it has to do with calculating the CHANGE in and indicator the pro verison is rqrd. You just need to learn the variables and you can draw any relationships to them.https://www.chartsmart.com/variablespro.html

(#bolup20#-#boldn20#)*1.3<(#5bolup20#-#5boldn20#).and.(#5bolup20#-#5boldn20#)*1.3<(#10bolup20#-#10boldn20#).and.#bolup20#<#low#+(#high#-#low#)*1.2