Detecting Faults in Technical Indicator Computations

### Program Information

Name: Detecting Faults in Technical Indicator Computations
Domain: Numerical program
Functionality: Detect faults in the computation of two commonly used technical indicators, namely the moving averages (MA) and the relative strength index (RSI).
Input: To compute SMA, a minimum of n time periods of price data are required. Let $t(t=k,k-1,k-2,\ldots 0)$ denote the time period of the prices plotted where $k \geq n-1$. Let t = k be the oldest time period and t = 0 be the newest time period.Let $P(p_k,p_{k-1},p_{k-2},\ldots ,p_0)$ be the price values from time period $t = k$ to $t = 0$ . In addition to the notations used to define SMA,an upward price change $U(t)$ and a downward price change $D(t)$ are defined i in (4) and (5) respectively for each time period,t.
Output: $$$SMA(n,t)=\left\{\begin{array}{cc} undefined & t>k-n+1 \\ \frac{1}{n} \sum_{i=t}^{t+n-1} p_i & k-n+1 \geq t \geq 0 \end{array} \right.\tag{1}$$$ $$$SMA(n,t)=\left\{\begin{array}{cc} undefined & t>k-n+1 \\ \frac{1}{n} \sum_{i=t}^{t+n-1} p_i & t=k-n+1 \\ SMA(n,t+1)-\frac{p_{t+n}}{n} + \frac{p_t}{n} & k-n+1 > t \geq 0 \end{array} \right.\tag{2}$$$ $$$SSMA(n,t)=\left\{\begin{array}{cc} undefined & t>k-n+1 \\ SMA(n,t) & t=k-n+1 \\ \frac{1}{n}(SMMA(n,t+1)\cdot (n-1)+p_t) & k-n+1 > t \geq 0 \end{array} \right.\tag{3}$$$ $$$U(t)=\left\{\begin{array}{cc} Undefined & t \geq k\\ p_t-p_{t+1} & p_t \geq p_{t+1},k>t\geq 0 \\ 0 & p_t<p_{t+1},k>t\geq 0 \end{array} \right.\tag{4}$$$ $$$D(t)=\left\{\begin{array}{cc} Undefined & t \geq k\\ p_{t+1}-p_{t} & p_{t+1} \geq p_{t},k>t \geq 0 \\ 0 & p_{t+1}\leq p_{t},k>t\geq 0 \end{array} \right.\tag{5}$$$ $$$RSI(n,t)=\left\{\begin{array}{cc} undefined & t > k-n\\ 100 \cdot \frac{SMMA(n,U(t))}{SMMA(n,U(t))+SMMA(n,D(t))} & k-n \geq t \geq 0 \\ \end{array} \right.\tag{6}$$$

#### Reference

 Detecting Faults in Technical Indicator Computations for Financial Market Analysis https://doi.org/10.1109/ICISE.2010.5689221

### MR Information

#### MR1------SMA

Description:
Property: If $p_t>p_{t+n}$, then $SMA(n,t)>SMA(n,t+1)$
Source input: $(n,t+1)$
Source output: $SMA(n,t+1)$
Follow-up input: $(n,t)$
Follow-up output: $SMA(n,t)$
Input relation:
Output relation: $SMA(n,t)>SMA(n,t+1)$ when $p_t>p_{t+n}$
Pattern:

#### MR2------SMA

Description:
Property: If $p_t<p_{t+n}$, then $SMA(n,t)<SMA(n,t+1)$
Source input: $(n,t+1)$
Source output: $SMA(n,t+1)$
Follow-up input: $(n,t)$
Follow-up output: $SMA(n,t)$
Input relation:
Output relation: $SMA(n,t)<SMA(n,t+1)$ when $p_t<p_{t+n}$
Pattern:

#### MR3------SMMA

Description:
Property: If $p_t>p_{t+1}$ AND $SMMA(n,t+1)>SMMA(n,t+2)$,then $SMMA(n,t)>SMMA(n,t+1)$
Source input: $(n,t+1),(n,t+2)$
Source output: $SMMA(n,t+1),SMMA(n,t+2)$
Follow-up input: $(n,t)$
Follow-up output: $SMMA(n,t)$
Input relation:
Output relation: $SMMA(n,t)>SMMA(n,t+1)$ when $p_t>p_{t+n}$ AND $SMMA(n,t+1)>SMMA(n,t+2)$
Pattern:

#### MR4------SMMA

Description:
Property: If $p_t<p_{t+1}$ AND $SMMA(n,t+1)<SMMA(n,t+2)$,then $SMMA(n,t)<SMMA(n,t+1)$
Source input: $(n,t+1),(n,t+2)$
Source output: $SMMA(n,t+1),SMMA(n,t+2)$
Follow-up input: $(n,t)$
Follow-up output: $SMMA(n,t)$
Input relation:
Output relation: $SMMA(n,t)<SMMA(n,t+1)$ when $p_t<p_{t+n}$ AND $SMMA(n,t+1)<SMMA(n,t+2)$
Pattern:

#### MR5------SMMA

Description:
Property: If $p_t>p_{t+1}$ AND $n1>n2$,then $SMMA(n2,t)-SMMA(n2,t+1)>SMMA(n1,t)-SMMA(n1,t+1)$
Source input: $(n1,t+1),(n2,t+1)$
Source output: $SMMA(n1,t+1),SMMA(n2,t+1)$
Follow-up input: $(n1,t),(n2,t)$
Follow-up output: $SMMA(n1,t),SMMA(n2,t)$
Input relation:
Output relation: $SMMA(n2,t)-SMMA(n2,t+1)>SMMA(n1,t)-SMMA(n1,t+1)$ when $p_t>p_{t+n}$ AND $n1>n2$
Pattern:

#### MR6------SMMA

Description:
Property: If $p_t<p_{t+1}$ AND $n1>n2$,then $SMMA(n2,t+1)-SMMA(n2,t)>SMMA(n1,t+1)-SMMA(n1,t)$
Source input: $(n1,t+1),(n2,t+1)$
Source output: $SMMA(n1,t+1),SMMA(n2,t+1)$
Follow-up input: $(n1,t),(n2,t)$
Follow-up output: $SMMA(n1,t),SMMA(n2,t)$
Input relation:
Output relation: $SMMA(n2,t+1)-SMMA(n2,t)>SMMA(n1,t+1)-SMMA(n1,t)$ when $p_t<p_{t+n}$ AND $n1>n2$
Pattern:

#### MR7------RSI

Description:
Property: If $SMMA(n,U(t))>SMMA(n,U(t+1))$ AND $SMMA(n,D(t))<SMMA(n,D(t+1))$,then $RSI(n,t)>RSI(n,t+1)$
Source input: $(n,U(t+1)),(n,D(t+1)),(n,t+1)$
Source output: $SMMA(n,U(t+1)),SMMA(n,D(t+1)),RSI(n,t+1)$
Follow-up input: $(n,U(t)),(n,D(t)),(n,t)$
Follow-up output: $SMMA(n,U(t)),SMMA(n,D(t)),RSI(n,t)$
Input relation:
Output relation: $RSI(n,t)>RSI(n,t+1)$ when $SMMA(n,U(t))>SMMA(n,U(t+1))$ AND $SMMA(n,D(t))<SMMA(n,D(t+1))$
Pattern:

#### MR8------RSI

Description:
Property: If $SMMA(n,U(t))<SMMA(n,U(t+1))$ AND $SMMA(n,D(t))>SMMA(n,D(t+1))$,then $RSI(n,t)<RSI(n,t+1)$
Source input: $(n,U(t+1)),(n,D(t+1)),(n,t+1)$
Source output: $SMMA(n,U(t+1)),SMMA(n,D(t+1)),RSI(n,t+1)$
Follow-up input: $(n,U(t)),(n,D(t)),(n,t)$
Follow-up output: $SMMA(n,U(t)),SMMA(n,D(t)),RSI(n,t)$
Input relation:
Output relation: $RSI(n,t)<RSI(n,t+1)$ when $SMMA(n,U(t))<SMMA(n,U(t+1))$ AND $SMMA(n,D(t))>SMMA(n,D(t+1))$
Pattern:
Insert title here