Code: Select all
Function: VAcc// TASC NOVEMBER 2023// VAcc Function// Scott Conginputs:iLength( numericsimple ),iSmooth( numericsimple ),iReturnType( numericsimple );Variables:Length( iLength ),Avg_acc( 0 ),Avg_vel( 0 ),Sum_acc( 0 ),Sum_vel( 0 ),Idx( 0 ),Result( 0 );Sum_vel = 0;for Idx = 1 to Lengthbegin Sum_vel += (Close - Close[Idx]) / Idx;end;Avg_vel = XAverage(Sum_vel / Length, iSmooth);Sum_acc = 0;for Idx = 1 to Lengthbegin Sum_acc += (Avg_vel - Avg_vel[Idx]) / Idx;end;Avg_acc = Sum_acc / Length;if iReturnType = 0 then Result = Avg_velelse Result = Sum_acc;VAcc = Result;Indicator: VAcc // TASC NOVEMBER 2023// VAcc - Velocity (V) and Acceleration (Acc) // Scott Conginputs:Period( 21 ),Smooth( 5 );variables:AvgVel( 0 ),AvgAcc( 0 );AvgVel = 100 * VAcc(Period, Smooth, 0);AvgAcc = 100 * VAcc(Period, Smooth, 1);Plot1( AvgVel / Period * 2, "VAcc" );Plot2( 0, "Zero" );Code: Select all
//+------------------------------------------------------------------+//| Copyright Β© 2020, Gehtsoft USA LLC | //| http://fxcodebase.com |//+------------------------------------------------------------------+//| Developed by : Mario Jemic |//| mario.jemic@gmail.com |//| //+------------------------------------------------------------------+