VT Trader -> MT4 formula

 

Hi Everyone,

I've been using VT Trader for awhile, but am shifting over to Alpari UK soon. In VT I've been using Chaikin's Money Flow (which someone was kind enough to post on this forum!).

However, I noticed that the formulas each platform uses differ a bit. To be quite honest, I like VT's formula better since the CMF has a weakness -- it does not account for price gaps. If a gap in prices occurs, the CMF indicator will have a NULL value (i.e.: no value) for n-periods after the gap. However, the formula has been slightly altered in VT Trader to avoid any NULL values.

Here is VT's formula for CMF (note that coding language is not the same as MQL):

_AD:= if(((((C-L)-(H-C)) / (H-L)) * V)=NULL,0,(((C-L)-(H-C)) / (H-L)) * V);

_CMF:= mov(_AD,periods,S)/mov(V,periods,S);

This is VT's formula for Chaikin's Accumulation/Distribution:

_AD:= cum((((C-L)-(H-C)) / (H-L)) * V);

I have attached the CMF indicator for MT4, and if anyone knows how to translate VT's CMF formula into the MT4 one for me, it would be greatly appreciated!!! If not, well no harm asking.

Thanks heaps,

Venge.

Files:
cmf_v1.mq4  2 kb
 

Vengeance

The part where it checks NULL values is the part where it checks for zero divide errors. The difference does not come from that but from the different formula used in the metatrader version you posted and the VT (and actually Marc Chaikin original formula)

______________________________________

Metatrader version uses formula that was published here : Investor/RT Tour - Chaikin Money Flow but that formula is not correct. According to Marc Chaikin (published in Technical Analysis of Stocks & Commodities, volume 12:1 http://traderscom.stores.yahoo.net/-v12-c01-chattin-pdf.html ) money flow index is a :
The daily raw formula of the Chaikin oscillator is also used for your money flow indicator? Right. Later on, I developed the money flow indicator, which is the 21-day sum of the raw daily accumulation / distribution indicator divided the 21-day sum of volume. Instead of calculating a running total, we are looking at an oscillator of money flow
where the "raw daily accumulation / distribution" is a part of Williams accumulation / distribution ("part" because the "calculating a running total" part of is left out) which is calculated as :
((CLOSE-LOW)-(HIGH-CLOSE))/(HIGH-LOW)*VOLUME
______________________________________ In some sense neither is the VT formula correct (the moving average instead of the sum at the end of it) but that, due to the calculation nature, does not change the result. Anyway, here is one that is correct "to the letter" (differences compared to the metatrader one you have are not big but they do exist)
regards

Mladen

Vengeance:
Hi Everyone,

I've been using VT Trader for awhile, but am shifting over to Alpari UK soon. In VT I've been using Chaikin's Money Flow (which someone was kind enough to post on this forum!).

However, I noticed that the formulas each platform uses differ a bit. To be quite honest, I like VT's formula better since the CMF has a weakness -- it does not account for price gaps. If a gap in prices occurs, the CMF indicator will have a NULL value (i.e.: no value) for n-periods after the gap. However, the formula has been slightly altered in VT Trader to avoid any NULL values.

Here is VT's formula for CMF (note that coding language is not the same as MQL):

_AD:= if(((((C-L)-(H-C)) / (H-L)) * V)=NULL,0,(((C-L)-(H-C)) / (H-L)) * V);

_CMF:= mov(_AD,periods,S)/mov(V,periods,S);

This is VT's formula for Chaikin's Accumulation/Distribution:

_AD:= cum((((C-L)-(H-C)) / (H-L)) * V);

I have attached the CMF indicator for MT4, and if anyone knows how to translate VT's CMF formula into the MT4 one for me, it would be greatly appreciated!!! If not, well no harm asking.

Thanks heaps,

Venge.
Files:
cmf.gif  23 kb
 

Hello Mladen

Wow! Much more info. than I was expecting, so thank you very much. Very informative. I have no coding ability at all, so although I could roughly understand the formula, with the 'coding' stuff there, I was a bit clueless as to what was what. I also didn't realize that the MT4 one was using an incorrect formula...Why would someone use an incorrect formula without stating that...?

Anyway, enough of my yapping. Once again thank you for both the info. and the 'correct' formula/indicator!

Cheers,

Venge.

 

Hi Mladen,

So I downloaded the indicator you had so graciously uploaded for me (thanks again), and I was comparing it with the one on VT Trader and this is what I got (see screen shots, please).

Any reason why they seem to be fairly different in both shape and levels? I wonder if it's due to the broker or the formula differences...?

For my purposes, I like the VT one more as it seems to be a little less...for lack of a better word - volatile.

BTW, I was comparing them on the AUD/USD daily charts from near the beg. of August until present.

Anyway, I guess what I am asking, very kindly of course, if the difference is due mainly to the formula differences,, would it be possible for you to code the exact VT one into MQL for me? Of course, no rush and whenever you have a moment.

Once again, thanks and sorry to be such a bother!

Venge.

Thanks for your help,

Files:
 

Venge,

I am afraid you are going to get different result for every broker (price differences, also, I see you have sunday data in VT which is going to cause "smoothing" for a simple reason that Sunday data is usually just an hour or two, and the everlasting problem, the volume in forex...)

Volume is affecting result due to the fact how forex volumes are treated (even with level 2 volumes) in forex. Since there is no "central" place for registering volumes, almost always the volume in forex is not volume but summed ticks (simple number of ticks per bar) which makes the usage of volume in forex calculations more or less doubtful at the least (even when they are actual volumes, since there is no way to know the actual total volumes in forex)

_________________________________

As far as the calculation is concerned, it is, after shortening the VT formula, the same. Knowing that the simple moving average is a sum over periods divided by a periods, VT formula can be shortened in a following manner (AD being accumulation/distribution)

cmf = average(AD,periods)/average(volume,periods) =>

(sum(AD,periods)/periods)/(sum(volume,periods)/periods) =>

sum(AD,periods)/sum(volume,periods)

That is why I told that the average at the end of VT formula does not change the value of the oscillator. Using moving average is, in this case, equivalent to using just sum of values. As of differences on different brokers - here is a simple example : upper is Alpari lower is IBFX and I could go on and on from broker to broker and almost always I would get different results

regards

Mladen

Files:
 

Thought I'd make things alittle bit easier for anyone wanting to try this out, so have attached a template. Note that in the keltner channel, the kshift is 2.0 not 2.5 as I had mentioned earlier.

Also, not that you will need to dl the keltner ind. posted and the CMF ind. that Mladen had very kindly posted, too.

Something else I was toying with in regards to this system's logic is if a position is entered into and then the CMF crosses back through the zero line but BB and Keltner do not meet new entry criteria, should we hold the position as is or perhaps close it out and await new trade entry criteria...

Any thoughts?

Cheers,

Venge.

Files:
 

Venge

As of differences : here is a comparison of a same period Chaikin money flow on metatrader and VT. Upper is the metatrader CMF lower is the VT CMF (15 minute chart in both cases)

Frankly I do not see any significant difference

____________________________________

As of smoothing : there are ways and ways of smoothing. One way of smoothing (without adding lag and preserving significant points) gives results like this :
but it is out of the scope of a public thread. Simply that way is posted and used in the advanced elite section and it would not be fair to users of it to post that way in a public thread too. Sorry

regards

Mladen

Files:
 

Hey Mladen,

What are your thoughts on being able to add some kind of smoothing to the CMF?

Thanks,

Venge.

 

Hi Mladen,

Not a problem and I perfectly understand! That said, would you mind telling me what method of smoothing it uses?

Thanks,

Venge.

 

Stochastic RSI CLONE NEEDED VT trader TO Metatrader 4

Hi, I was wondering if anyone out there has a clone of the stochastic RSI indicator from VT trader as an indicator to metatrader.

OR if anyone can please code one up,

The ones which are found on the net are completely different as they don't have the right settings.

This one must have all these:

RSI price: close/mid/high whatever

RSI Periods: customisable

Stochastic RSI %K periods: Customisable

Stochastic RSI %K Slowing Periods: Customisable

Stochastic RSI %K Method: Simple, weighted, triangular, sine weighted, exponential, *Volume adjusted* <--- MUST Need this one

Stochastic RSI %D Periods: Customisable

Stochastic RSI %D Method: imple, weighted, triangular, sine weighted, exponential, Volume adjusted

And of course the customisable colours, thickness of lines and horizontal lines.

If this is available anywhere please help me because I have not found the correct clone from VT trader. I may even be willing to pay a little as an incentive (small payment as I'm a student).

Kind Regards,

-Mike