I'm still trying to effectively use volume in my trading. My thinking logically leads me to the concept of relative volume; i.e not just volume by itself but in comparison to an established average or median; that can indicate/confirm volatility (or the lack of it).
I am looking for a volume indicator that compares the current price barís volume to historical volume in the same bar on previous days (plot volume bars by timeframe relative to average/median over n days). The relativity can be expressed as a percentage and/or std deviations, moving averages etc.
I did some googling... surprisingly I found nothing on Ninja forums or here but I did find the indicator outlined in Dr. Brett Steenbarger's blog (he uses Excel to plot) and code for other platforms. I provide the references below:
If anyone can point me to a NinjaTrader 6.5 indicator that does this, if it exists. If not, can anybody kindly port this code to Ninja 6.5. I'm no programmer but from the code I've seen, it doesn't look to complicated.
Thanks in advance
The following user says Thank You to soulartist for this post:
The kindness also helps me to organize my own mind and get a better understanding of the question. Sometimes a question looks simple or redundant, but when you try to answer it, you need to explore half the universe. Actually it is rewarding. I am also kind to myself.
The following 18 users say Thank You to Fat Tails for this post:
As goes the Relative Volume indicator, I intend to use it more like I use market internals (Adjusted Cumulative tick, Advance Decline, VIX) - to keep me aware of and aligned with the intraday sentiment. When you hear volume is x% above or below the avg etc, it would be nice to have the same displaying on your charts. It would also be valuable input in my Trend vs Range day analysis that I do within the first half hour to an hour; that decides my approach for the day (directional vs fade). It is not for specific trade setups/confirmation, for which I use Cumulative and/or per bar Delta.
I understand this is not complicated code, if someone shares my perspective (and can program which I cannot) would appreciate if this could be made available. Please refer to my initial post for sample easy language and other platform codes.
then you would need to be more specific: If I look at the different links that you posted, there are quite different concepts.
First link shows cumulated volume versus Median volume. Second link shows median volume per 30 minutes and standard deviation.
By the way I have recently coded an indicator that shows the average volume of the last n trading days, so it would be easy to modify it to show the relative volume of the current day in relation to an average day. This indicator can be found here:
The code determines the relative volume for each 3 min bar of the current session by comparing it to the average volume of the last 20 days. Then a simple average, which is smoothed with a Hull average is calculated. The use of a Hull average here is strange. Works with a 3 min chart.
Problem with this code. You cannot really compare different week days, so I would rather modify the code to compare Mondays with Mondays, Tuesdays with Tuesdays etc. The reason is that some days show volume picking up earlier due to news releases, and you cannot compare the 8:30 AM news release days Thursday and Friday with the other days. You will see this if analyzing volume and range per weekday as shown on this thread
Plots Green Bars, if the relative volume is greater than 100% of the average volume of the preceding n days, red bars if smaller, and white bars if similar (equal +- tolerance). There is a moving average as well, but no Hull Moving Average for smoothing. Again the analysis is not done for a specific day of the week.
Completely different. Plots average volume, standard deviation band, current bar volume and a cunulative difference between actual and average (blue and red lines on the chart). Only works with 15 min charts.
All these concepts are quite different. Some show moving averages, other bars, other cumulated volume or standard deviations, some work only on 3 min charts, other on 15 min charts, not easy to select any approach. None of the indicator uses the median, which was used by Dr.Brett Steenbarger.
Starting from Scratch
When coding an indicator, we would first need to make some decisions:
1) Do we want to make an analysis per day of week, or shall we mix Fridays and Mondays? Do we need a filter for Fed Days and Holidays (dates can be entered manually) ?
2) If we compare today's volume, do we want to compare it to the median (Brett Steenbarger) or to the arithmetic average as all the indicators did?
3) Do we really need a standard deviation? How do you use this standard deviation in your trading. Or would you be happy with a different colour if 1 standard deviation is exceeded.
4) Do you want bars that show the relative volume of the current period in relation to the median or average volume of that same period of prior trading days?
5) Do you want a moving average for that relative volume per bar?
6) Do you need an information on cumulated volume?
There is one difficulty. NinjaTrader 6.5. does not have the session manager. This is a typical application, where you need sessions. So it can easily be done in NinjaTrader 7 with its predefined sessions, but not in NinjaTrader 6.5
I can possibly code this quickly, as I can just use the IntradaySeasonality volume indicator, which I mentioned above.
NinjaTrader 7.0, separate analysis per week-day, arithmetic average (not median), no standard deviations (bars can be coloured if 10% below or 10% above average volume), with cumulated volume per session, no moving average of the relative volume (either cumulated volume or moving average), no limitation to a specific timeframe as Benzinga or eToke.
Would you agree? Can you switch to NT 7.0? Indicator would not work with NT 6.5. and I am not ready to code this for NT 6.5., because it would be at least (!) twice the effort due to lack of session manager.
Last edited by Fat Tails; September 6th, 2010 at 07:33 AM.
The following 3 users say Thank You to Fat Tails for this post:
Below is a chart of ES of last Friday. The volume was compared to the average volume of the preceeding 20 Fridays (20 weeks, default setting of indicator). Green bars show above average volume (> 115%), red bars show below average volume (< 85%). The line shows the ratio of the cumulated volume divided by the average cumulated volume over the same period. Blue means that the cumulated volume was higher than usual, orange means that it was lower than usual.
On last Friday, the Asian and European sessions had low volume. The volume prior to the open was higher than usual. After the open ES settled down in a trading range on lower volume.
First raw version of Relative Volume Indicator attached below. If you use that indicator, make sure you have a chart lookback period of at least 142 days for the default settings. Never use this indicator in CalculateOnBarClose = false mode, as it is not speed-optimized. The relative volume does not need to be calculated for every incoming tick. The second version should have an option to exclude specific dates such as holidays, FOMC and Flash Crash days.
Please register on futures.io to view futures trading content such as post attachment(s), image(s), and screenshot(s).
Edit : Indicator updated on September 6 ( adjustment for different daylight savings rules, fields added for dates to exclude from analysis, such as crashes or holidays, speed improved).
Last edited by Fat Tails; September 6th, 2010 at 03:39 PM.
Reason: indicator update
The following 15 users say Thank You to Fat Tails for this post:
The main problem here are the different time zones. If you are a European user and you want to trade a US instrument, you have to cope with the different dates of the daylight savings schedules. So you need to shift the prior values of the same weekday and time of day by 1 hour to match the opening hours of the futures or stock exchange. The same of course applies, if a US user wants to trade European instruments such as FESX or FDAX.
For NT 7.0 the information on the time zone of the exchange is available from the master data of an instrument, where appropriate sessions and the time zone are defined. For NT 6.5. this information is not available, so you would need to build your own database for the instruments that you want to trade.
The problem does not occur, if you only trade instruments of your own time zone.
But we do not want an indicator that sometimes works correctly and sometimes produces false results? By the way I am not sure yet that the first version of the indicator handles all this correctly. The second version will.
I have replaced the original indicator with a new version. The following changes were made:
(1) The bar times are converted to comply with different daylight savings schedules in exchange time and local time of your NinjaTrader installation.
(2) It is now possible to exclude specific dates (outliers) from analysis. The chart below shows an example. Last Thursday's cumulated volume was 64.6% of the average volume of the prior 20 Thursdays. However, if you exclude May 6, the day of the flash crash, the cumulated volume becomes 69.4% of an average Thursday.
(3) The indicator works on fixed period intraday charts (minute charts) and daily charts only. For daily charts no cumulated volume of the session is shown.
(4) The volume bars are now coloured as follows: Green (volume 20% higher than usual), red (volume 20% lower than usual), white in between green and red.
(5) Default settings: The indicator will use the last 20 weeks of data as a reference. The relative volume is displayed for a lookback period of two weeks only. You can increase both reference period and display period, but this will make the indicator slow.
(6) With the default settings of a 20 week reference period, your chart should have a lookback period of 142 days or higher.
The indicator can now be found in the download section of this forum: