Home >> (Table of Contents) Studies and Indicators >> Technical Studies Reference >> Study Subgraphs Subtract - Difference
Technical Studies Reference
- Technical Studies Reference
- Common Study Inputs (Opens a new page)
- Using Studies (Opens a new page)
Study Subgraphs Subtract/Difference
This study calculates and displays the Difference of two study Subgraphs.
The study Subgraphs can be part of different studies on the chart, including the Add Additional Symbol study, or any of the main price graph Subgraphs. So it is possible to calculate the difference between the main price graph and the Add Additional Symbol study.
Let \(X^{(1)}\) and \(X^{(2)}\) be random variables respectively denoting the Input Study 1 and Input Study 2 Inputs, and let \(X^{(1)}_t\) and \(X^{(2)}_t\) be their respective values at Index \(t\). Let the Input Study 2 Subgraph Offset be denoted as \(k\).
If \(k = 0\), then the displayed value of Study Subgraphs Subtract at Index \(t\) is given by \(X^{(1)}_t - X^{(2)}_t\). If \(k \neq 0\), then the displayed value of Study Subgraphs Subtract is given by \(X^{(1)}_t - X^{(2)}_0\) for \(t \leq k\), and \(X^{(1)}_t - X^{(2)}_{t - k}\) for \(t > k\).
If the Draw Zeros Input is set to No, then Study Subgraphs Subtract is not drawn at Index \(t\) if its value is zero. Otherwise, it is drawn at Index \(t\) even if its value is zero.
If the Perform Subtract With Zero Values Input is set to No, then the value of Study Subgraphs Subtract is replaced with \(0\) at Index \(t\) if either term in the difference is zero. Otherwise, the two terms are subtracted even if either of them is zero.
Inputs
- Input Study 1: Use this Input to select the study and study Subgraph for Study Subgraph 1 used in the difference calculation.
- Input Study 2: Use this Input to select the study and study Subgraph for Study Subgraph 2 used in the difference calculation.
- Study 2 Subgraph Offset: This Input specifies the offset, in chart bars, from the current bar being calculated when determining the value for Study Subgraph 2. It needs to be entered as a positive value and it specifies the number of bars back from the current bar being calculated, when obtaining the value from the Study 2 Subgraph selected with the Input Study 2 Input.
- Draw Zeros: When this Input is set to Yes, then zero values from the study Subgraph will be drawn. Otherwise, they will not be.
- Perform Subtract With Zero Values: When this input is set to Yes, the default, then Input Study 1 and Input Study 2 of the Based On studies are always subtracted. When this is set to No, then at chart columns where the either Input Study 1 or Input Study 2 from the Based On studies is 0, then the subtraction does not occur and a zero value is used instead.
*Last modified Monday, 03rd October, 2022.