For now just posting this to add picture directly (so it is visible right away) and a link to description (to help all interested in in it : it is a TASC July 2007 description of it Traders Tips - July 2007 )
Files:
VPCI - metatrader 4 version ...
Here as a vpci indicator converted to metatrader 4 (with the addition of colors (as in this modified tradestation version : https://www.mql5.com/en/forum)
Files:
vpci_1.gif
32 kb
vpci.mq4
5 kb
Thank you mladen,
excellent work. i should have ask earlier, so i would not have spend so much time at my "beginner" code.
I agree, it looks better in smaller timeframes but also not bad in higher. It could be helpfull, maybe in combination with other indicators or different settings.

You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hello guys,
i have found a VPCI indicator for tradestation and tried to code it for MT4, because i couldn't find a similar version. I took another VPCI (MT4) and just change a bit. i'm not that good at programming. Seems like it works but my MT4 version does not look like the tradesation version.
Here is my Code (MT4):
#property indicator_buffers 1
#property indicator_color1 Yellow
extern int period=5,
LongTermPeriod=20,
double VPCI[];
double VPCISmooth[];
int init() {
string short_name="VPCI";
SetIndexBuffer(0,VPCI);
SetIndexStyle(0,DRAW_LINE);
SetIndexLabel(0,"VPCI");
IndicatorShortName(short_name+"("+period+","+LongTermPeriod+")");
return(0);
}
int start() {
int counted_bars=IndicatorCounted();
int limit=Bars-counted_bars;
double VolumeSum1,VolumeSum2,VWMA1,VWMA2,VPR,VM,VolPriSum1,VolPriSum2,VP;
for(int i=0;i<limit;i++) {
VolumeSum1=0;
for (int l=i;l<i+period;l++) {
VolumeSum1+=Volume[l];
}
for (l=i;l<i+LongTermPeriod;l++) {
VolumeSum2+=Volume[l];
}
for (l=i;l<i+period;l++) {
VolPriSum1+=Volume[l]*Close[l];
}
for (l=i;l<i+LongTermPeriod;l++) {
VolPriSum2+=Volume[l]*Close[l];
}
if (VolumeSum1>0)
VWMA1 = VolPriSum1/VolumeSum1;
if (VolumeSum2>0)
VWMA2 = VolPriSum2/VolumeSum2;
VP = VWMA2 - iMA(NULL,0,LongTermPeriod,0,0,0,i);
VPR = VWMA1/ iMA(NULL,0,period,0,0,3,i);
VM = (VolumeSum1/period)/(VolumeSum2/LongTermPeriod);
VPCI=VP * VPR * VM;
}
return(0);
}[/CODE]
And the tradestation code
[CODE]inputs:
Price( Close ),
Length1( 5 ),
Length2( 20 ),
VPCIAvgLen( 20 ) ;
variables:
VolValue( 0 ),
VolumeSum1( 0 ),
VolumeSum2( 0 ),
VWMA1( 0 ),
VWMA2( 0 ),
VP( 0 ),
VPR( 0 ),
VM( 0 ),
VPCI( 0 ),
AvgVPCI( 0 ) ;
if BarType >= 2 then { not tick/minute data }
VolValue = Volume
else
VolValue = Ticks ;
VolumeSum1 = Summation( VolValue, Length1 ) ;
if VolumeSum1 > 0 then
VWMA1 = Summation( Price * VolValue , Length1 ) / VolumeSum1 ;
VolumeSum2 = Summation( VolValue, Length2 ) ;
if VolumeSum2 > 0 then
VWMA2 = Summation( Price * VolValue , Length2 ) / VolumeSum2 ;
VP = VWMA2 - Average( Price, Length2 ) ;
VPR = VWMA1 / Average( Low, Length1 ) ;
VM = Average( VolValue, Length1 ) / Average( VolValue, Length2 ) ;
VPCI = VP * VPR * VM ;
AvgVPCI = Average( VPCI, VPCIAvgLen ) ;
Plot1( VPCI, "VPCI" ) ;
Plot2( AvgVPCI, "VPCISmooth" ) ;
Plot3( 0, "Zero" ) ;You can find a picture of it here: h**p://www.traderslaboratory.com/forums/attachments/56/5912d1207587090-volume-price-action-momentum-indicator-vpmo-vs-vpci-2008-04-07_124855.gif
And here another one with the code under it: h**p://www.traders.com/Documentation/FEEDbk_docs/2007/07/TradersTips/TradersTips.html#tradestation
I don't added the MA on it, don't know how to do it. If someone has the time it would be nice.
But more important where is my mistake?
THX
Joe