Help - Search - Members - Calendar
Full Version: Price Volume Trend Indicator Help
Visual Trading Systems User Forums > VTTRADER INDICATORS > INDICATORS PROGRAMMING QUESTIONS
nahman
Hi
I wish to have the price volume trend indicator show a colour change and alert when the current period is higher than the previous period and when the current period is lower than the previous period.

so far I have this code


_VT:= ((Pr - ref(Pr,-LBP))/ref(Pr,-LBP)) * V) + PREV(0);
_PVT:= *beep*(_VT);

_UpPVT:=if(_VT>=ref(_VT,-1),_VT,_VT);
_DownPVT:=if(_VT<ref(_VT,-1),_VT,null);

LongSignal:=SignalRemove(_VT>ref(_VT,-1),_VT<ref(_VT,-1));
ShortSignal:=Signalremove(_VT<ref(_VT,+1),_VT>ref(_VT,+1));

Could i please get help on how to code this up as i have tried having the variables as both _VT and _PVT and still nothing :|

Regards and thanks,

-Mike.

cskidmore
Hello,

Your _UpPVT and _DownPVT output variables need to be your "Indicator Output Enabled" variables and the _PVT variable should *not* be "Indicator Output Enabled". Change your code to this:

_UpPVT:=if(_PVT>=ref(_PVT,-1),_PVT,_PVT);
_DownPVT:=if(_PVT<ref(_PVT,-1),_PVT,null);

This should take care of the bi-color portion of the indicator.

For the alerts, change your LongSignal and ShortSignal code to the following:

LongSignal:= Cross((_PVT>=ref(_PVT,-1)),0.5);
ShortSignal:= Cross((_PVT<ref(_PVT,-1)),0.5);

The LongSignal and ShortSignal output variables should be at least "Alerts Enabled" and probably "Graphics Enabled" as well. Be sure you go to those respective tabs (Graphics and Alerts) and configure the settings.

Regards,
Chris
nahman
Many thanks!
After some tinkering its close enough to what i want it to do! thanks!
cskidmore
You're welcome.

Regards,
Chris
MoreYummy
What does the final code look like if you can share? I have similar idea.

thanks.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2012 Invision Power Services, Inc.