trading strategies – Helping you Master EasyLanguage https://easylanguagemastery.com Helping you Master EasyLanguage Fri, 29 Jul 2022 17:24:49 +0000 en-US hourly 1 https://wordpress.org/?v=6.9.1 https://easylanguagemastery.com/wp-content/uploads/2019/02/cropped-logo_size_icon_invert.jpg trading strategies – Helping you Master EasyLanguage https://easylanguagemastery.com 32 32 Stops – When Not to Use Them https://easylanguagemastery.com/building-strategies/stops-when-not-to-use-them/?utm_source=rss&utm_medium=rss&utm_campaign=stops-when-not-to-use-them https://easylanguagemastery.com/building-strategies/stops-when-not-to-use-them/#comments Mon, 28 Oct 2019 10:00:07 +0000 http://systemtradersuccess.com/?p=3045

Using a stop on a position is a very popular risk management technique used by traders. My research and experience has led me to believe they are appropriate for some – but not all – types of trades. Today I will discuss when I believe they aren’t appropriate.

In Larry Connors' new book, “Short-term Trading Strategies That Work”, he dedicates a chapter to stops. It’s entitled, “Stops Hurt”.  The chapter discusses how Larry’s research team ran hundreds of tests to try and find optimal stop levels. In doing so, they came to the conclusion that for the trades they were looking at, the optimal stop was consistently none at all. In every case they found that instituting stops hurt system performance.

You should keep in mind that Larry Connors trades mean reversion strategies. Much of what I do is mean reversion based also. For instance, the Catapult system which makes up the CBI looks to buy stocks that are undergoing capitulative selling. It enters long positions in stocks or ETFs that are extremely oversold. When I first designed the system in 2005 I went through a massive series of tests to find a way to successfully incorporate stops into the methodology. Like Larry I failed to find a stop technique that would enhance the performance of the system.

I’ve gone through numerous other exercises and found the same thing time and time again. When looking to trade overbought/oversold techniques, stops generally don’t work well. If the system suggests the security should bounce when it drops to $20 and it continues to $18, then it is REALLY overdue for a bounce. Any level of stop ensures you are selling an extremely oversold security that is making a low. Those are buying conditions for oversold systems – not selling conditions.

One stop technique for oversold systems that I will sometimes use that in testing hurts performance less than the other techniques I evaluated is this:

Wait until the security bounces for a bar or two. Look for a higher high, higher low, and higher close – or at least 2 of those 3. Then place a stop under the swing low that was just made. In cases like this even if the security doesn't hit your target exit price, it still ensures that you won’t have to suffer through the entire next leg down. While it seems logical and can sometimes help avoid catastrophic trades in the long run, you’re normally better off just waiting for the mean reversion to occur and exiting at your target level.

Not using stops does not equal not controlling risk. Position sizing becomes very important. Traders could also consider using options to trade their short-term positions. Options provide a natural stop (zero). I wrote a series back in the spring (when the VIX was a lot lower) on how I sometimes use options for my short-term trading. You can find the link here:

While stops do not work well for overbought/oversold trading, they DO work well with breakouts or trend following systems. Traders that buy on a pattern breakout do so because their analysis indicates a trend could emerge in the stock or security they are trading. A reversal back into the base or below it would invalidate the pattern from a technician’s standpoint. Therefore, in such cases I believe a stop is completely appropriate. Once the pattern “fails” you should no longer be in the trade. Of course some people may want to give a little extra leeway rather than putting a stop right at a support point, but even so, there is a point where the breakout simply didn’t take.

For my own breakout trading I tend to use very tight stops. I also tend to show little patience for a trade to work once I enter it. Most successful breakouts have a tendency to work right away, and when the market environment is conducive to breakouts there’s just no point in sitting around with dead wood. I’d rather exit with a small profit or loss and try the next one.

The edge in breakout or trend trading is not in the winning percentage. It’s in the risk/reward. A big winner can gain several hundred percent if it goes on a tear. That makes up for an awful lot of scratches and small losses. As an example, in 2003 I did a lot of breakout trading. Cup & Handles, Flat Bases, High Tight Flags, Double Bottoms, etc. – all based primarily on daily bars. It was a tremendous year for trading breakouts because the ones that took caught fire rather quickly. It was also one of my best market years. Yet, at the end of the year I went back and tallied the percentage of breakout trades I took that “worked”.  In other words, they did better than a very small gain or scratch. My success rate? A little under 15%.  And it was a great year. Why?  Tiny losses and massive gains.

Everyone’s style is different and someone with more patience would likely have had a better win rate, but the win rate wasn’t important. What was important was controlling the losses, and one way to do that was through the use of stops.

-- By Rob Hanna from Quantifiable Edges. Rob Hanna has been a full-time market professional since 2001.  He has served as president of Hanna Capital Management, LLC since that time.  He first began publishing his market views and research in 2003.  From 2003 to 2007 his column “Rob Hanna’s Putting It All Together” could be found twice a week on TradingMarkets.com. In January of 2008 Rob began Quantifiable Edges.  In 2012 Rob opened his 2nd website, Overnight Edges.  Both sites use historical analysis to asses current market action and odds.  Rob utilizes price action, volume, breadth, sentiment, seasonality, liquidity flows and more to conduct his research.  Some of the indicators he uses are well known and publicly available.  Others were created in-house.  His work has been widely referenced and quoted over the years, and is often linked to in blogs, tweets, Stocktwits messages, magazine articles and more.  Below are some other places you may have seen some of Rob’s work.

]]>
https://easylanguagemastery.com/building-strategies/stops-when-not-to-use-them/feed/ 9
Predictive-Model Based Trading Systems, Part 1 https://easylanguagemastery.com/building-strategies/predictive-model-based-trading-systems-2/?utm_source=rss&utm_medium=rss&utm_campaign=predictive-model-based-trading-systems-2 https://easylanguagemastery.com/building-strategies/predictive-model-based-trading-systems-2/#comments Mon, 22 Jul 2013 10:00:29 +0000 http://systemtradersuccess.com/?p=5355

Trading financial instruments in an objective systematic fashion has numerous advantages over subjective approaches:

  • Intelligently designed automated trading systems can and often do outperform human driven trading due to various cognitive biases and emotionalism.
  • An effective data-mining program can discover subtle patterns in market behavior that most humans would not have a chance of seeing.
  • An automated system is absolutely repeatable, while a human-driven system is subject to human whims. Consistency of decision-making is vital long-term profitability. Repeatability is also valuable because it allows examination of trades in order to study operation and perhaps improve performance via signal filtering.
  • Most properly designed automated trading systems are amenable to rigorous statistical analysis that can assess performance measures such as expected future performance and the probability that the system could have come into existence due to good luck rather than true power.
  • Unattended operation is possible.

Automated trading systems are usually used for one or both of two applications. TSSB (Trading System Synthesis and Boosting)  is a state-of-the-art program that is able to generate both applications: (1) a complete, stand-alone trading system which makes all trading decisions and (2) a model which may be used to filter the trades of an existing trading system in order to improve performance. We refer to this as “boosting”. It is often the case that by intelligently selecting a subset of the signals generated by an existing trading system, and rejecting the others, we can improve the risk/reward ratio.

Two Approaches to Automated Trading

Whether the user’s goal is development of a stand-alone trading system or a filtering system to boost the performance of an existing trading system, there are two common approaches to its development and implementation: (1) rules-based (IF/THEN rules proposed by a human) and predictive modeling.

A rules-based trading system requires that the user specify the exact rules that make trade decisions, although one or more parameters associated with these rules may be optimized by the development software. Here is a simple example of an algorithm-based trading system:

IF the short-term moving average of prices exceeds the long-term moving average of prices, THEN hold a long position during the next bar.

The above algorithm explicitly states the rule that decides positions bar-by-bar, although the exact definition of ‘short-term’ and ‘long-term’ is left open. The developer might use software to find moving-average lookback distances that maximize some measure of performance. Programs such as TradeStation® include a proprietary language (EasyLanguage® in this case) by which the developer can specify trading rules.

With the widespread availability of high-speed desktop computers, an alternative approach to trading system development has become feasible. Predictive modeling employs mathematically sophisticated software to examine indicators derived from historical data such as price, volume, and open interest, with the goal of discovering repeatable patterns that have predictive power. A predictive model is essentially a mathematical or logical formulate that relates these patterns to a forward-looking variable called a target or dependent variable, such as the market’s return over the next week. This is the approach used by TSSBand it has several advantages over algorithm-based system development:

  • Intelligent modeling software utilizing machine learning can discover patterns that are so complex or buried under random noise that no human could ever see them.
  • Once a predictive model trading system is developed, it is usually easy to tweak its operation to adjust the risk/reward ratio to suit applications ranging across a wide spectrum. It can obtain a desired trade off between numerous signals with a lower probability of success and fewer signals with a higher probability of success. This is accomplished by adjusting a threshold that converts model predictions into discrete buy and sell signals.
  • Well designed software allows the developer to adjust the degree of automation employed in the discovery of trading systems. Experienced developers can maintain great control over the process and put their knowledge to work creating systems having certain desired properties, while inexperienced developers can take advantage of massive automation, letting the software have majority control.
  • In general, predictive modeling is more amenable to advanced statistical analysis than rules-based system development. Sophisticated analysis algorithms to test the statistical soundness of its discoveries can be incorporated into the model-generating process more easily than they can be incorporated into systems based on human-specified rules.
  • Predictive modeling a well developed mathematical discipline for extracting maximum information from a data set that compliment human intuition. Intuition is able to propose data series and ways of transforming them into a large list of candidate indicators.
  • Predictive modeling, even its simplest form, linear regression is superior to human intuition in selecting the best candidates and combining them into a prediction. There have been over academics 150 studies comparing human experts to statistical models attesting to this fact.

Predictive Modeling

The predictive modeling approach to trading system development relies on a basic property of market price movement: all markets contain patterns that tend to repeat throughout history, and hence can often be used to predict future activity. For example, under some conditions a trend can be expected to continue until the move is exhausted. Under other conditions, a different pattern manifests: a trend is more likely to be followed by a retracement toward the recent mean price. A predictive model studies historical market data and attempts to discover the features that discriminate these two patterns.

The goal of predictive modeling then is finding patterns that repeat often enough to be profitable. Once discovered, the model will be on the lookout for the pattern to reoccur. Based on historical observations, the model will then be able to predict whether the market will soon rise, fall, or remain about the same. These predictions can be translated into buy/sell decisions by applying thresholds to the model’s predictions.

Indicators and Targets

Predictive models do not normally work with raw market data. Rather, the market prices and other series, such as volume, are usually transformed into two classes of variables called indicators and targets. This is the data used by the model during its training, testing, and ultimate real time use. It is in the definition of these variables that the developer exerts his or her own influence on the trading system.

Indicators are variables that look strictly backwards in time. When trading in real time, as of any given bar an indicator will be computable, assuming that we are in possession of sufficient historical price data to satisfy the definition of the indicator. For example, someone may define an indicator called trend as the percent change of market price from the close of a bar five bars ago to the close of this bar. As long as we know these two prices, we can compute this trend indicator. TSSB can compute over a hundred types of indicators that quantify numerous features of market behavior.

Targets are variables that look strictly forward in time. (In classical regression modeling, the target is often referred to as the dependent variable.) Targets reveal the future behavior of the market. We can compute targets for historical data as long as we have a sufficient number of future bars to satisfy the definition of the target. Obviously, though, when we are actually trading the system we cannot know the targets unless we have a phenomenal crystal ball. For example, we may define an indicator called day_return as the percent market change from the open of the next day to the open of the day after the next. If we have a historical record of prices, we can compute this target for every bar except the last two in the dataset. TSSB can compute a variety of target variable types.

In summary, the fundamental idea behind predictive modeling is that indicators may contain information that can be used to predict targets. The task of predictive model is to find and exploit any such information.

Get The Book

Screen Shot 2014-10-19 at 6.36.03 PM

-- By David Aronson

Part 2 of this series can be found here, Predictive-Model Based Trading Systems Part II

David Aronson is a pioneer in machine learning and nonlinear trading system development and signal boosting/filtering. Aronson is Co-designer of TSSB (Trading System Synthesis and Boosting) a software platform for the automated development of statistically sound predictive model based trading systems. He has worked in this field since 1979 and has been a Chartered Market Technician certified by The Market Technicians Association since 1992. He was an adjunct professor of finance, and regularly taught to MBA and financial engineering students a graduate-level course in technical analysis, data mining and predictive analytics. His recently released book, Statistically Sound Machine Learning for Algorithmic Trading of Financial Instruments, is a in-depth look at developing predictive-model-based trading systems using TSSB.

]]>
https://easylanguagemastery.com/building-strategies/predictive-model-based-trading-systems-2/feed/ 18
The Perfect Portfolio? https://easylanguagemastery.com/strategies/the-perfect-portfolio/?utm_source=rss&utm_medium=rss&utm_campaign=the-perfect-portfolio https://easylanguagemastery.com/strategies/the-perfect-portfolio/#comments Mon, 07 Jan 2013 11:00:04 +0000 http://eminiedges.com/wp/?p=1159

I was recently watching a short video hosted by Market Club. This particular video was a presentation on their “Perfect R Portfolio”. The Perfect R Portfolio is a portfolio of four ETFs (SPY, USO, GLD, and FXE) that are traded based upon Market Club’s “Trade Triangles” technology. The system rules are simple and clear. For each trade you dedicate 25% of your trading capital. Go long when you see a green Trade Triangle and close the position on the red Trade Triangle. These green and red signals are actually price levels that allow you to place your buy stop and sell stop orders and wait for the market to fill your orders. These values are updated weekly. It does not get any easier than that. Such a simple greenlight/redlight system can be very appealing. In short, the Perfect R Portfolio is a complete trading system that provides you with exact entry and exit levels.

Because the portfolio contains ETFs, does not trade very often and only takes long positions (there is no shorting in the Perfect Portfolio) it seems suitable for trading in retirement accounts such as a 401K. In fact, I do believe this is what the creators had in mind when developing the system.

How Do They Do It?
When I examined the entry and exit signals over time I came to the conclusion that the Trade Triangles are nothing more than a classic breakout indicator. That is, they simply take the highest high over the past N days to determine when to go long and then determine the lowest low over the past N days to determine when to close that same long position. More specifically in the case for the Perfect R Portfolio, they use a three month channel of price extremes to determine market direction (trend) and use a three week channel to determine entry/exit price levels. Trend trading based upon price channels is well documented and continues to be a valid trading method.

Trend: Three month price extreme.
Signal: Three week price extreme.

The trend component of the system is used to filter out bearish market conditions since the system only goes long. So, during bearish times we are in cash or cash equivalents waiting for the trend change to bullish.

For example, given an ETF we first determine the overall trend. This is done by determining the price extremes based on a monthly chart of the last three bars. A closing price on a daily chart above or below these levels would determine the trend either bullish (daily close above threshold) or bearish (daily close below threshold).

Once the trend is determined a three bar price extreme based on a weekly chart is used to determine when to exit and when to initiate new trades.

When the trend changes from bullish to bearish all trades are closed and we don’t open new long positions until the trend becomes bullish.

It’s that simple. Below is a trade example. Click the image to enlarge it.

TriFrame Portfolio
But how well has the Perfect R Portfolio performed over the years? Well, the portfolio is rather new so they don’t provide much backtesting data. However, I created my own trading system called the TriFrame Portfolio using TradeStation’s EasyLanguage. Now I can backtest and see how well it did in the past. TradeStation’s ability to access several timeframes on a single chart will be required to make this trading system. First, all trades are executed on a daily chart, buy/sell price levels are determined on a weekly chart and trend is determined on a monthly chart. All three of these timeframes can be placed within one chart and accessed by a single TradeStation strategy.

Programmer speaking coming up so be warned.

First I’ll create a workspace with a chart of one of the ETFs used in the Perfect R Portfolio. I’ll select GLD. I will want to place trades on a daily chart so I set my GLD chart to daily price data. Next I want to generate buy/sell signals based upon a weekly chart. To do this I create a sub-chart of GLD to hold weekly price data within my chart. I can then access this data programmatically by referencing “data2” in my Easy Language code. I do the same thing for the monthly timeframe of GLD and can access that data by referencing “data3”.

Data1 = Daily chart
Data2 = Weekly chart
Data3 = Monthly chart

The TriFrame Portfolio will utilize these three timeframes to generate trading signals. Now I can test the system with the four ETFs over the life of each ETF. While TradeStation does have the ability to test a portfolio of ETFs given a single strategy, I have yet to explore this feature. So we’ll have to test each ETF individually. I created four different charts for each of the ETFs. I then added the strategy to each chart and dedicated $100,000 to each chart. The strategy would then trade 25% of the starting equity ($25,000) as indicated by the trading rules above. Profits and losses were accumulated and added to the starting equity after each trade. So how did the trading system do? The table below was created over the life of the ETFs through December 31, 2012. $30 in commissions were ducted per round trip.

FXE

GLD

SPY

USO

Total Net Profit

$2,650

$20,563

$2,883

$11,909

Profit Factor

1.52

2.78

1.25

1.76

Total No Of Trades

20

27

30

18

% Profitable

55%

52%

47%

39%

Avg.Trade Net Profit

$132.48

$760.39

$96.11

$661.62

Return on Capital

2.65%

20.53%

2.88%

11.91%

Annual Rate of Return

0.37%

2.30%

0.32%

1.67%

Totals

Total Return

APR

$37,972

4.66%

So, is this the “perfect portfolio?” While the returns are not spectacular, it’s probably better than the average person’s 401K over the past 6 years or so.  The major benefit of the system is it will get you out of those large bear markets allowing you preserve your capital.

Using Ivy-10 Trading System Rules

What would happen if we took these four ETFs and traded them with the trading logic used with the Ivy-10 trading system? Using ETF Replay I generated the following results.

The ETF SPY was used as a benchmark. We can see this system generated a CAGR of 10.1% with a reasonable drawdown of 16.2%. Like the original trading rules, this system will keep you in cash during those bear markets. However, the total returns and CAGR look a lot better!

]]>
https://easylanguagemastery.com/strategies/the-perfect-portfolio/feed/ 28