The V-Trade, Part 5: Technical Analysis—Moving Average Support & Resistance And Volatility Bands

The AIQ EDS file for Sylvain Vervoort’s July 2018 article in S&C, “The V-Trade, Part 5: Technical Analysis—Moving Average Support & Resistance And Volatility Bands,” can be obtained on request via email to The code is also available below.

!Author: Sylvain Vervoort, TASC July 2018
!Coded by: Richard Denning 11/15/18

C is [close].
C1 is valresult(C,1).
C2 is valresult(C,2).
C3 is valresult(C,3).
C4 is valresult(C,4).
C5 is valresult(C,5).
C6 is valresult(C,6).
C7 is valresult(C,7).
C8 is valresult(C,8).
C9 is valresult(C,9).
C10 is valresult(C,10).
C11 is valresult(C,11).
C12 is valresult(C,12).
C13 is valresult(C,13).
C14 is valresult(C,14).
C15 is valresult(C,15).
C16 is valresult(C,16).
C17 is valresult(C,17).
C18 is valresult(C,18).
C19 is valresult(C,19).
PD is {position days}.
PEP is {position entry price}.

smaLen1 is 50.
smaLen2 is 100.
smaLen3 is 200.
esaLen is 20.
esaBandPct is 10.

sma1 is simpleavg(C,smaLen1).
sma2 is simpleavg(C,smaLen2).
sma3 is simpleavg(C,smaLen3).

LWMA is (C*20+C1*19+C2*18+C3*17+C4*16

esa is expavg(C,esaLen).
upperESA is esa*(1+esaBandPct/100).
lowerESA is esa*(1-esaBandPct/100).

 BBlen 	is 20.!Default is 20
 Mult1 	is 2. !Default is 2
 Mult2 	is 2. !Default is 2

Variance is Variance([close],BBlen).
StdDev is Sqrt(Variance).
SMA is simpleavg([close],BBlen).
UpperBB is SMA + StdDev *  Mult1.
LowerBB is SMA - StdDev *  Mult2.

ShowValues if 1.

Squeeze if upperESA > UpperBB and lowerESA < LowerBB.

SqIndicator is iff(Squeeze,1,iff(not Squeeze,0,-1)).

Buy if upperESA < UpperBB  and valrule(Squeeze,1)
	 and C > sma3 and C<LWMA. 
Sell if (PD>=3 and  LWMA < valresult(LWMA,1)) or C < PEP.

The EDS file contains the code for the various moving averages mentioned in the article as well as code for the Bollinger Bands and exponential bands. I did not code the SVE bands discussed by Vervoort in his article. I coded a system that uses the concept of a squeeze, as discussed in the article.

A squeeze occurs when the Bollinger Bands are inside the exponential bands. Figure 8 shows a sample trade from the system on NVDA.

Figure 9 shows the EDS summary report for a four-year backtest using the NASDAQ 100 list of stocks.

Sample Chart

FIGURE 8: AIQ. This shows a sample trade from the squeeze system.

Sample Chart