Australian (ASX) Stock Market Forum

Weekly Portfolio - ASX

@Warr87 it would be wise to read about (State verses Pulse signals)

System One
Check system 1 (EMA Cross) buy criteria - Is your Buy criteria (State or Impulse) ?

Quick comment
"Cross" is an Pulse signal, and ">" is a State signal.

If you use State signals
Using a State signal ">" function you can use the "Exrem" function to eliminate duplicate signals.

Important to remember
1. State form keeps 'true' for many bars
2. Pulse form - Keeps 'true' for one bar only

IMHO
I would avoid any strategy that uses a "Cross function" as the signal is only 'true' for one bar only (on the "CROSS") a State signal holds for more than one bar. Meaning State signal keeps the signal 'true' for many bars.

It makes a difference
To keep signals you have to have them in (State) form as opposed to (Pulse) form because the signal is "true" for only one bar (on the cross)

The MAP strategy
If it was me (I'm not telling you what to do) I wouldn't fiddle with the MAP entry or stalestop (exit) code - all the other parameters go for your life.

Skate.
 
@Warr87 good work on your systems as you appear to be heading in the right direction.

I have a question about exits and in particular trailing stops for you.

Using one of your earlier purchases as an example - also you are still holding this stock so it makes for a practical exercise.

RBL -

Buy on the 9/8/2019 @ 1.395

High on the 15/11/2019 @ 2.08

Now still holding at a loss @ 1.10​

It appears that you have a SL set at 30% on your spreadsheet.

My question is how are you managing this Stop Loss and others? Do you have an Initial Stop Loss then a Trailing Stop ?

From your entry to SP high is approx 50% gain so if you were trailing behind it ( either a % or ATR ) I would have thought that it would have been triggered in late November prior to the gap down in December for approx 30% gain.

The reason I am asking is that I have been guilty on not following my rules because I wanted to maximise profits. Greed and falling for the story of the stock was / is my weakness and the result is holding a stock at a loss for way to long or selling at a loss and taking a hit in my confidence.

Again good luck in the journey and I look forward to following your progress.

Trav.
 
@Warr87 it would be wise to read about (State verses Pulse signals)

System One
Check system 1 (EMA Cross) buy criteria - Is your Buy criteria (State or Impulse) ?

Quick comment
"Cross" is an Pulse signal, and ">" is a State signal.

If you use State signals
Using a State signal ">" function you can use the "Exrem" function to eliminate duplicate signals.

Important to remember
1. State form keeps 'true' for many bars
2. Pulse form - Keeps 'true' for one bar only

IMHO
I would avoid any strategy that uses a "Cross function" as the signal is only 'true' for one bar only (on the "CROSS") a State signal holds for more than one bar. Meaning State signal keeps the signal 'true' for many bars.

It makes a difference
To keep signals you have to have them in (State) form as opposed to (Pulse) form because the signal is "true" for only one bar (on the cross)

The MAP strategy
If it was me (I'm not telling you what to do) I wouldn't fiddle with the MAP entry or stalestop (exit) code - all the other parameters go for your life.

Skate.

@Skate It's a pulse signal. And I wasn't aware of that, but it had actually been something I have been thinking about lately as I have been thinking about the difference between coding something as 'Cross' or '>' or '<'. These days in newer stuff I code, I almost always use the state signal but thats also because I've gotten a little smarter and using other things to confirm a signal (though still very simple as I gravitate towards simplicity as I find it elegant and robust).

As for the MAP strategy, I have been toying more with the exits or filters then anything. The buy signal has been the same. For example, I ran a slightly modified code against the Metals and Mining watchlist (608 symbols in watchlist). I kept the same buy signal as I love the way this buy signal, though simple, catches a lot of quick momentum. What I tinkered with, mostly out of curiosity, is 1) changing the market filter index (believe it or not, I get better results when the market filter was kept to tracking the All Ords), 2) how reactive the market filter was (I made the period smaller and more reactive to turn off given the volitatility in the sector), 3) price filter was set to be below a certain amount, and focused on small securities, but this was offset with 4) with a volume filter to make sure liquidity wouldn't be an issue. Overall it didn't return the same annualised returns on my current MAP strat backtests, but the RAR was much higher and the expected $ per $100 was also ok. I also noticed that the equity curve had a number of spikes and max system DD was not correlated to my current strats (i.e. the maxDD occured at different times to my other strats, and not all equity spikes occured int he same places too). Now, without running some kind of correlation test between the twice, there is some that I can see but not completely.

It was an interesting experiment. Not taken too seriously but I wanted to adapt, tinker, and explore a few things.

@Warr87 good work on your systems as you appear to be heading in the right direction.

I have a question about exits and in particular trailing stops for you.

Using one of your earlier purchases as an example - also you are still holding this stock so it makes for a practical exercise.

RBL -

Buy on the 9/8/2019 @ 1.395

High on the 15/11/2019 @ 2.08

Now still holding at a loss @ 1.10​

It appears that you have a SL set at 30% on your spreadsheet.

My question is how are you managing this Stop Loss and others? Do you have an Initial Stop Loss then a Trailing Stop ?

From your entry to SP high is approx 50% gain so if you were trailing behind it ( either a % or ATR ) I would have thought that it would have been triggered in late November prior to the gap down in December for approx 30% gain.

The reason I am asking is that I have been guilty on not following my rules because I wanted to maximise profits. Greed and falling for the story of the stock was / is my weakness and the result is holding a stock at a loss for way to long or selling at a loss and taking a hit in my confidence.

Again good luck in the journey and I look forward to following your progress.

Trav.

@Trav. Thanks for highlighting that! That is actually just stupidity on my part, and you are right. I should have exited. I didn't have a very good setup on keep tracking on my current trailing stop. I am using excel much better and have a proper spreadsheet now. That mistake has obviously impacted my results, but I'm glad you found it. I will close out that position.

And my sell conditions for system 1 are simply a cross, or a trailing stop of 30%. My initial stop is therefore 30% as well. My other systems have stops that aren't reliant on a cross, but rather a close below a MA.
 
no problems mate

Maybe try the below code in your next back test just to see what different exits do to your performance as I am finding out this area is often neglected.

Code:
//======================================================================|
//                      Trailing Stop Loop                              |
//======================================================================|

Buy = 0; /////////****************Your buy signal will replace this line


Multiplier = 1; //Optimize("Multi", 1, 1, 3, 1);
Period = 21; //Optimize("Period", 21, 8, 25, 1);
LATRStop = Low - (Multiplier * ATR( Period ));
LStopLevel = LATRStop; // Long Stop Level now based of the ATR
LtrailARRAY = Null;
Ltrailstop = 0;

_SECTION_BEGIN( "Long Trailing Stop");
{
for( i = 1; i < BarCount; i++ )
{
   if( Ltrailstop == 0 AND Buy[ i ] )
   {
      Ltrailstop = LStopLevel [ i ] ;  //ATRStop = High - (multiplier x ATR (period))
   }
   else Buy[ i ] = 0; // remove excess buy signals

   if( Ltrailstop > 0 AND Close[ i ] < Ltrailstop)
   {
      Sell[ i ] = 1;
      SellPrice[ i ] = Ltrailstop;
      Ltrailstop = 0;     
   }
   if( Ltrailstop > 0 )
   {   
      Ltrailstop = Max( LStopLevel [ i ], Ltrailstop );
      LtrailARRAY[ i ] = Ltrailstop;
   }
_SECTION_END();
}}

//Plot Triling Stop
Plot( LtrailARRAY,"trailing stop level", colorRed );
 
Thanks mate. I'll give it a go.

As I've mentioned a few times lately, exits seem to be key. It's mentioned here, and on some of the podcasts' I've been listening too. Like every beginner, I started focusing on the entries. As you learn more, you figure out that entries are easy, but when is the best time to leave to maximise profits or let it run then becomes the hardest part. I've contemplated an ATR stop as the ATR is a good basic measure of volatility. Though we need volatility to make profit and the ATR doesn't distinguish between volatility to the upside or downside.

I'm going to try to implement the code. Thanks again mate :).
 
All good mate, I have been experimenting with a stop that ratchets up at key points so not entirely based of the ATR.

ISL = ATR
Trail 1 = target 1 reached
Trail 2 = target 2 reached

so really up to your imagination, tie it into your sector filter etc
 
My later system designs have been utilising dynamic stops based on a market filter. It makes sense on trend following, and I like defining my risk. On a momentum based strategy, though, it doesn't really work. For example, the Ivy Portfolio or Clenow's momentum strategy, you are buying the best performing instruments (in the Ivy Portfolio it would work great using sector ETF's but we don't have the same amount available as the US as they have countless passive (beta) type ETFs). Clenow's is a rotational strategy that can be rebalanced once a month and only holds the top20% of stocks and actually utilises an ATR for sizing (Account Equity * risk [0.001 would be 10basis points]) / ATR = Shares to buy. Keep buying until you run out of money, then each month you check and rebalance your positions. It wouldn't make sense to have a trailing stop in that situation, but your risk is not how wide or tight your TS is but rather how many basis points you wager.

While this is a bit of a tangent, I think it shows how TS only make sense to the system you are designing and the purpose it is in place for. I look to see how others do it though and try and get some good ideas on what might fit better for me.
 
Going back to cross vs < or >
One important factor is how fast you get your money to work
If you use a cross,then you have a single tick to enter, next week cross is over so it takes much longer to start your system and increase your exposure
As Skate says, he wants his soldiers working, not idle so that could be a problem
 
System 1 (EMA Cross Strat):
Week 25:
Buy: None
Sell: None

System 1 is at +4.9%. Quite a change from last week.

upload_2020-1-17_18-3-0.png

System 2 (MAP Strat):
Week 13:
Buy: None
Sell: None

So TGP was sold and replaced with DCN this week. A few new highs this week and so a number of stops are moved up. I'm always happy about locking in some profits. A few positions already held gave new buy signals which I like as it shows continued strength.

Fully invested so no new positions added, but plenty of signals.

This week this strat is at +9.7% for the 13weeks since inception.


upload_2020-1-17_18-5-19.png
 

Attachments

  • upload_2020-1-17_17-53-21.png
    upload_2020-1-17_17-53-21.png
    47.8 KB · Views: 6
I was thinking more about @peter2 's comment about the MAP and Supertrend strategy working great on longer timeframes. I ran my MAP and Supertrend strategy against monthly bars, and it works better than I remembered. Returns were the same, if not better and the expectancy per $100 invested, geometric mean, and MEGAN ratio were all higher than the weekly. Downside was that the CAR/MAD ratio was lower, and yearly returns weren't as smooth (as in the difference between one year and another were rather drastic at times but still good!). Average holding time was 5-6 candles and average annual return of 30%. This is obviously rather respectable! As I've mentioned a few times, I want a system to run in a SMSF and the monthly system could be it so I'm not running 2 weekly systems (one in my personal name and 1 in my SMSF).

No real rush. My current super isn't losing money so I have time to investigate and get the ball rolling sooner or later. Ideally for the start of the next financial year, or even before then.
 
System 1 (EMA Cross Strat):
Week 26:
Buy: WPP
Sell: None

System is at +4.9% since inception. Will be fully invested next week.

upload_2020-1-24_18-33-49.png

System 2 (MAP Strat):
Week 14:
Buy: AVZ
Sell: DCN

More SL's raised on system 2. Currently at +13.5% with the XAO at +5.4% since the system start.

upload_2020-1-24_18-52-39.png

upload_2020-1-24_18-54-41.png
 
Hi Warr87, did you go live on Monday with 8 positions and going to take 12 more this Monday?
If so what was your trade frequency during the backtest?
 
this is for the past 52 bars (1yr)

upload_2020-2-8_18-46-52.png

I didn't expect it to be fully invested by the second week to be honest. This may not have been the best time to start given the coronovirus news, but I wasn't going to try and 'time' my entry into the market. I had made my decision and once the money cleared into my trade account I started.

I will post my trading on the live system as well for others benefits. I hope people found my paper trading helpful. I will likely paper trade more in the future too (I have a few other systems that have great backtest results, similar too, or better than, my MAP strat).
 
Yes. So it finally clicked for me the other week when looking at backtests, and looking at the explosure%, wondering why it wasn't 100% all the time. AB takes my equity and divides by max positions and uses that as a position size. But if I have 20 positions and I have a position that is up 60% and then it finally triggers a sell, and that leaves 1 open position, the system wont put that entire amount into the next position but rather a smaller size (based on equity / max positions).

Overtime my back tests show, say 70%, exposure as not all the money is going back into the next open position. I will be using cash left and open positions as my position sizing in my live system to get 100% exposure.
 
no problems mate

Maybe try the below code in your next back test just to see what different exits do to your performance as I am finding out this area is often neglected.

Code:
//======================================================================|
//                      Trailing Stop Loop                              |
//======================================================================|

Buy = 0; /////////****************Your buy signal will replace this line


Multiplier = 1; //Optimize("Multi", 1, 1, 3, 1);
Period = 21; //Optimize("Period", 21, 8, 25, 1);
LATRStop = Low - (Multiplier * ATR( Period ));
LStopLevel = LATRStop; // Long Stop Level now based of the ATR
LtrailARRAY = Null;
Ltrailstop = 0;

_SECTION_BEGIN( "Long Trailing Stop");
{
for( i = 1; i < BarCount; i++ )
{
   if( Ltrailstop == 0 AND Buy[ i ] )
   {
      Ltrailstop = LStopLevel [ i ] ;  //ATRStop = High - (multiplier x ATR (period))
   }
   else Buy[ i ] = 0; // remove excess buy signals

   if( Ltrailstop > 0 AND Close[ i ] < Ltrailstop)
   {
      Sell[ i ] = 1;
      SellPrice[ i ] = Ltrailstop;
      Ltrailstop = 0;    
   }
   if( Ltrailstop > 0 )
   {  
      Ltrailstop = Max( LStopLevel [ i ], Ltrailstop );
      LtrailARRAY[ i ] = Ltrailstop;
   }
_SECTION_END();
}}

//Plot Triling Stop
Plot( LtrailARRAY,"trailing stop level", colorRed );
Hi trav I had a play around with your code but found the exit price was the trailing stop even though the close was below it.?
 
Hi trav I had a play around with your code but found the exit price was the trailing stop even though the close was below it.?
Could it be that the trailing stop is used intra day, simulating a conditional stop as entered in a broker platform, as per my lame attempt to add SL last week?
 
Hi qldfrog, I'm rather newbie with coding but I can see that the close below the trailing stop triggers the sell but it takes the trailing stop price not the close or next bars open.
 
I see coding that TS in 2 ways:
if (C<TS) then Sell: in that case sellPrice = O(+1)
or
if (L<=TS) then Sell (can be done intraday)
in that case sellPrice = TS is reasonable, I did not see the details of the code;
The second option is what i tested and implemented initially for my SL, and what i meant above
Still not that great results statistically, and you can have falling nice where even if triggered, you sell will be far from the trigger price
The second option is roughly how I test SL in backtest
Hope it helps
 
Top