The idea is: buy dips if the long term trend is up; sell rallies if the long term trend is down. If the long term trend isn't up, don't go long. If the long term trend isn't down, don't go short. The system's positions are aligned with the long term trend, but opposite the shorter term trend.
As I interpret the article, you need intraday data to trade the system. In particular, you need to know today's Low before you can decide whether or not to trade at today's Close. I have perverted / simplified the rules a bit, getting rid of the requirement for intraday data. In my perversion, you run the system code at night, after the close, using EOD data. Then you enter the order before the open the next morning, and you're done. Turn off the computer, leave the house, go out for breakfast, play golf, volunteer at the church, go to your fulltime job, whatever. Beware, the test results in the article assume intraday data; my perversion might give different test results. Don't trade it until you've tested it!
Here's the system, explained in English but not coded for a computer. "Lowest(Low, 6)" is shorthand for "The lowest Low price of the last 6 days" and "Highest(High, 6)" is shorthand for "The highest High price of the last 6 days".
Code: Select all
'''' Rule for Entering Long
IF (today's close was greater than the 200 day SMA of the closes) AND
(position is OUT) THEN
Buy to enter Long tomorrow at Lowest(Low, 6) on a "Close Only, Limit" order
END
'''' Rule for Entering Short
IF (today's close was less than the 200 day SMA of the closes) AND
(position is OUT) THEN
Sell to enter Short tomorrow at Highest(High, 6) on a "Close Only, Limit" order
END
'''' Rule for Exiting Long
IF (position is LONG) THEN
Sell to exit Long tomorrow at Highest(High, 6) on a "Close Only, Limit" order
END
'''' Rule for Exiting Short
IF (position is SHORT) THEN
Buy to cover Short tomorrow at Lowest(Low, 6) on a "Close Only, Limit" order
END