BetterVolume indicator

rjelles
Posts: 35
Joined: 04 Feb 2010
Location: Calgary, AB Canada
Has thanked: 6 times
Been thanked: 19 times
Contact:

BetterVolume indicator

Postby rjelles » 05 Nov 2012

Here is my MC.Net port for one of my favorite indicators, BetterVolume from emini-watch.com. The MC.Net port largely follows the original EasyLanguage implementation by Barry Taylor of emini-watch.com, but makes a few optimizations to remove repetitive function calls. (Note: This version was built using the MC.Net 8.1 Beta 1 build)

Thanks kindly to Barry Taylor at emini-watch.com for permission to post my port here. Please be sure to check out his site, as I believe it is one of the most helpful sites for trading education and support.

Any bugs or comments, please email me at rje@traderscience.com.

Best regards,

Jeff
Attachments
BetterVolume.pln
BetterVolume indicator for MC.Net
(3.18 KiB) Downloaded 678 times
These users thanked the author rjelles for the post (total 4):
aitiLaurentiusHubace789arjfca

Hubace789
Posts: 25
Joined: 19 Nov 2012
Has thanked: 12 times

Re: BetterVolume indicator

Postby Hubace789 » 04 Dec 2012

Thanks Jeff (And obviously thanks Barry from emini-watch),

This is currently one of the 5 remaining indicators I still use (along with RSI, Vol Stops, Fractal Channel, ADX, Fibs/S/R/Pivots), and is the best indicator for volume I know of.

How difficult would it be for you/someone to adapt this indicator to a strategy? I'm posting my basic discretionary strat below with my basic conditions developed literally from Barry's summary chart on signal expectation. I've added a few dependent conditions to cement the executable trades set-up. It's what I perceive to be a high probability set-up tree.

I haven't checked out your file, but if you kept colours the same as Barry's then it should be easy to adapt.

I've been meaning to automate this for quite some time; I'm curious to see the results on any major FX pair (with accurate/reliable volume data), if you or anyone wishes to code this and share back than I thank you from the bottom of my heart... (And feel free to insert your own MM, MAs, and Exits to your suit). I'm about a 3/10 on VB and literally getting started with learning C# so I'd also like to learn from this. Maybe I'm only dreaming someone is this gracious :p

Better Volume Strategy:

Buy at bottom if: a or b occurs (whichever occurs first)

a) MEET ALL THREE CONDITIONS BELOW TO BUY
Condition 1: All 4 bars (white, green/blue, magenta, yellow) are present within last 8 bars
Condition 2: Price range over 8 bars is low (define low i.e. I'LL LEAVE IT TO THE CODER)
Condition 3: Medium term MA Slope is negative (RECOMMEND 38 OR 50)

b) MEET BOTH OF THE BELOW REQUIREMENTS
Condition 1: If Magenta bar appears
Condition 2: Price is below Moving Average (RECOMMEND 38 OR 50)

Buy on the uptrend if:

a) MEET BOTH CONDITIONS BELOW TO BUY
Condition 1: White and Yellow appear within last 4 bars
Condition 2: Slope of ST MA is increasing (RECOMMEND 14 OR 21)

Sell at top if a or b occurs (whichever occurs first)

a) MEET ALL THREE CONDITIONS BELOW TO SELL
Condition 1: If all 4 bars (Red, green/blue, magenta, yellow) occur in past 8 bars
Condition 2: Price range over 8 bars is low (define low i.e. I'LL LEAVE IT TO THE CODER)
Condition 3: Medium term MA is positive (RECOMMEND 38 OR 50)

b) MEET BOTH CONDITIONS BELOW TO SELL
Condition 1: If Magenta bar appears
Condition 2: Price is above MA (RECOMMEND 38 OR 50)

Sell on downtrend if:

a) MEET BOTH CONDITIONS BELOW TO SELL
Condition 1: If red and yellow bars appear within last 4 bars
Condition 2: Slope of ST MA is decreasing (RECOMMEND 14 OR 21)

rjelles
Posts: 35
Joined: 04 Feb 2010
Location: Calgary, AB Canada
Has thanked: 6 times
Been thanked: 19 times
Contact:

Re: BetterVolume indicator

Postby rjelles » 04 Dec 2012

Hello,

Your strategy is nicely defined so it would be easy to have your ideas coded in an MC.Net strategy.

It would probably make sense to copy and re-implement the BetterVolume project code as a new function so it could be called something like this:
bvColor = BetterVolColor(x,y,z,...);

This function would return a value (the bar color, would work) corresponding to the current bar volume analysis into a series variable "bvColor".

You could then create a new MC.Net strategy (eg. BetterVolStrat) to put everything together. The new strategy would call the BetterVolColor function plus any moving averages or trend determination functions that would be required for each bar, look for patterns, and see if they match your entry/exit conditions.

Briefly, the core parts of the strategy calc might look something like below (this was put together very quickly, and there are many missing details here but hopefully this provides an overall structure). I'll try to come back to this soon but pretty busy here until early in the new year.

Hope this helps in the meantime!

Jeff


Code: Select all

//***************************************************************
private ISeries<Color> m_bvColor;
private BetterVolColor m_BetterVolColor;

protected override void Create()
{
...
   m_BetterVolColor = new BetterVolColor(this);  // create instance of new BV function
}

protected override StartCalc()
{
   m_BetterVolColor.price
}

CalcBar()
{
...
// get the current volume analysis
bvColor.Value = BetterVolColor(...)
 
//look for patterns
int lookBack = 8;
bool LowVol = false;
bool ClimaxUp = false;
bool ClimaxDown = false;
bool Churn = false;
bool ClimaxChurn = false;
   
for (int i=0; i < lookBack; i++)
{
    switch (bvColor[i])
   {
       case LowVolColor:
           LowVol = true;
       case ClimaxUpColor:
           ClimaxUp = true;
       ...etc.
    }
}

//  calculate range
double range = TrueHigh(lookBack) - TrueLow(lookBack);

// calculate moving averages
double slow = AverageFC(price, SlowLen);
double fast = AverageFC(price, FastLen);

bool condition1, condition2, condtion3;
bool lowRange, highRange;

condition1 = ClimaxUp && ClimaxChurn;
lowRange  = range <= lowThreshold;
highRange = range >= highThreshold;

// <add more conditions as required>
bool buyCond = false;
bool sellCond = false;

// evaluate conditions
if (condition1 && lowRange && slope < 0)
   buyCond = true;

etc.

//***************************************************************

Hubace789
Posts: 25
Joined: 19 Nov 2012
Has thanked: 12 times

Re: BetterVolume indicator

Postby Hubace789 » 04 Dec 2012

Awesome, I really appreciate this!

However, still very foreign to me, and hopefully when you next take a look at it with your free time I'll at least be able to understand the gist of what you are trying to tell me :p

Have a good one,

Eric

Hubace789
Posts: 25
Joined: 19 Nov 2012
Has thanked: 12 times

Re: BetterVolume indicator

Postby Hubace789 » 25 Jan 2013

Hey Jeff,

How come you chose .pln format?

Eric

rjelles
Posts: 35
Joined: 04 Feb 2010
Location: Calgary, AB Canada
Has thanked: 6 times
Been thanked: 19 times
Contact:

Re: BetterVolume indicator

Postby rjelles » 25 Jan 2013

Hi Eric,

Are you running MC.Net? The pln code was for MC.Net, but if you are looking for an EasyLanguage version, here is the link at emini-watch:

http://emini-watch.com/free-stuff/volume-indicator/

If you are running MC.Net, then you should be able to just click on the file after downloading and the PowerLanguage MC.Net editor should open automatically and import the file for.

Let me know if this helps!

Also -- I'll soon be posting a function version of this indicator code that will make it possible to use the volume bar analysis in strategies or other indicators.

thanks,

Jeff

Hubace789
Posts: 25
Joined: 19 Nov 2012
Has thanked: 12 times

Re: BetterVolume indicator

Postby Hubace789 » 25 Jan 2013

Okay, I actually understand more of the above now - just needed to take a closer look.

That is great news about the function version, I can't wait!

rjelles
Posts: 35
Joined: 04 Feb 2010
Location: Calgary, AB Canada
Has thanked: 6 times
Been thanked: 19 times
Contact:

Re: BetterVolume indicator - function version

Postby rjelles » 28 Jan 2013

Here (finally) is the function version of the BetterVolume indicator. Also, the BetterVolume indicator was rewritten to use the new function.

The function returns a new 'VolPattern' type, and the new indicator code shows how this can be easily interpreted for use in indicators or strategies.

The code below is an example of how it can be used.

If there are any questions, suggestions, or problems please let me know!

thanks,

Jeff


Code: Select all

           
   // declare a VolPattern variable to receive the result from BetterVolumeFunc
            VolPattern volP;
            Color BarColor;

   // call the Better Volume function to get the current bar's volume pattern
            volP = f_VolFunc[0];

            // check the volume pattern returned and set the bar color
            switch (volP)
            {
                case VolPattern.Churn:
                    BarColor = ChurnColor;
                    break;
                case VolPattern.ClimaxChurn:
                    BarColor = ClimaxChurnColor;
                    break;
                case VolPattern.ClimaxDown:
                    BarColor = ClimaxDownColor;
                    break;
                case VolPattern.ClimaxUp:
                    BarColor = ClimaxUpColor;
                    break;
                case VolPattern.LowVol:
                    BarColor = LowVolColor;
                    break;
                default:
                    BarColor = VolColor;        // default color
                    break;
            }

            // ready to plot now
            plot1.Set(Bars.TrueVolume()[0], BarColor);

            // plot average volume line
            if (ShowAvg)
                plot2.Set(f_VolFunc.VolAvg(0), VolColor);
Attachments
BetterVolFunc.pln
Better Volume function version
(4.74 KiB) Downloaded 402 times
These users thanked the author rjelles for the post:
Hubace789

treehead
Posts: 11
Joined: 24 May 2013
Has thanked: 1 time

Re: BetterVolume indicator

Postby treehead » 25 Sep 2013

Hello Jeff and everyone else,

First of all thank you for posting the better volume indicator and function. I follow Barry's updates on emini-watch which have taught me so much about market movement.

I stumbling through multicharts.net and it's C# indicators, functions and strategies, but making progress slowly.

I was wondering if I could get some advice please?

Im trying to create a simple strategy example to understand further how to implement and use Function .

The strategy:

If a red bar shows -buy where the next bar opens.

I was wondering if you could show me how this would be done, as Im struggling with it.


many thanks

herbie

rjelles
Posts: 35
Joined: 04 Feb 2010
Location: Calgary, AB Canada
Has thanked: 6 times
Been thanked: 19 times
Contact:

Re: BetterVolume indicator - Volume Strategy Demo Signal

Postby rjelles » 23 Oct 2013

Hi Herbie,

Sorry for the delay responding, but I've put together a simple MC.Net strategy that uses the BetterVolume function and a simple trend direction filter to show how the BetterVolume function might be used for your own strategies.

I haven't attempted to validate the trading strategy but just a quick test confirmed it will build and actually generates some interesting trades, so hopefully it will help with your own development. I've added a few parameters also to provide some basic control over the strategy.

A pln file is attached that contains the VolumeStrategyDemo signal, the BetterVolume indicator, and the BetterVolume function all together to make it easy. Just import into MC.Net, compile, and add to a chart.

Please let me know if any problems or questions and I'll try answer more quickly next time.

Best regards,

Jeff
TraderScience.com
Attachments
VolumeStrategyDemo.png
VolumeStrategyDemo.png (66.72 KiB) Viewed 1946 times
VolumeStrategyDemo.pln
VolumeStrategyDemo for MC.Net
(6.35 KiB) Downloaded 285 times

ycomp
Posts: 23
Joined: 30 Sep 2013
Has thanked: 7 times

Re: BetterVolume indicator

Postby ycomp » 25 Apr 2018

can this "Better Volume" indicator paint the candlesticks by "Better Volume" color?

rjelles
Posts: 35
Joined: 04 Feb 2010
Location: Calgary, AB Canada
Has thanked: 6 times
Been thanked: 19 times
Contact:

Re: BetterVolume indicator

Postby rjelles » 25 Apr 2018

Sure, here is an updated VS2017 project file that includes _BetterVoume and _BetterVolumePB.

Best regards,

Jeff
TraderScience.com
Attachments
bettervolumepb.png
Chart with both _BetterVolume and new _BetterVolumePB
bettervolumepb.png (81.75 KiB) Viewed 236 times
Last edited by rjelles on 26 Apr 2018, edited 1 time in total.
These users thanked the author rjelles for the post:
ycomp

ycomp
Posts: 23
Joined: 30 Sep 2013
Has thanked: 7 times

Re: BetterVolume indicator

Postby ycomp » 25 Apr 2018

thanks... what is the difference between the PB and non-PB versions?

Would it only work with futures or will it work with Forex tick data also?

rjelles
Posts: 35
Joined: 04 Feb 2010
Location: Calgary, AB Canada
Has thanked: 6 times
Been thanked: 19 times
Contact:

Re: BetterVolume indicator

Postby rjelles » 26 Apr 2018

The PaintBar version changes the bar colours on the price series in the main window, whereas the original version creates a new volume indicator on the chart. Otherwise they are identical in how they interpret volume and select colours. I found it was much easier to work with them as two separate indicators rather than having to make changes to the settings and display properties for the two different use cases in a single indicator.

They will both work with all instrument classes. But since there are only tick counts available for forex, the chart should be time based rather than ticks to get a useful display.

Also I have made a minor update to the files to fix the default settings for the indicators.

Any problems, please let me know and I'll try to help.

Thanks,

Jeff
TraderScience.com
Attachments
BetterVolume_with_PB_20170426.pln
(6.17 KiB) Downloaded 52 times
Last edited by rjelles on 26 Apr 2018, edited 1 time in total.
These users thanked the author rjelles for the post:
ycomp

ycomp
Posts: 23
Joined: 30 Sep 2013
Has thanked: 7 times

Re: BetterVolume indicator

Postby ycomp » 26 Apr 2018

great, thanks for clarifying things and updating the indicator )


Return to “User Contributed Studies”