Complex Terms

Learn how to create more complex Equihack terms!

You have been encouraged to create your terms from the “middle out.” This is done by entering all needed operators first. This creates a framework where you can then fill in any needed properties and constants. If you are comfortable with that, let’s explore different ways to enter term lines.

Type the entire term at once

Open a new Stock Screener page. You’ll see an empty box. Enter the following formulas directly into the box while carefully observing the use of capital letters and spaces: “PE<10 and mc>7b”. Press Enter. Almost everything we spent the whole first lesson of Equities Lab 101 entering pops up on the screen!

Constructing Terms in Stages

Next, lets say you are intent on entering your term’s arguments from left to right. Or even more challenging, you want to expand an existing argument with some calculation that need boxes for properties and operators. Lets go through the rules and what you will see in order to do this.

A firm grasp of the rules of Equihack grammar will help you tremendously. You already know all the basic players and rules, but now you will arrange them differently. Think of it as constructing a building. Up to now, we have been working off an architect’s plan. What follows is like adding a room on the back of the building, redesigning rooms inside the building, and in some cases, replacing the foundation of the building. Do it with an understanding of the game’s rules: no problem. Do it without the proper knowledge: the building may collapse.

The basics: Equihack consists of numbers and instructions. The numbers come from stock records or constants you enter. The instructions come from a list of 70 or so choices. The numbers, whether called a property, constant, variable, formula, or period of time, hover around the instructions that tell them what to do. We call the instructions “operators”—they lay out the game’s rules.

The 70 or so operators are all listed together in alphabetical order. Like a staff meeting in a hospital, some have long white coats on, others are dressed in multicolored jackets, others are in scrubs, and some have ties on. So it is with Equihack’s operators. Some are like labor, and some are like management. The labor takes action, like adding numbers together. The management defines strategy and tactics, such as sizing relative values and making decisions.

Let’s breakdown the operators into these groups:

  • Arithmetical: add, subtract, multiply, and divide. They are laid out on the screen as number-operator-number in most situations. When they are called to action, they produce a single number (named a variable or formula in some cases, as you will see).
  • Boolean: greater than, less than, equal to, and not greater, less, or equal. They are at the heart of a term and are surrounded by simple numbers or complex calculations on each side of them.
  • Connectors: “and” and “or.” They define how multiple terms are resolved—everything must agree, or just one thing is needed to be true/false. A master connector is usually in place for all arguments that follow, but they can also be scattered among the arguments.
  • Complex connectors: Like the “and” and “or” above, some operators can reside in the top tab and dictate the work done by all the terms below. “Count” and “Sum” are just two examples. We will talk about this more later.

There is no problem replacing an arithmetical operator with another arithmetical operator, a basic Boolean with another basic Boolean, or a connector with another connector. However, things need to be restructured when you try to cross-replace operators—you don’t replace a surgeon with a financial officer in a hospital. If you need a new space for the financial officer, you want to change the hospital’s layout not to disrupt the operating room. So it is with Equihack’s layout.

This is pretty obvious if you are already a multi-lingual computer geek. If you are an expert using other stock screeners where the arguments must fit into an existing grid, this flexibility wasn’t an option before. Because Equihack falls in the middle of the flexibility scale, you have to be careful when asking it to restructure an existing term that has already been approved. Learn to do it correctly, and you will have no problems. Let’s dive in.

As you have seen, there is no problem replacing most properties with other properties. This also applies to all the numerical values, whether they are called constants, variables, or formulas.

An exception to all this is made to let you add more fields to a term. You type over a numerical property with an operator. Equihack accepts it and will call in the construction team to expand the layout of the argument to make everything work.

Here is one scenario from the second lesson’s basic screener: “purchased/sold > 5,” as you may remember. Enter the “isp” in the blank box on a new Stock Screener page and select the institution’s choice. The program automatically gives you the Market Cap property, a “> Boolean”, and a new empty box. The “> Boolean” and empty boxes are assitance from Equihack to help you form a valid term—a complete sentence with a subject, verb, and object.

You are permitted to expand this simple term. The first change needed is to add a divide operator between the Institutions Shares Purchased property and the “> Boolean >”. You want to work on the numerical field, not the Boolean. You want to increase the length of the numerical property by adding a divide operator and the name of another property to be the divisor. This is easy to do, but the first time through may be worrisome to you.

Left-click the box showing Market Cap and enter a /. The property name will disappear. Not to worry. Press return for three new elements (Market_Cap / a blank box).

Now, in the new blank box and select “Shares Sold” to correctly state your desired calculation.

You can split and expand any numerical value this way to create a new calculated value in the screener line. Don’t worry when your work momentarily disappears while the new structure is being created.

You accomplished this by “typing over” the original number’s name with an operator. You could have taken the drop-down menu choice of “insert > insert operator,” which would have moved your focus and cursor to the “Find by” box on top of a list of all operators in the bottom half of your screen. This allows you to search for and double-click on the operator you want or drag it to the box in the term you are expanding. These results are the same as simply typing over the property with your desired operator.

Let’s do it again. Let’s multiply everything by 2. Click on the Purchased value you see. You can add an “*” and a “2” in the empty boxes provided. Equihack automatically surrounds the equations with parentheses in the correct places.

An option that may help is dragging a property from a full box to an empty box. This is helpful if the shown numerator should be the denominator or you want to expand a term to the left. Dragging may bounce back unless you place it carefully in the empty box.

While you may not feel you have gotten very far with all these lessons, rest assured that you have. We are almost ready to set you loose on your Equities lab journey! Before we finish, we hope you will feel ready to begin. The first lesson showed you how to create a basic two-line screener. The second lesson showed you how to analyze and change the results you are getting. Next you were shown how to create more complex terms. Now, we will battle with mixing “and”s and “or”s: another way to expand your terms.

 

Mixing Ands and Ors.

A “term” is normally another line of tests and values in your screener. “Arguments” are all the details in the “term”—the properties, operators, constants, and, most importantly, child terms. If you click the circled green plus icon to the right of the top tab called “Stock Screener,” you can add another “term.”  You saw this in the first two lessons.

Most terms are connected together with either “and” or “or.” When connected with “and”s all the terms must be true for the screener to select a particular stock. If connected by “or”s, stocks will be selected if any of the terms are true.

Click the purple “Match all the following” words at the top. It will open a box with “and” in it. Should you want to connect your terms with an “or,” this is the place to type it. The description will change to “Match any of the following.”

Suppose you want to mix your “and”s and “or”s. You set the top value to one of the words and insert the other choice line-by-line as needed. This lesson will show you how. If you don’t follow the rules carefully, Equihack might misunderstand your request.

Note: you may already know it, but if you don’t like what is created, enter Ctl (or command)+Z to undo your last step. You can undo multiple times working back in history. There are even deeper backup options standing by, ready to help you. We’ll go over that a little later. Another note: You will see that it is possible to have several terms on one line of screener code, while the same thing can be accomplished if each term is on a separate line. Don’t worry, Equihack controls that housekeeping issue—your display may switch from one line to multiple lines for clarity, but the tests remain the same.

Let’s get to work by entering a rather simple-minded two-line screener:

  Market_Cap > 30b

   PE > 75

Equihack will default to connecting these two tests together with “and” shown at the top. Click “GO” to see the results. That tells you something.

What if we want stocks with a very high PEG of 3 too? You could replace the first test with the PEG test, rerun it and combine the results with the PE test by hand. Don’t do that, there’s a better way! Instead, add the PEG test following an “or”; the best of both worlds.

Click the “> Boolean” operator in “PE > 75”. Click “Replace Operator”.

Your cursor will automatically be redirected to the tools tab at the bottom left of the screen.

Type “and” into the search bar of the tools tab. You can either double-click the Operator or click and drag it into your formula. (When you hover over an Operator or Property in the tools tab, notice that it’s definition, along with a link to an example, appears to the right of the tools tab.)

Inserting and Typing Over

Let’s talk about “inserting” and “typing over.” We have been using the word “insert” to enter properties and commands into blank boxes and boxes with question marks to replace something that is already there. There is a difference between using “insert” to replace a number (properties and constants) in a box and the more powerful “insert” operator because operators add more boxes to the term.

To use “insert” in an operator that will create more boxes on the line, do it by:

  • selecting the correct choice on the “insert” drop-down menu,
  • clicking Editor … edit term … (+) add argument(operator),
  • entering Shift-Control-A, or
  • pressing the Insert key.

The Operator being added may result in a new line if your cursor is at the end of the line being worked on (adding a “condition”). The results are the same.

If you “type over” the existing comparison Boolean with an “and” or “or” connector, you won’t get the right results.

Complex Term Reference

Adding Arguments

CONTROL + SHIFT + A – Adds another Operator

Variables and Tabs

The “New Tab” icon in the bottom right of the Editor will create an extra tab, and you will be asked to name it.

Type “Net inc T12M > 0” into the editor in your new tab.

After you create a new tab, you can enter it into the main editor as a variable, using the name of the tab.

For instructions on creating formulas from variables, view this page.

 Cutting and Pasting

We support normal cut/paste operations using the normal keyboard shortcuts and menu items.

We also support cutting multiple terms in a row and then pasting them in a row.

You can also cut a Tab and paste it into the main editor

 Takeaways

You can build up terms, formulas and stock screeners into the complexity you want through time, patience, and experimentation.