Australian (ASX) Stock Market Forum

Unholy Grails - Amibroker

Once ur in the analysis window, click onto the 'parameters' and then u can change the 'Parameters- BBO' to any numbers u like.. ..Its easy, even a dumbass like me can do it m8..!

No, that can't adjust the top band to one value and the bottom band to a different value - both bands are set to the same value in the parameters window.

You'd have to write some code to do it. Something like:

Bot = BBandBot(C, 100, 1);
Top = BBandTop(C, 100, 3);
Plot(Bot, "LowerBand", colorRed);
Plot(Top, "UpperBand", colorRed);
Plot(MA(C,100), "CentralMA", colorBlue);
 
Hi I'm new to Amibroker

How do I plot the Bollinger Bands with the different parameters as per UG? I can't seem to change the deviations so the upper bar is 3 and lower bar 1.

Hi IC --

A Bollinger Band is defined as being some number of standard deviations above or below the average. You can "roll your own" by defining what you want the band to be based on (often it is the closing price), computing whatever moving average you want to use and whatever lookback length or window size, whatever window size for the standard deviation, and however many standard deviation units above for the upper band and, separately, however many standard deviation units below for the lower band.

Like this:

// CustomBollingerBands.afl

MALength = 20;
StDevWindow = 20;
UpperBandDistance = 3;
LowerBandDistance = 1;
P = Close;

MiddleBand = MA( P, MALength );
StandardDeviationDistance = StDev( P, StDevWindow );
UpperBand = MiddleBand + UpperBandDistance * StandardDeviationDistance;
LowerBand = MiddleBand - LowerBandDistance * StandardDeviationDistance;

Plot( P, "Price", colorBlack, styleDots );
Plot( MiddleBand, "MidBB", colorBlue, styleLine );
Plot( UpperBand, "UpperBB", colorGreen, styleLine );
Plot( LowerBand, "LowerBB", colorRed, styleLine );

////////////// end ///////////////////

Regards,
Howard
 
Did anyone end up purchasing Nick's BBO system? Care to share any results?

Concrete, I haven't purchased any of Nick's systems but from what I've read the code is quite configurable in terms of parameters for entry, exit, size of bands, length of MAs etc. It may be valid to ask how people have fared on default settings but tricky to compare people that have tweaked.

I found Nick's book the single biggest eye-opener in 20 years of holding and sometime trading shares. I've never seen a publication describe so much intimate detail on the intracacies of trading, not just generalisations. After many many months of backtesting in Amibroker it does appear to the basis of very workable strategy with returns in line with what Nick describes in Unholy Grails. I suspect for anyone unwilling to invest a large amount of time writing and testing a subscription or purchase of Nick's services could be invaluable.

Hmmm, for a long time lurker, I s'pose this as a first time post may be taken with reasonable suspicion anyway :)
 
Concrete, I haven't purchased any of Nick's systems but from what I've read the code is quite configurable in terms of parameters for entry, exit, size of bands, length of MAs etc. It may be valid to ask how people have fared on default settings but tricky to compare people that have tweaked.

I found Nick's book the single biggest eye-opener in 20 years of holding and sometime trading shares. I've never seen a publication describe so much intimate detail on the intracacies of trading, not just generalisations. After many many months of backtesting in Amibroker it does appear to the basis of very workable strategy with returns in line with what Nick describes in Unholy Grails. I suspect for anyone unwilling to invest a large amount of time writing and testing a subscription or purchase of Nick's services could be invaluable.

Hmmm, for a long time lurker, I s'pose this as a first time post may be taken with reasonable suspicion anyway :)
Hi Concrete/Newt

Yes, also long time lurker, first time poster. ;) But just wanted to post to agree with Newt, this is great system. Thanks to Radge (and those on this forum who helped him) in testing a range of systems and putting the results out there into the public arena in such an understandable way for all traders to access.

I have also backtested and got great results -on US and Aus markets (less good on Singapore markets, not sure why - ??). Sliced and diced far more than i need to, but now can trade a tweaked version with great confidence - even in the face of lof the strengths (return) and weakness (dry spells/drawdowns) of this system.

Thanks to Jet for initial post, and so many helpful folk out there on Amibroker forums (including legendary Tomaz himself). While i could have bought the system from Nick, i actually wanted to try building it myself so i understood it (and the cost relative to my paltry starting capital was a bit steep - plan on paying Nick back someday though!)

What i most love about the system is that you can try all sorts of filters and additions, but keep coming back to the basic, stripped back system. Maybe those with more technical knowledge can improve it, but beyond a price filter (I found less than $20 a share in US, less than $10 a share in Aus improves a little, which kinda makes sense re 'growth stocks'), it keeps to the KISS principle of all the good trend following stuff.

My point is that while it has been worth the "journey" for me on Amibroker, if you don't have the time to learn Amibroker and test lots of different stuff, i reckon well worth the price Radge charges for the system (plus Amibroker - cheap as for what it gives - and Norgate subscription).

Still, just my opinion yadda yadda, and not any actual advice :D
 
Hi all,

Another lurker's first post here. Thanks to the initial poster and the replies, this has been a helpful thread for newbies like me.

Did anyone end up solving the problem JackLime was having? From what I can see, the 'Delisted database' Nick Radge refers to seems to be the one JackLime added using the steps below. Feel like I'm missing something frustratingly obvious here.

I emailed Premiumdata about delisted stocks and although they don't officially support delisted stocks for Amibroker due to code overlap issues (Amibroker can't handle a delisted stock and a listed stock with the same symbol), you can add them in with some limitations. When adding the delisted stocks using the method below delisted stocks will take preference where there is a same delisted/listed stock symbol.

To add delisted stocks:
File -> Database Settings
Click Configure
Click Add Folder
Navigate to C:\Trading Data\Stocks\Delisted Securities\ASX\MASTER, Click Retrieve Symbols, OK, OK.

My results for the Bollinger Band System AFL above (1 run, no position score)
Results from XAO (486 symbols)
CAR 15.37% and maxDD 45.06%

Results from XAO and delisted securities. (1508 symbols)
CAR 5.42% and maxDD 25.67%

(Criteria used for delisted securities, 3 character symbols that haven't traded in the last 100days)


To match the results in the book, did people have to manually go through and create appropriate all ords lists as it was reconstituted (quarterly??) over the 97-2011 period? Or just chuck the delisted stocks and current all ords into a watchlist, then backtest (which seems problematic)?

Thanks for the help, hopefully there'll be many posts to come (where I'm not scrambling for answers!).

P.s RobertC72... any advice for someone doing a similar thing to you? I'm hoping to test out the Unholy Grails/other trend following systems then get one up live before too long.
 
for reasons too complicated to go into here, to make this work I need to get hold of a ticker list for either all the delisted securities OR the delisted securities plus current all ords consituents (ie the universe of stocks we are after, abut 1847 stocks).

The easiest way to do this , if someone has a watchlist containing either of those groups, is export the watchlist to a .tls file in notepad, and pm/ email it to me. Then I can use it to create a watchlist here.

So , like, pleeeease help me someone...

thanks
 
If you could believe it, I sat down and in half an hour I had all the delisted in a watchlist. I was a bit dizzy by the end... I ended up with 1080.

I have a watchlist with delisted + the current all ords but, stating the obvious, this will not help you get similar figures to those in the book. You would need an all ords snapshot as at the time of his tests.

Origin tonight so I'll try to get to it but no promises.
 
well it may not get exactly same results as in book, but in the interests of conservatism it will be closer than not including them at all. I suppose I could then do a reconciled list to match the all ords at the time if I can find the data

Tickets to British Lions v the Force tonight, more better :) .... be grateful if you can get round to it sometime though
 
I have been filled, many thanks to two40. :)

My pleasure. However, let's not do the happy dance just yet.

After the game last night (go the Blues) I sat down and had a good look at the list. It seems that there must have been some conflicting symbols because after I imported the delisted ones my All Ords contained 495 symbols.

I ran the maintenance thing which fixed my lists but also removed about 700 symbols from my delisted watchlist.

I emailed Premium Data to see if they have any suggestions on how to import the delisted symbols without causing issues to current symbols.

The only way I can think of doing it is if you import delisted to a blank database, export to cvs(?), export current complete ASX list to cvs, merge and filter duplicate delisted and import remaining delisted. Just throwing out an idea. Does this sound like a plausible method?
 
the issue of conflicting tickers is a known one and I think that is exactly the reason they officially don't support delisted stocks. I don't think there is a work around, so where there is a conflict you live with the current one and 'lose' the old one.

The only work around I can think of is if you could somehow get the data for the old duplicated ones in a database and give them a different unique ticker , which may be kind of what you are suggesting.

For me I don't think its worth chasing it to that extreme. After merging your list of 1080 with the current all ords , I was left with 1551 symbols in the new watchlist, which suggests that there were 29 duplicates out of 1080, which isn't going to make enough difference to whether it 'works' or not to bother with. I am not going to spend any more effort figuring out why there were 1847 in the book either. 1551 is enough for me.

If you are going to run tests on the new data, the first thing I discovered was that if the strat is in a stock at the point it gets delisted, it is locked in there till the end of the test, which means that portion of your equity is frozen, which affects Cagr negatively. First google search turned up this solution; https://www.aussiestockforums.com/forums/showthread.php?t=19923

but after applying it one of my strats has results almost 'too good to be true' , so I am still having a look at whether the looking forward by one bar is unreasonably artificially boosting it

Thanks again for the list, the download worked perfectly

another thing - that maintainence script in AB in mine anyway depopulates all the watchlists and makes all securities 'unassigned', which it isn't supposed to. But it is supposed to remove delisted securities, which we don't want to happen , so between the two of then I wont be running it very often
 
Much like yourself, I'm not too fussed about having a complete set. I'm not collecting Pokemon here. Sorry, poor joke...

I am however concerned with making sure the ones that are there are correct and will provide accurate back testing.


If you are going to run tests on the new data, the first thing I discovered was that if the strat is in a stock at the point it gets delisted, it is locked in there till the end of the test, which means that portion of your equity is frozen, which affects Cagr negatively. First google search turned up this solution; https://www.aussiestockforums.com/forums/showthread.php?t=19923

but after applying it one of my strats has results almost 'too good to be true' , so I am still having a look at whether the looking forward by one bar is unreasonably artificially boosting it

Thanks again for the list, the download worked perfectly

another thing - that maintainence script in AB in mine anyway depopulates all the watchlists and makes all securities 'unassigned', which it isn't supposed to. But it is supposed to remove delisted securities, which we don't want to happen , so between the two of then I wont be running it very often

I was having issues with that as well and did find that piece of code. I was curious how that code would compare to real world situations. My guess, and keep in mind I have very little knowledge of the markets, is that the code does reflect what happens in most situations but far from what would happen in every case. Is this a correct assumption?

Wouldn't everyone that uses delisted securities have to have some kind of code like the one you linked to to close out positions?


I did get a response from Premium Data (very good support I might add). They are looking at ways to implement delisted securities which will be a separate history purchase. ETA roughly 2 months to coincide with their next upgrade.

In my case, when I ran the maintenance it left 332 symbols in my Delisted watchlist.
 
My tests with delisted + XAO and using that code to closeout positions were very positive. Almost too good to believe.

Tests done with just XAO (using a variety of periods) were less impressive.

Leads me to believe that closing out positions like that is the difference...?

Whatever the case, I'm having fun learning. :xyxthumbs
 
I was having issues with that as well and did find that piece of code. I was curious how that code would compare to real world situations. My guess, and keep in mind I have very little knowledge of the markets, is that the code does reflect what happens in most situations but far from what would happen in every case. Is this a correct assumption?

I am no expert but would assume your assumption is about right. In real life some would be mergers that are known well in advance , so no effect. Presumably there may also be some where it came out of the blue and you lost the lot, but wouldn't have thought that happens too often ,especially in a stock enough momentum to be long of in these systems


Wouldn't everyone that uses delisted securities have to have some kind of code like the one you linked to to close out positions?

perhaps but maybe not everyone has done it. There was a post awhile back saying performance dropped dramatically once you added delisted. It does if you don't address the locked in issue soemhow
 
Sounds like I’ve been working through the same thing. I used the delisted stocks provided by premium data. When I spoke to them, they said since mid 2011 a number of obscure delisted entries such have been removed from the list… might explain why we don’t get magic 1847 number. I got 1643 using the PD delisted + XAO, with no conflicting symbols (checked in excel).

Two40... how did you go from the 1143 premium data delisted to 1080?

Hmm... The asx all ords watchlist set by the premium data script includes 500 symbols, S&P says 486, I guess that's splitting hairs.

I ended up getting results are thatwithin the monte carlo range included in the book, I got 26.8% CAR, 35% Max DD... Still frustrating that it doesn't match, but probably acceptable considering the different test universe. Did anyone get similar?

Delisted stocks also improved my results, with the all ords dragging them down. I’ll be interested to see how the system tests on dynamic all ords data when I get around to it.

If your results are dubious, perhaps check you aren't including options etc (more than 3 letters in their symbol), and are using exrem for your signals... at least that's what I got stuck on.
 
I think I might have had a bunch of stuff in my Market 0 before I imported the delisted master which would explain why my number differed. I suspect my original import from PD was not 100% correct and I had not run the maintenance yet.

This morning I started with an up to date list after a maintenance had been performed. I then imported the delisted master. I had 1142 in my Market 0. My all ords were 500. No other checks were made as I recently formatted my PC and do not have excel installed at this stage.

I went through the delisted and deleted any symbol with more than 3 characters. I was left with 964 symbols. Added these to the all ords and you I ended up with 1464.

I did some brief testing and got some decent results but nothing spectacular. Using an index filter and trailing stop loss I'm getting returns in the low 20's with maxDD sub 15. Most DD's (in each test) don't go past around 8% with only 1 reaching down to the 15 level. Not the best returns but it looks consistent and safe. The equity curve is a lovely 45 degree.

Now if I could only raise that return... It does actually bump up to mid 30's on some tests if it catches some security that gives a massive profit of 4.5m! Can hardly depend on that though.
 
Hmm... wonder why we're not getting the same results. Are you using the dates out of unholy grails?

I just read up on the exrem command... looks like it isnt appropriate for us after all:

"Hello,

Example:
1. State form :
Buy = C > MA( C, 10 ); // this gives true for ALL BARS where close is above MA
Sell = MA( C, 10 ) > C;

2. Impulse form:
Buy = Cross( C, MA( C, 10 ) ); // this gives true ONLY ON ONE bar when close
crosses above MA
Sell = Cross( MA( C, 10 ), C );


ExRem is the function that allows to convert from state form to impulse form
Buy = ExRem( Buy, Sell ); // this will convert Buy from state (1) to impulse (2)
Sell = ExRem( Sell, Buy ); // this will convert Sell from state (1) to impulse
-2

Best regards,
Tomasz Janeczko
amibroker.com"


That pushed my CAR up to 31%, with DD 35%. I got 956 symbols with 3 letters using excel, so a couple may have slipped through for you.

If only mid 20s CAR, with sub 15 DD could be guaranteed! I would quit my job and leverage up :D

The index filter did nothing for me, still had 35% max DD. Will have to look into that.
 
Top