Codice su Tradestation dell’indicatore volume positive negative, pubblicato sul TASC di Aprile del 2021 di Markos Katsanos.
Function: _TASC_2021_APR_Fx
// TASC APR 2021
// Detecting High-Volume Breakouts
// Markos Katsanos
inputs:
Period( numericsimple );
variables:
MAV( 0 ),
VP( 0 ),
VN( 0 ),
VPN( 0 );
switch ( BarType )
begin
case 2,3,4: { Daily, Weekly, or Monthly bars }
MAV = Average( Volume, Period );
VP = SummationIf( TypicalPrice –
TypicalPrice[1] > 0.1 *
AvgTrueRange( Period ),
Volume , Period );
VN = SummationIf( TypicalPrice –
TypicalPrice[1] < -0.1 *
AvgTrueRange( Period ),
Ticks , Period );
default: { all other bars }
MAV = Average( Ticks, Period );
VP = SummationIf( TypicalPrice -
TypicalPrice[1] > 0.1 *
AvgTrueRange( Period ),
Ticks , Period );
VN = SummationIf( TypicalPrice –
TypicalPrice[1] < -0.1 *
AvgTrueRange( Period ),
Ticks , Period );
end;
if MAV <= 0 then
MAV = 1;
if Period <> 0 then
VPN = ( VP – VN ) / MAV / Period * 100;
_TASC_2021_APR_Fx = VPN;
Indicator: TASC APR 2021
// TASC APR 2021
// Detecting High-Volume Breakouts
// Markos Katsanos
inputs:
Period( 30 ),
Smooth( 3 ),
VPNCrit( 10 ),
MAB( 30 );
variables:
VPN( 0 ),
MAVPN( 0 );
VPN = XAverage( _TASC_2021_APR_Fx( Period ), Smooth );
MAVPN = Average( VPN, MAB );
if VPN >= VPNCrit then
SetPlotColor[1]( 1, Green )
else
SetPlotColor[1]( 1, Red );
Plot1( VPN, “VPN” );
Plot2( MAVPN, “MA”, Green );
Plot3( VPNCrit, “CRIT”, Blue );