Finding Stocks That Haven’t Broken Down in 2022: TradeStation Tutorial
[showmodule id=”58959″]
Most stocks have been sliding along with the broader market this year, but a handful of names haven’t broken down. Today we’ll consider ways to find them using TradeStation’s desktop platform.
The basic goal is to find companies closer to their 200-day moving averages than the broader market. This can be achieved with a simple custom indicator written in EasyLanguage.
We’ll first explain how to use the calculations. The results are listed at the bottom of the article if you want to skip to them.
Using RadarScreen
Let’s begin by opening RadarScreen, the versatile analytic tool introduced in our previous article.
Go to the Apps bar at the top left and click on the RadarScreen logo.
Next import all the members of the S&P 500 by clicking on Data → Add Symbol List → S&P 500.
It will likely default to 5-minute candles. Change this by clicking on “Symbol” in the column header to select all symbols. Then click on the Timeframe menu and select “Daily”.
This columns display a series of values including the most recent price, “Last.” Next we can add the 200-day moving average:
Clicking on Studies → Add Study. A dialog box will appear.
Scroll down the list on the left and select “Mov Avg 1 Line.”
Click the “Add ->” button in the middle to move it into your current list. Then click the “OK” button on the bottom right.
A new column called “Mov Avg 1 Line” will appear, which must be customized:
Right click on the new column header and select Studies → Edit “Mov Avg 1 Line” for All Symbols…
A Customize Indicator dialog box will appear. Chose the “Inputs” tab on the left and change Length to 200.
Click OK.
Creating a Custom Indicator
The steps above will let you see stocks’ last prices and their 200-day moving averages. However they don’t let us easily compare the two.
We can accomplish this by creating a simple custom indicator. Start by opening the EasyLanguage editor from the Apps button at the top of the desktop. This will open as a new program on your computer. Then follow these steps:
In the File menu select New → Indicator
Give it the name “Distance from Mov Avg 1 Line”
Click OK.
In the editor box that appears, paste this code:
Inputs: Length (200) ; // Ask user for MA length, defaulting to 200
plot1(Last/AverageFC( Close, Length)-1) ; // Show price/MA as a decimal
The comments after “//” explain what each line does. First the “Inputs” line will create an option in the same Customize Indicator dialog box used above to change the moving average length. By including (200) in parenthesis, it will default to a length of 200 candles.
The second line does most of the work. Here are the steps it follows:
Plot1: Indicators typically output values using the Plot command. Because they can have have multiple outputs, these commands are numbered Plot1, Plot2, etc. In this case, it tells TradeStation to plot the vales in the parenthesis.
Inside the parenthesis, the calculation is performed.
“Last” is the last price
AverageFC calculates a moving average.
The parameter Close tells it to use closing prices for the history. (You could also use open, high or low.)
“Length” tells it use the value inputted as the length. In this case, it will use 200.
In plain language, this means “calculate the average closing price over the last 200 days.”
The “-1” turns the data into a decimal. The only thing left to do is to make RadarScreen display the value as a percentage:
Click on File → Properties ..
A dialog box will appear. Click on the Grid Style tab. Then set the Category to Percentage and increase the Decimals to 2.
Click OK.
Now you’re ready to finish the study. Hit the F3 key to verify it. This will check the code for errors before it runs on the platform.
Return to your RadarScreen and add the new indicator using the previous steps for Mov Avg 1 Line. It may take a minute to load all the values.
Remember you can change the moving average length by right clicking on the “Distance from Mov Avg 1 Line” column header and customizing the indicator. Going to the the Inputs tab, you will notice the same Length from the code above. Altering this will adjust the number of candles used in the moving average.
Getting the Results
The new column in RadarScreen will show how far each stock is from its 200-day moving average. Double click on the column header to sort results. You can change the width of the column by clicking and dragging on the edges.
Scrolling down the list, you can discover companies within a few percentage points of the average. Some of the notable companies on the list today are shown in the table below:
David Russell is VP of Market Intelligence at TradeStation Group. Drawing on two decades of experience as a financial journalist and analyst, his background includes equities, emerging markets, fixed-income and derivatives. He previously worked at Bloomberg News, CNBC and E*TRADE Financial.
Russell systematically reviews countless global financial headlines and indicators in search of broad tradable trends that present opportunities repeatedly over time. Customers can expect him to keep them apprised of sector leadership, relative strength and the big stories – especially those overlooked by other commentators. He’s also a big fan of generating leverage with options to limit capital at risk.
Money is flowing back into stocks as investors hope for a better inflation report this week. The S&P 500 rose 1.9 percent between Friday, May 3, and Friday, May 10. It was the third straight positive week. More than four-fifths of the index's members advanced,...
Oracle jumped to new highs almost two months ago. Now, after a pullback, the software giant may have found support. The first pattern on today’s chart is the gap higher on March 12 after earnings surprised to the upside. ORCL retraced the move and is starting to...
The stock market is bouncing after a dip. Are any companies stabilizing as sentiment recovers? Today's article will consider a method for discovering potential opportunities. It uses TradeStation's EasyLanguage scripting tool to create a custom indicator, which can...
Leaving TradeStation
You are leaving TradeStation.com for another company’s website. Click the button below to acknowledge that you understand that you are leaving TradeStation.com.
This event is hosted on YouCanTrade. The information for this event is being provided for informational and educational purposes only.
You are leaving TradeStation Securities and going to YouCanTrade. YouCanTrade is an online media publication service which provides investment educational content, ideas and demonstrations, and does not provide investment or trading advice, research or recommendations. YouCanTrade is not a licensed financial services company or investment adviser and does not offer brokerage services of any kind.
TradeStation Securities, Inc. provides support and training channels hosted on YouCanTrade, its affiliate. Other than these support and training channels, any services offered by YouCanTrade are not sponsored, endorsed, sold or promoted by TradeStation Securities and it makes no representation regarding any YouCanTrade goods or services.
To acknowledge you are leaving TradeStation Securities to go to YouCanTrade, please click
This website uses cookies to offer a better browsing experience and to collect usage information. By browsing this site with cookies enabled or by clicking on the "ACCEPT COOKIES" button you accept our Cookies Policy. To block, delete or manage cookies, please visit your browser settings. Restricting cookies will prevent you benefiting from some of the functionality of our website.ACCEPT COOKIES