January 7

28 comments

The Perfect Portfolio?

By Jeff Swanson

January 7, 2013

automated trading, EasyLanguage, TradeStation, trading software, trading strategies, Trend Following

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!

Jeff Swanson

About the author

Jeff has built and traded automated trading systems for the futures markets since 2008. He is the creator of the online courses System Development Master Class and Alpha Compass. Jeff is also the founder of EasyLanguage Mastery - a website and mission to empower the EasyLanguage trader with the proper knowledge and tools to become a profitable trader.

  • Having a problem downloadibg Perfect Portfilio files. Get message: “there nwas a problem sending the command to the program” I have TS 8.8

    Wouls appreciate any help. Thanks!

  • Jeff, two quick questions when you have a little time..no hurry.

    1. I’m using the PRP to trade Futures( Russell, emini gold). Seems to work fine. You see ant reason not to?

    2. Your code provides for system to enter New Bear Market, but in practice it never does. Is there somethig in the code that needs to be changed so system goes short when market conditions indicate?

    Thanks

    Rafael

    • Rafael,

      1) It should trade fine on futures. The only slight problem would be when it prints the event log. Currently it reports all prices only to two decimals. Some futures contracts, such as EC, go well beyond that and it would not print correctly. However, I don’t see any reason why it would not trade just fine.

      2) Shorting is controlled within TradeStation. If you go under format->strategies you will see the ability to enable or disable short positions. The workspace provided has the short positions disabled. Just change that to allow shorting. If you have trouble finding it, let me know.

  • Rafael,

    Hopefully it wouldn’t inconvenience you too much to attach the code in a .txt (zip). Am very interested, but because of serious security issues with downloads recently and with all the version changes (and OO coming) in TS, etc. have been forced to stop importing ELD’s Posting the code in text would also be helpful to those who might want to port it to other platforms, Many thanks.

  • Really interesting post. Thanks for this. One question though, you say that ” the concept they are using is well known, simple and totally free”, but then the set-up you give requires a $99/mo platform service subscription. At that rate it would be much more cost effective to just go and sign-up for marketclub. Am I missing something here? Are there any open or free platforms to track this you would reccommend as an alternative?

    • The concept that is free is called price channel breakout. You don’t need any software to execute these trades once you understand the underlining concept.

      The TradeStation platform fee is zero dollars if you make more than 10 round trips per month. I don’t pay a fee because I’m a day trader and easily qualify. But the Perfect R Portfolio will not generate nearly that many trades.

      In the simplest form you can simply determine entry levels and exit levels by looking at at a chart. As you know the entry/exit points are simply the highest high or lowest low of the past three weeks. Do this once a week on the weekend and place your orders at your brokerage account. This would get you the same results as with the EasyLanguage code. Also, with only four markets to watch it would not be too much work.

      With Yahoo Finance for End-of-Day historical data, which is free, you could also build an excel spreadsheet to help produce the trade signals as well.

      I don’t have much experience with other charting platforms or brokers, but I do know that Ninja Trader is free and you can import Yahoo Finance for End-of-Day historical data with it.

      Hope this helps.

  • Hello,

    How exactly did you determine the position sizing using the Percent Risk Model in the modified R Portfolio example with a 2% risk per position? I was trying to manually compare the average position of the fixed percentage (25%) to the percent-based approach you suggested (2%). I’m not arguing the validity of the Percent Risk Model but I’m trying to make sure I understand it. To me risk-per-trade can be a number of things including amount invested per position and stop-loss stated as a percent.

    Thanks,
    Flires

    • The 2% Risk Model simply means I will risk no more than a maximum of 2% of my account on any given trade. For a $50,000 account you will risk no more than $1,000 per trade. For a given trade, the risk of the trade is determined from the entry point of a position minus the stop loss. For example, if this value is $5 (entry price minus stop price = $5) we would then determine we would purchase 200 shares ($1,000 / $5 risk per share). Does this help?

  • Yes- thanks Jeff.

    It’s still amazing that you can outperform the 25% exposure in the initial model while risking so much less. I appreciate your response.

    Flires-

  • Thanks, Jeff.

    FYI, I ran it on commodity futures (HG, SI, KC). I had to change the percent risk to 10% to generate trades. @GC was the best, with a profit of $66k. Buy and hold would have been $80k. If the system went short as well, it would have lost $ overall. How much has the long only result been biased by the strong rise in the underlying?

    I am not surprised that ES was a losing system, but it was good to get confirmation of the conventional wisdom that equity futures stopped trending in 1987.

    Bruce

  • Before I comment on ETF Replay, I see the dates of comments to this post are 2010-2011 and yet the original post has a date of 2013. What am I missing here? 🙂

    • This is due to the fact articles are updated with new information and “re-posted” to push them to the top of the chronological queue. Unfortunately, the dates on comments will looks strange. Suppressing the dates on comments might be a good solution.

  • Hi Jeff
    Could you please tell me if there has been any updates on trading the perfect R portfolio, and its profitability?
    also, do you have any details on “price channel breakout” strategy.
    many thanks
    sean

    • It’s been a while since I looked at this article. So, it’s due for an update. For now, I would suggest you review the code and anywhere there is a division calculation, perform a check on the denominator before performing the division calculation. If there is a zero in a denominator you skip the division calculation and use zero as the result. Thus, you avoid the division by zero error. This is something I’ve missed in the original code, but it is a good practice to get into when writing software.

  • I change the code as follows :

    If (TrendHigh + 0.5 ) = 0 then vShares = 100;

    If (TrendHigh + 0.5 0) then
    vShares = IntPortion( Equity*.25 / TrendHigh + 0.5 );

    However, the problem still exist. The open,high, low & close
    prices are same for my data file,will this be the issue not
    generate barnumber data required in the strategy ?

    No problem for tradestation symbol data

  • Should be :

    If (TrendHigh + 0.5 ) = 0 then vShares = 100;

    If (TrendHigh + 0.5 0) then
    vShares = IntPortion( Equity*.25 / TrendHigh + 0.5 );

  • {"email":"Email address invalid","url":"Website address invalid","required":"Required field missing"}

    Learn To Code & Build Strategies
    Using EasyLanguage. 

    >