Stocks Could Be Stabilizing. How Do I Find Potential Opportunities?


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 then be used by Scanner.

First, here’s what it will look for:

  • Stocks whose 50-day moving averages are above their 200-day moving averages.
    • This finds companies in longer-term uptrends
  • Stocks within 2 percent of their 100-day moving averages
    • This finds pullbacks
  • Stocks with average option volume of at least 10,000 contracts per day
    • This finds underliers with potentially higher liquidity for options strategies
Microsoft (MSFT), daily chart, showing select moving averages.

Using EasyLanguage

TradeStation customers can create their own indicators using EasyLanguage. (Launch from the app menu at the top of the workspace.) Users can also download this file, which includes a fully built indicator called “Distance from MA.” It determines a stock’s distance from a moving average.

Perusing the code, we see the first two lines defining the inputs and the variables (“Vars”).

Inputs: MA_Len(10), MA_type("Simple"), Show_Absolute("N"); 
Vars: ma(0), ma_dist(0);
  • Inputs are values that users can change using the Customize dialogs on the platform.
  • Vars are variables used to hold data.

The next lines calculate the moving average. It uses conditional logic to know whether the user wants simple or exponential moving averages.

if MA_type = "Exponential" then 
    ma = XAverage(Close, MA_Len);
if MA_type = "Simple" then 
    ma = AverageFC(Close, MA_Len);

The next line calculates the distance between the last price and the moving average.

ma_dist = (Close / ma) - 1;

These lines convert the value to an absolute value if the user wants it. (Upperstr converts to uppercase.):

if Upperstr(Show_Absolute) = "Y" then
    ma_dist = AbsValue(ma_dist);

It then outputs the resulting value with the plot command, using “MA Distance” as the display name:

plot1(ma_dist, "MA Distance"); 
Oracle (ORCL), daily chart, showing select moving averages.

Using Scanner

The Scanner tool is also available under the Apps menu. Users can “Click Create Scan” at the top left and enter a name. We’ll name this one “near 100-day MA” and click the “Next” button.

The following page asks which symbols to include in the scan. We’ll select “All Stocks” and proceed to the next page, which lets us input the key criteria.

  • We’ll first click on the highlighted box <Select Criteria> to open the menu.
  • Scroll down and select “Indicator…” and a dialog box will appear.
  • We’ll scroll down the list and select “Mov Avg 1 Line.”
  • We’ll click on the “Operator” box and select the “greater than sign,” or “>”.
  • The right box under “Field/Value” will highlight. Click to open the menu and scroll down to again select Indicator → Mov Avg 1 Line

This will now find stocks with one moving average above the other. But we need to tell it which moving averages, so we can click on the plus button and set the lengths to 50 and 200. This tells Scanner to find stocks whose 50-day moving averages are above their 200-day moving averages.

Scanner criteria entry. Fields being modified are marked in red.

Scanning for Options

We’ll next add the “Distance from MA” indicator described above.

  • We can click on the + and set MA_Len to 100 and Show_Absolute to “Y”.
  • Set operator to “less than” or “<“.
  • Type 0.02 in the “Field/Value” cell on the right.

This will find stocks within 2 percent of their 100-day moving averages. Show_Absolute ensures values slightly above or slightly below 0 will be included.

Key options data can be added by adding another indicator and this time selecting “Volume – All Opts.”

  • Change VolAll to VolAllAvg
  • Change the Operator to greater than or “>”
  • Change the right field value to 10000

This will find symbols averaging at least 10,000 options contracts in the last 20 sessions. (This length can also be adjusted by clicking on the “+”.) (BKNG), daily chart, showing select moving averages.

Running the Scan

Users can launch the scan by clicking on “Run.” Some results returned yesterday included Microsoft (MSFT), (BKNG) and Oracle (ORCL). These stocks have trended higher over the long run but are more neutral in the shorter term. Options traders might not want to spend money on debit strategies, which require a short-term move to profit. However they could be candidates for income trades like selling put credit spreads. See this page for more.

In conclusion, the market is always changing. Sometimes options traders may want to spend money looking for a move, while other times they may consider neutral strategies to profit from time decays. This article illustrated finding one kind of technical that traders can combine with options. Hopefully it inspires you to use TradeStation’s award-winning platform* to customize indicators and scans to fit your preferences and style for years into the future.

Options trading is not suitable for all investors. Your TradeStation Securities’ account application to trade options will be considered and approved or disapproved based on all relevant factors, including your trading experience. See

Visit for full details on the costs and fees associated with options.

Margin trading involves risks, and it is important that you fully understand those risks before trading on margin. The Margin Disclosure Statement outlines many of those risks, including that you can lose more funds than you deposit in your margin account; your brokerage firm can force the sale of securities in your account; your brokerage firm can sell your securities without contacting you; and you are not entitled to an extension of time on a margin call. Review the Margin Disclosure Statement at

*-Visit to learn more.  

Trade in milliseconds

Explore the most actively traded options

Trade 600+ futures products on an advanced platform

Previous articleStocks Claw Back from Losses as News Shifts and Yields Fall
Next articleChart of the Day: Oracle May Have Found Support
David Russell is Global Head of Market Strategy at TradeStation. Drawing on nearly 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 appraised 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.