SlopeRules Systems Developer

 

SlopeRules is a feature in SlopeCharts which lets you create a trading system using discrete technical rules for entering and exiting positions. It is deliberately designed to be intuitive and very simple to use, and it is closely integrated with the SlopeCharts platform.

To create a rule set, choose SlopeRules from the Tools menu within SlopeCharts. (If you don't have an account yet on Slope of Hope, sign up here to get one so you can use the charts. It's free.)

You will then be presented with a dialog box, with the following components:

  • Name: this dropdown has the names of all the SlopeRules you have made already. You can select any prior SlopeRules, or you can leave it on the default, Create New Rule Set, if you want to make a new set;
  • Take This Action: a dropdown which is either Buy Long or Sell Short;
  • Opening Conditions: this is where you establish the conditions which will open a hypothetical trade;
  • Closing Conditions: this is where you establish the conditions which close your hypothetical trade

The most important component of the dialog box is, of course, the rules themselves. Each rule you create is a simple condition which is either True or False, such as whether the 50-day simple moving average is above the 200-day simple moving average, or whether the Closing Price of a security crosses beneath the 200-day exponential moving average.

By experimenting with different combinations of rules, you can learn what kinds of trading systems appear to produce better results than others.

Next Section

Creating a rule set in SlopeRules first requires you decide whether you're going to create rules for buying ("Buy Long" on the dropdown) or shorting ("Sell Short" on the dropdown). You then establish conditions for what constitutes the opening of a trade.

There are no conditions at first. To create the first condition, click on the Add New Condition hyperlink, and a blank rule appears that looks like this:

The choices available on the left and right dropdowns are identical: they consist of prices (Open Price, High Price, Low Price, and Close Price, the last of which is most commonly used) and indicators (such as CCI, Williams %R, and so on). The dropdown in the middle gives you different ways to compare the left and right values. The idea here is to make something resembling a sentence, such as:

  • Closing Price Crosses Above SMA(50)
  • SMA(50) Crosses Below SMA(100)
  • RSI(14) Crosses Above 30

You can create as many of these conditions as you like, but you must have at least one condition. There is one other important decision to make, which is in the form of this tiny dropdown:

This dictates whether a hypothetical opening trade will be executed if any of the conditions are met, or if and only if all the conditions are satisfied. This is a critically-important distinction, since "All" will tend to be far more constraining than "Any".

Here are a few examples of Opening conditions:

Next Section

You may want to create your own custom value instead of using one of the predefined ones. Choose “Define New Value” from the dropdown of rules.....

....and this dialog box will appear:

It is here you can create your own custom rule. For example, you create a 225-day exponential moving average, you would:

  1. Choose “Moving Average” as the Value Type;
  2. Choose “Exponential’ as the Type
  3. Slide the slider bar until you got to 225 (if you need to nudge the value lower or higher , you can use the left and right arrow keys on your keyboard to fine-tune the number)
  4. Click Save, and that new definition will be immediately available.

If the rule you are building uses an item that needs to be compared to a number, such as Williams %R or RSI, then the right dropdown will allow you to just type in the number directly. Otherwise, you can compare one technical indicator to another technical indicator.

Next Section

Establishing closing conditions is identical to opening conditions. As before, there are no conditions at first. To create the first condition, click on the Add New Condition hyperlink, and a blank rule appears that looks like this:

The choices available on the left and right dropdowns are identical: they consist of prices (Open Price, High Price, Low Price, and Close Price, the last of which is most commonly used) and indicators (such as CCI, Williams %R, and so on). The dropdown in the middle gives you different ways to compare the left and right values. The idea here is to make something resembling a sentence, such as:

  • Closing Price Crosses Above SMA(50)
  • SMA(50) Crosses Below SMA(100)
  • RSI(14) Crosses Above 30

You can create as many of these conditions as you like, but you must have at least one condition. There is one other important decision to make, which is in the form of this tiny dropdown:

This dictates whether the hypothetical trade will be closed if any of the conditions are met, or if and only if all the conditions are satisfied. This is a critically-important distinction, since "All" will tend to be far more constraining than "Any". It is especially useful for closing conditions, and an example will help clarify this.

Let's put together an extremely simple system for buying stocks based on the CCI indicator. Entry when it crosses above -100 and exit when it crosses below +100:

The results are nothing special. Four trades, two of which are winners and two losers. Overall change across the four trades: -3.32%. It's a simple, and lousy, system.

Now let's add one rule which will "force exit" the trade. We will add a new exit criteria which will be triggered if the CCI goes below 0. In other words, if it starts climbing, gets above 0, and then sinks beneath 0, the trade will instantly be exited. Take note that we've selected the ANY from the dropdown, but any of the conditions (of which there are only two) for a close will be sufficient.

How does this change the results? Well, there are five trades now, but four of them are winners and just one is a loser. More importantly, 80% of them are winners, and the overall change is +6.37%. Quite an improvement!

The zoomed-in portion of the chart below shows how a simple "escape valve" like the rule above can help a system dodge the proverbial bullet. Notice how the trade was closed before the stock started really sinking badly.

Here are a few examples of closing conditions:

Next Section

Before you save a set of SlopeRules, it is best to Test it. You should continue adding, deleting, and modifying conditions until you are satisfied with the results, and those results are made possible quickly by the availability of a Test button right inside the dialog box.

After you click it, you will be presented with a dialog box allowing you to subject any particular symbol to your SlopeRules. It will automatically have the symbol of whatever chart you were looking at, but you can change this to a different symbol if you like before you click the OK button.

In a couple of moments, the results of your test will be displayed. It will show the name of the SlopeRules being used, what symbol was used, how many trades were executed, how many of those were winners and losers, and various kinds of percentage results data. It will also show you the individual trades and their returns.

Once you are satisfied with the results of your testing, click Save and give your SlopeRules a name. You might want to name it in such a way as to describe the nature of the ruleset.

Next Section

As a component of the SlopeCharts system, SlopeRules is tightly-integrated to its parent product. To apply SlopeRules to a specific symbol for testing, right-click on any symbol in your watchlist and choose which specific rule set you want to apply.

Your rules will be applied to the entire history available for whatever security you selected, and the outcome will be shown in a Results dialog box. You will see the total number of trades, how many winning and losing trades there were, what percentage of trades were winners, and what their respective and average percentages were. You will also see the entry and exit dates as well as the Profit/Loss for each one. The name of the rule set and the symbol you are using is also shown at the top for the sake of clarity.

You will also be presented with all the trades in graph form, shown as rectangles drawn directly on top of the chart. For long positions, these are shown as green rectangles. This lets you get a sense as to how good your rules are, since you want a rule set that maximizes profit without missing too many opportunities.

For SlopeRules that are short sales, the rectangles appear in red instead.

When you hover your mouse over any given rectangle, the details of that specific hypothetical trade will be shown.

If you want to preserve any of the “trade rectangles”, right click on it and choose “Keep This” and it will be retained like any other drawn object. When you want to erase all the trade rectangles from the chart, just right-click the symbol in the watchlist again and choose:

Next Section

Let's take a step-by-step example as to how a SlopeRules set would be constructed and improved.

When basing rules on indicators, it's important to know which levels and crossover points are important to different indicators. Below, for instance, are some examples of the CCI, RSI, and %R indicators. As you can see, the y-axis values (highlighted on the right) vary quite a bit from study to study.

So let's make a bullish SlopeRules set with the CCI specifically. In order to have a small, tidy set of "hits" for this example, we'll use a very slow CCI with the largest number available for its calculation: 400. So within SlopeCharts we would:

  1. Choose the SlopeRules item from the Tools menu;
  2. I would construct the CCI(400) value by way of the New Value choice on the dropdown menu. I would then add one rule for entering a position (the CCI crossing above the level -50).
  3. Add two rules for exiting a position, both of which also use the CCI(400). One of them is for values above 220, suggesting a powerful move higher. The other is for values crossing below -100, meaning the stock is rolling over and not doing well, thus exiting the trade. Importantly, the "Any" is chosen so that either of these rules will trigger an exit.

Clicking on the Test button and entering AMZN as the test symbol, we get the results below. There are ten trades, 40% of which are winners. The average winning trade is about five times bigger than the average losing trade, so overall the average change per trade is pretty good: 18.86%.

However, let's refine this a little in order to execute trades when the stock is in an uptrend. This will reduce the number of trades but might filter out some of the losers. So we add another rule, highlighted below, which requires that the simple 30-day moving average value be higher than the 50-day moving average value (indicating the stock is generally trending higher).

Using the Test button on AMZN once again, we get different results. Only six trades were executed. Half were winners, half were losers. But notice how much the overall average change has improved: it's up to 33.61%, nearly double the prior amount. This was accomplished with just one simple extra rule.

Examining the SlopeChart for AMZN shows each trade highlighted with a green rectangle. Looking at one of these closely, you can see how the entry was made when both criteria were satisfied. Once the CCI went above 220, the trade was exited with a healthy profit.

Next Section

The notion of "sharing" in SlopeRules is like a two-sided coin. You can share any SlopeRules set you've created with the entire community of Slopers. You can also, on the flip side, copy any SlopeRules which others have made public. The community as a whole contributes to the rule sets available and, over time, can help each other build out superior algorithms.

It all begins with a single button at the bottom of the SlopeRules dialog box: Share. Clicking this permits you to share the selected SlopeRules with everyone else on the Slope of Hope (It should be noted that the companion button, Library, provides an instant view to all the shared rule sets that have been made available by others).

After you click Share, a dialog box appears asking you to provide a description of the rule set. It is not required that you fill this out, but it is often helpful to provide information about the thinking behind your creation, since the name alone is rarely descriptive enough. Once you are ready to publish the selected SlopeRules, click Done.

At that point, that one specific SlopeRules set is visible to others on the system. It is important to note that others cannot alter your SlopeRules. They can only copy its definition at the time you published it. Afterward, they may modify their own copy at their discretion, leaving your original SlopeRules undisturbed.

To see the library of SlopeRules, you can either click the Library button (mentioned above) or right-click anywhere on SlopeCharts and choose this menu item:

Now you can see all the published rule sets, both yours and everyone else's. The columns shown are the SlopeRules names, the user who created each one, whether it is a Long or a Short, the description (if any), and a button. The button will either be Copy (if someone else published it, allowing you to copy that rule into your own database) or Unpublish (if you own it and have decide to make it private again).

There is also a very important button at the bottom of this dialog box called Test, which lets you instantly test all the SlopeRules using the symbol of your choices.

After you click Test, you will have an opportunity to enter a stock symbol you would like to use for the testing (or just use the default SPY). Extra columns will be shown quantifying the percentage of winning trades, the overall gain or loss from each SlopeRules set, the average profit for winners, and the average loss for losers. You can sort based on any of these columns by clicking the column name.

The ability to share and copy SlopeRules within the Slope of Hope community provides everyone a better opportunity to both learn and profit.

Next Section

You can apply a SlopeRules set to the entire contents of a watchlist with just a couple of mouse clicks. First, right-click on the watchlist you would like to test, and then choose the particular SlopeRules set you want to apply:

The system will then apply the SlopeRules to the entire history of each symbol within that watchlist (if the list has a lot of symbols, it could take a while to complete the processing). When it is done, you will be presented with a sortable, searchable results list, packed with information about the success of this particular rule set for each and every symbol. There will also be a prominently-featured hyperlink you can click if you want to get alerts in the future about any fresh "triggers" that take place.

Next Section

There are a couple of methods you can use to be alerted to signals generated by SlopeRules.

The first is after you perform a test against a single watchlist. In order to create an automatic alert from Slope about any of your symbols which are "triggered" by a SlopeRules rule set, start by choosing the watchlist you want to monitor. Right-click on the watchlist, and choose which SlopeRules in your library that you would like to apply.

It will take a while for our systems to process the entire history of each of your symbols through whichever SlopeRules you selected. The bigger the watchlist, the longer it will take. Once it is done, however, you will be presented with the test results list, and at the very top you will see a boldfaced red notification like the one shown here:

As stated, just by clicking that hyperlink, you will tell our servers to run the selected SlopeRules against the selected watchlist and email you with any triggers. The notification instantly changes to indicate that you are now monitoring that watchlist.

At the end of each trading day, our servers will use the updated data for all the watchlists and SlopeRules you have selected and will submit to you an email that tells you the symbol, the rule name, the action (whether an Open or Close) and direction (whether Long or Short) which has been triggered. You are also provided a chart hyperlink which, if clicked, will present to you that chart of that symbol with all the trades highlighted based on that particular SlopeRules set.

You may decide in the future to cease following some of these SlopeRules, and you can manage the list from your own Accounts page (which is also referenced via the blue button shown in the email above). You will see a button on the Accounts page like this:

This button, if clicked, will present to you a customized page like the one below showing the SlopeRules/Watchlist combinations you are using, giving you the opportunity to click Delete for any of them.

If you already know which watchlists you would like monitored by SlopeRules, you can do so directly by going to the SlopeRules Alerts page here. On this page, you can choose any SlopeRules set (either your own or one published by a fellow Sloper) and match it with a watchlist. Once you have picked a pair, click the Add to Alerts button, and that will be added to your monitored SlopeRules.

Do NOT follow this link or you will be banned from the site!