# Long-term trading



## dougy (23 January 2010)

Hi all,
As a BuyAndHolder, got slaughtered in 2008 so took an interest in figuring out how to exit in the future in time to salvage some profits.

Came across a longterm Stochastic indicator which I've been testing with Bullcharts and TradeSim on weekly data, with promising ten-year historical results over the All Ords.

BuyAndHolders rarely use stops, and I found that with this exercise, any stop I tried in TradeSim decreased net  profits, win rates, and average profit per trade. But an exit based only on the longterm stochastic worked.

The exercise is contrarian, and very unsophisticated:  Enter long on Monday's open when %k of the stochastic(55,39,3) crossed above 20.  Exit long on Monday's open when %k of the stochastic(55,39,3) crossed below 80.

The exercise pretended I had $204000 capital at the start. Brokerage is $30 per transaction ($60 per round trip). Example 1 invested up to 34 positions maximum at $6000 each. Example 2 (pyramid profits) invested up to 33 positions maximum at 3% of the total capital at the time. Thus with no stop, my risk per position was around 3% of capital, being 100% of each position. Stop Loss purists will have a field day with that!

Trade Sim excludes open trades, so if any were going to be a loss, accumulated profits would be reduced accordingly.  However,balancing that,  virtually no trades would have been entered during 2008.

The Trade Sim simulation results do not include the beneficial impact of dividends which would be received given the longterm holding periods.

I tried different ASX subsets and starting dates to try and pick up different companies, results were always similar. I have just the standard Trade Sim version, so could not attempt a "Monte Carlo" test.

Trade Sim detailed simulation reports for two examples are attached (I hope) in case anyone finds them of interest. Comments and suggestions welcome, especially from any other ASF members who prefer a long-term trading or investing timeframe.

Also, if any members have Trade Sim, and access to other stock exchange data,  would anyone care to test the exercise to see if the results are similar to the ASX All Ords?  I've already tested the NZX, and found it similarly profitable, but far too few transactions to be certain.

dougy


----------



## Wysiwyg (24 January 2010)

> The exercise pretended I had $204000 capital at the start. Brokerage is $30 per transaction ($60 per round trip). Example 1 invested up to *34 positions maximum at $6000 each.*




Hi there. Wondering how you can turn a $6000 share purchase into ...


> Largest Winning Trade/(Date-Time): *$184,899.23* (9/07/2007)



with a swing from 20 to 80 on a weekly stochastic oscillator? Details of that particular company, entry date and entry/exit prices will be fine if you have them. Thanks.


----------



## Wysiwyg (24 January 2010)

I used this formula and on weekly got zero trades but on daily returned the below figures. I can only assume there is a difference of understanding with the $6000 maximum per trade. 
This test was on the All Ords (XAO) constituents,  well ... some may not have been back then. 
	
	



```
PositionQty = 34;
PositionSize = 6000;  
PositionScore = Random();

SetOption ("UsePrevBarEquityForPosSizing", True);
SetTradeDelays (0,0,0,0); 

weekDays = DayOfWeek();

BuyR = weekDays == 1; BuyPrice = Open;
SellR = weekDays == 1; SellPrice = Open;

Buy = Cross(StochD(55,39,3), 20) AND BuyR;
Sell = Cross(80, StochD(55,39,3)) AND SellR;
```


----------



## dougy (24 January 2010)

Wysiwyg said:


> Hi there. Wondering how you can turn a $6000 share purchase into ...
> 
> with a swing from 20 to 80 on a weekly stochastic oscillator? Details of that particular company, entry date and entry/exit prices will be fine if you have them. Thanks.




That was AGS, Alliance Resources Ltd.
Bought at $0.0542 18 Mar 2002, sold at $1.725 9 Jul 2007. Hope the chart is readable, not too sure on upload protocol.
But in real life, I probably wouldn't have entered that investment if there was an alternative opportunity with a company which paid regular dividends.

I do have some reservations on other issues though - particularly the unknown effect of survivorship bias - example - maybe the method would have bought HIH and gone down with the ship.

dougy


----------



## Wysiwyg (24 January 2010)

dougy said:


> That was AGS, Alliance Resources Ltd.
> Bought at $0.0542 18 Mar 2002, sold at $1.725 9 Jul 2007. Hope the chart is readable, not too sure on upload protocol.
> But in real life, I probably wouldn't have entered that investment if there was an alternative opportunity with a company which paid regular dividends.
> 
> ...




Thanks, I checked that trade out and apart from a few spurts the share price languished until July 2005 when it started rising. As you say it would be near impossible to know which stock would do this and to hold through hell and high water would be extremely difficult. 

I like the concept and will incorporate this into my longer term market overview.
Thanks.


----------



## dougy (24 January 2010)

Wysiwyg said:


> I used this formula and on weekly got zero trades but on daily returned the below figures. I can only assume there is a difference of understanding with the $6000 maximum per trade.
> This test was on the All Ords (XAO) constituents,  well ... some may not have been back then.
> 
> 
> ...




There must be some differences in implementing the exercise, but I don't know how to compare them.  Attached file is Trade Sim detailed simulation of the stoch(55,39) applied to 2600 daily bars of the All Ords up to 22 Jan 2010. It was profitable, but not as good as when applied to weekly bars.

dougy


----------



## Wysiwyg (24 January 2010)

dougy said:


> There must be some differences in implementing the exercise, but I don't know how to compare them.  Attached file is Trade Sim detailed simulation of the stoch(55,39) applied to 2600 daily bars of the All Ords up to 22 Jan 2010. It was profitable, but not as good as when applied to weekly bars.
> 
> dougy




Yes I get very mediocre results so I removed the "buy on Monday open" condition and changed the stochd(55,39,3) to stochk(55,39) used ...
1) 34 positions maximum
2) $6000 per position
3) $30 brokerage
4) 28/2/2000 to 22/1/2010
5) All Ords
6) Stochk(55,39) buy cross up 20, sell cross down 80.
7) Set trade delays to 1 day (in reality you buy the day after the signal)
8) Daily 
9) $204k
No matter which way I jig it the results are about 60% winners and about 50k profit. Nothing remotely close to your backtest.


----------



## Wysiwyg (24 January 2010)

Oh I know what is going on now. I have my backtester set to only trade 20% of entry bar volume. This means that I cannot take the whole volume traded that day. "This is to prevent affecting the market with large orders".

I removed this restriction on trade size and I hit very big dollars profit but this is far from reality.


----------



## dougy (24 January 2010)

Wysiwyg said:


> Oh I know what is going on now. I have my backtester set to only trade 20% of entry bar volume. This means that I cannot take the whole volume traded that day. "This is to prevent affecting the market with large orders".
> 
> I removed this restriction on trade size and I hit very big dollars profit but this is far from reality.




Ahaa..  I didn't have a volume filter set in Trade Sim - guess it won't make me a squillionnaire after all.  But have redone the weekly non-pyramid exercise, with a 5% volume filter. (Presumably it's testing weekly volume which is why I settled on 5%).  This reduced the trades executed by 5 down to 74, net profits down to $856k, and largest winner becomes $128k.

But the pyramid exercise was significantly affected: Executed trades down to 49, and net profit down to $1.1m.

Thanks for picking that up.

dougy


----------



## Wysiwyg (25 January 2010)

If you are interested ..... Here are two stock that have crossed up 20 on the Stochastic %K(55,40) , I simplified the 39 SMA to 40. These two could be referenced in the future for profit or loss on the 80 cross down. Trouble is ... we could be waiting years. 

*ASB* :- AUSTAL LIMITED FPO 
Date          :- 22/1/2010
Last Price   :- $2.37

*ATR* :- ASTRON LIMITED FPO
Date          :- 21/1/2010
Last Price   :- $1.805  



P.s.  If you don't want this test on thread then I can have it deleted.


----------



## Wysiwyg (25 January 2010)

Wysiwyg said:


> I simplified the 39 period to 40.



Correction ...This parameter should be period.


----------



## dougy (28 January 2010)

Wysiwyg said:


> If you are interested ..... Here are two stock that have crossed up 20 on the Stochastic %K(55,40) ,
> 
> *ASB* :- AUSTAL LIMITED FPO
> 
> *ATR* :- ASTRON LIMITED FPO




Thanks for the tips - had a look but they weren't giving buy signals on their weekly charts.  Have however bought Ausenco (AAX) as it displayed synchronised buy signals on both the daily and weekly charts. They're guidance is for much-reduced profit this year just ended, but seem to have good potential down the track.  We'll see I guess in due course..

dougy


----------



## Wysiwyg (16 February 2010)

Wysiwyg said:


> If you are interested ..... Here are two stock that have crossed up 20 on the Stochastic %K(55,40) , I simplified the 39 SMA to 40. These two could be referenced in the future for profit or loss on the 80 cross down. Trouble is ... we could be waiting years.
> 
> *ASB* :- AUSTAL LIMITED FPO
> Date          :- 22/1/2010
> ...




Update on share positions:  

*ASB* :- AUSTAL LIMITED FPO 
Date          :- 16/2/2010
Last Price   :- $2.44

Up 7 cents. Stochastic(55,40) %K at 39.50

*ATR* :- ASTRON LIMITED FPO
Date          :- 22/1/2010
Last Price   :- $2.02

Up 21.5 cents. Stochastic(55,40) %K at 46.00

Both up with the banded oscillator holding it's line.


----------



## tech/a (16 February 2010)

Can I suggest you have a look at how the Stochastic oscillator is constructed and what its telling you so that you understand what your looking at.

http://stockcharts.com/school/doku.php?id=chart_school:technical_indicators:stochastic_oscillator

Its nothing more than a representation of a longer timeframe.
Nothing magical Im afraid.


----------



## Wysiwyg (16 February 2010)

dougy said:


> Thanks for the tips - had a look but they weren't giving buy signals on their weekly charts.  Have however bought *Ausenco (AAX)* as it displayed synchronised buy signals on both the daily and weekly charts.
> dougy



Weekly stochastic seems too open to opportunity loss and terrible price per share paid for a long term trade.


----------



## brty (16 February 2010)

Can I suggest you look at liquidity...



> Presumably it's testing weekly volume which is why I settled on 5%






> I have my backtester set to only trade 20% of entry bar volume.




To me those numbers are frighteningly high. It is not when you get in that is vital, but when you want to get out. ATR had a volume of 12,000 for the day today, with only 8 trades. Lack of liquidity means todays price is fairly meaningless.

brty


----------



## Wysiwyg (16 February 2010)

brty said:


> Can I suggest you look at liquidity...
> brty



With this long term trading approach the entries and exits are rare. With Doug's weekly oscillator setting, the swing from OB to OS range is upward of 6 months to over a year. Orders would be filled trading the ASX200/300 I feel.

Agree that large orders could be a problem.


----------



## dougy (17 February 2010)

Wysiwyg said:


> Update on share positions:
> 
> *ASB* :- AUSTAL LIMITED FPO
> Date          :- 16/2/2010
> ...





Maybe I should have bought those ones after all!
AAX has dropped - I paid an average price of $4.157, so your observation ("terrible price"!) is so far right on the button. But I hold now until the long-term stoch completes its cycle.
Also bought RHL - paid $2.30, so far up a little, but again will hold until the cycle completes.

I am basically a Buy-and-Holder, and the only reason for adopting the longterm stoch for entries and exits is because it enables me to know when to give up, or when to take profits.
dougy


----------



## tech/a (17 February 2010)

tech/a said:


> Can I suggest you have a look at how the Stochastic oscillator is constructed and what its telling you so that you understand what your looking at.
> 
> http://stockcharts.com/school/doku.php?id=chart_school:technical_indicators:stochastic_oscillator
> 
> ...




You dont see this post as worthy of consideration or is it that you dont understand what I'm getting at?



> but again will hold until the cycle completes.




Cycle?
What on earth is that about?


----------



## dougy (17 February 2010)

tech/a said:


> Can I suggest you have a look at how the Stochastic oscillator is constructed and what its telling you so that you understand what your looking at.
> 
> http://stockcharts.com/school/doku.php?id=chart_school:technical_indicators:stochastic_oscillator
> 
> ...




Agreed.


----------



## tech/a (17 February 2010)

dougy said:


> Agreed.




Yup you dont know what I'm getting at.

Anyway good luck in your search.


----------



## Wysiwyg (20 December 2010)

Wysiwyg said:


> If you are interested ..... Here are two stock that have crossed up 20 on the Stochastic %K(55,40) , I simplified the 39 SMA to 40. These two could be referenced in the future for profit or loss on the 80 cross down. Trouble is ... we could be waiting years.
> 
> *ASB* :- AUSTAL LIMITED FPO
> Date          :- 22/1/2010
> ...




Well Dougy if you are still around this is the latest on the longer term buy/sell on stochastic crosses. So far so good. 

*ASB* :- AUSTAL LIMITED FPO 
Date          :- 17/12/2010
Last Price   :- $3.30

Up 93 cents (39.24%). Stochastic(55,40) %K at 77.10 and walking the 80 line but not yet a sell.  

*ATR* :- ASTRON LIMITED FPO
Date          :- 17/12/2010
Last Price   :- $2.44 

Up 63.5 cents (35.18%). Stochastic(55,40) %K at 76.86 and also close to the 80 line but not yet a sell.


----------



## Wysiwyg (20 December 2010)

> I simplified the 39 SMA to 40.




I didn't quite understand the Stochastic values.

It should read ... 39 to 40 period to calculate MA of %K. 
So Stochastic %K(55, 40)  

55 = period to determine highest high/lowest low
40 = period to determine MA of %K value


----------



## dougy (22 December 2010)

Wysiwyg said:


> Well Dougy if you are still around this is the latest on the longer term buy/sell on stochastic crosses. So far so good.
> 
> *ASB* :- AUSTAL LIMITED FPO
> Date          :- 17/12/2010
> ...




Knew I should have bought those ones!


----------



## tech/a (22 December 2010)

W

Firstly I have no problems with Longterm trading and a longer term Stochastic is very similar to a n M/A crossover.While in this case you have a profit the exit may never be reached! You would need an EXTREME upthrust over a short period to cross 80---very unlikely.

For balance I include your 2 charts and one of mine with a 67% increase in 14 days.
The Portfolio is shown and its 3rd down 20000 at .4706.
The main thing I want to point out is the time spent in drawdown and the time spent in the trade in total of 12 mths.
Trading is about refining and making the most of our capital.













Just presenting this as food for thought.


----------



## howardbandy (23 December 2010)

Greetings --

I ran the test of the crossover alone against the 500 stocks that are currently components of the S&P 500, from 1/1/2000 through 12/14/2010.  (Because of survivorship bias, the results will over-estimate performance.)  

I consider the Monday part and the portfolio part to be secondary.  If the base algorithm is reasonably profitable, then they can be added.

In AmiBroker:
//	ASF_StochLongTerm.afl

SetTradeDelays (0,0,0,0); 
BuyPrice = Open;
SellPrice = Open;

weekDays = DayOfWeek();

BuyR = 1; //weekDays == 1; 
SellR = 1; //weekDays == 1; 

Buy = Cross(StochD(55,39,3), 20) AND BuyR;
Sell = Cross(80, StochD(55,39,3)) AND SellR;  

----------------------------------------

For the 500 stocks and 11 years:

Median exposure is about 30%
Median Compound Annual Rate of Return (CAR) is about 1%
Median Return While Invested (RAR) is about 3.5%
Median Maximum Drawdown is about 55%
Median CAR/MDD is about 0.02.
Median k-ratio is 0.004.
Median Number of Trades in 11 years is 5.
Median Bars held per trade is about 170.

Whether trading only on Monday adds value or not, my first assessment is:
I am risking drawdowns in the range of 55% to make 1% a year and able to compound my account about every 26 months.

Terminal Wealth Relative, a ratio of final account balance to initial balance is:
TWR = (1+GM)^N
where GM is the geometric mean of the trade, N is the number of trades, and ^ indicates raised to the power.

With holding periods so long and CAR so low, assume GM can be replaced by CAR.

So TWR = (1.01)^5 = 1.051

Assuming the future resembles the past, which is implicit in all our analysis -- fundamental or technical, long term or short.  

My final balance in 11 years will be about 5% higher than my initial balance today, but I will suffer a 55% drawdown somewhere along the way.

I want:
GM to be high.
N to be high.
CAR/MDD greater than 1.0.
k-ratio around 0.10.

The "sweet spot" for a trading system that will be traded to maximize terminal wealth while controlling risk is a holding period of a few days, 50 or more trades per year, and an accuracy rate of 60% or higher.  When possible, add the ability and willingness to use leveraged trading instruments.

Longer holding periods, less frequent trading, and lower accuracy, all make creating a high final balance very difficult, even if the ratio of average amount won to amount lost is high.

I do not consider the system described to be a good system under any circumstances -- swing or long term -- and it certainly cannot be traded in any way that creates a high final balance.

Thanks for listening,
Howard


----------



## Wysiwyg (11 April 2011)

Long term results so far.



> Opening trade prices in January 2010.
> 
> ATR :- ASTRON LIMITED FPO
> Date :- 21/1/2010
> ...




One stock (ATR) crossed down over the stochk 80 line for a closure on the 17 March for a 59 cent gain or a tad under 25% profit. 

ATR :- ASTRON LIMITED FPO
Date :- 17/3/2011
Sell Price :- $2.40

While ASB continues along for a gain of 35% so far

ASB :- AUSTAL LIMITED FPO
Date :- 11/4/2010
Last Price :- $3.21


----------



## tech/a (11 April 2011)

Wysiwyg said:


> Long term results so far.
> 
> 
> 
> ...




Both still open on my charts.
But they weren't below the 20 line in January so I dont understand the trade.
This is ATR




I must be doing something wrong?


----------



## Wysiwyg (11 April 2011)

tech/a said:


> Both still open on my charts.
> But they weren't below the 20 line in January so I dont understand the trade.
> This is ATR
> I must be doing something wrong?




I am using Yahoo OHLC.


----------



## Wysiwyg (11 April 2011)

Wysiwyg said:


> I am using Yahoo OHLC.



As a comparison I have used a Commsec chart above to show the data is extremely similar. Maybe our stochastic indicators are different?


----------



## tech/a (12 April 2011)

Wysiwyg said:


> As a comparison I have used a Commsec chart above to show the data is extremely similar. Maybe our stochastic indicators are different?




Must be.


----------

