Home › Forums › Trading System Mentor Course Community › AmiBroker Coding and AFL › Market Breadth Indicator
- This topic is empty.
-
AuthorPosts
-
September 14, 2020 at 9:12 am #101889AnonymousInactive
Something I created earlier in the year was a market breadth indicator.
At the time, I had been fooling around with the McLellan Oscillator and a few other methods to try and see the market in a more dynamic way apart from the usual/simple moving average on the index method. I also was digging around in the very useful indicators that Norgate gives us all for free. I am talking things like the McClellan Summation, Advancing Issues, Declining Issues, stocks above MA, etc. All of these are in the hashes (#NDX%MA20, #NDX%MA20, #NDXMCSUM etc.). They really are very useful and we are lucky to have Norgate run these for us each day. Thanks Norgate!
I had also been reading around the web about others combining some of these to create a market ‘Breadth Momentum’ indicator to help give more scope/view on the market. They all seemed to revolve around the similar things I mention above.
So I took what I felt was a good mix of the best of them and I came up with the following indicator I have coded. It is using a combination of three things:
Percentage of stocks above/below the moving average (Above 50% would assume there are more stocks above the average than below).
The McClellan Oscillator (Above zero means advancing issues are ahead of the declining issues).
Net of highs/lows (Net number of stocks above zero would assume upward momentum, below zero downwards).I also made a fast and slow version. The shortest time frame Norgate provides on these symbols is 20 days MA and 4 weeks highs/lows (also close enough to 20 days I would assume). The longest is 200 days and 52 weeks.
After building the indicator I tried various time frames and have stuck to two time frames only. A short time frame version and a medium/long time frame version. The versions in between didn’t seem to provide much difference to my eyeball so I thought starting with just two settings would be enough. Also you will see in the code I have done some pretty laborious repeats of things so I thought I would start here and worry about adding more if needed, later.
Here is what it is looking like….
It basically plots the index you are interested in and then uses the ribbon to tell you the status. I did it this way so I can keep this as an indicator in my default charts layout in Amibroker so I can see it at all times. I really hate looking at charts and then always needing to go back to the index chart every now and then. This way in my default layout I can see my favourite index at all times.
I will likely use this now in my discretionary long system (but of course could be used for others). Probably something along the lines of…
Green: New long positions allowed to be entered, at full position sizing.
Yellow: New long positions allowed to be entered, but only half position sizing.
Red: No new long positions allowed to be entered. Currently held positions may also have stops tightened. Or perhaps open a short on the index.I am yet to decide exactly how I will use the colours, but it will be something along these lines. I will likely use the short time frame version as opposed to the long time frame version.
Anyway, here’s the code. Enjoy!
September 15, 2020 at 3:27 am #112162AnonymousInactiveI also created this thing as an oscillator….
It still uses the same three metrics for the calculation as the indicator, however they are normalized to a 0 – 100 range and then just the average of the three items is taken. This way all three of them are equally weighted in the metric. For the indicator I previously posted it is just a very crude “all three up = green” and “all three down = red” and everything else in between is yellow. Now with the oscillator we can be a little more dynamic in which trigger levels we might use for various purposes.
The oscillator shows a range bound indicator instead of plotting the index. The ribbon can be set with levels that will determine the boundaries between red/green (anything else is considered yellow).
I haven’t done any extensive testing to see where good trigger points are on the red/green. I’ve just defaulted them to 60/40 which seem to look good enough for an eyeball job.
It will be interesting to see if a hard limit at 50 would provide a good trading/index signal for various systems.
I also tidied up the code in the indicator a little and attached an updated version of that as well.
Enjoy!
May 19, 2021 at 1:19 am #112163TerryDunneParticipantHi Matthew,
I have started playing around with market breadth, so was very interested in the indicators you created – nice work BTW.
Given that almost a year has now passed, I was wondering whether they have performed as you had hoped and/or whether you are using them in your trading.
Thanks and regards,
Terry
-
AuthorPosts
- You must be logged in to reply to this topic.