Codice su Tradestation dell’indicatore Rate of Change with Bands, pubblicato sul TASC di Marzo del 2021 di Vitali Apirine.
Function: _TASC_MAR2021_Fx
// TASC MAR 2021
// Rate of Change With Bands
// Vitali Apirine
inputs:
Periods1( numericsimple ),
Periods2( numericsimple ),
Periods3( numericsimple ),
RateOfChgPrice( numericseries ),
oROCDev( numericref ),
oMARoc( numericref );
variables:
RateofChg( 0 ),
AvgOfSquares( 0 );
once
begin
// force function to be series since
// XAverage is used
Value1 = RateOfChg[1];
end;
RateOfChg = RateOfChange( RateOfChgPrice, Periods1 );
AvgOfSquares = Average( Square( RateOfChg ),
Periods3 );
// set the output variables
oROCDev = SquareRoot( AvgOfSquares );
oMARoc = XAverage( RateOfChg, Periods2 );
_TASC_MAR2021_Fx = 1;
Indicator: TASC MAR 2021
// TASC MAR 2021
// Rate of Change With Bands
// Vitali Apirine
inputs:
Periods1( 12 ),
Periods2( 3 ),
Periods3( 12 ),
RateOfChgPrice( Close ),
NumDevUp( 1 ),
NumDevDn( -1 );
variables:
ROCDev( 0 ),
MaRateOfChg( 0 ),
UpperBand( 0 ),
LowerBand( 0 );
Value1 = _TASC_MAR2021_Fx( Periods1, Periods2,
Periods3, RateOfChgPrice, ROCDev, MaRateOfChg );
UpperBand = ROCDev * NumDevUp;
LowerBand = ROCDev * NumDevDn;
Plot1( UpperBand, “UpperBand” );
Plot2( MaRateOfChg, “MA-ROC” );
Plot3( LowerBand, “-LowerBand” );