Most indicators have two limitations: They’re usually based on specific price levels rather than price changes, and they only use the closing price of a bar. This technique allows you to build a price-change-based indicator that incorporates all the price points in a bar.
Type : Indicator, Name : 20-day MA of Close-to-Close Price Changes, Added To Closing Price Inputs: LookBack(20); Variable: PercChange(0), NewLevel(0), AvgPercChange(0); PercChange = (Close - Close[1])/Close[1]; AvgPercChange = Average(PercChange,20); NewLevel = Close * (1 + AvgPercChange); Plot1[1](NewLevel,""); Type : Indicator, Name : Meander Indicator Inputs: StDevs(1); Variable: StdDevChange(0), UpLevel(0), DownLevel(0); StdDevChange = StdDev(PercChange, 20); UpLevel = Close * (1 + AvgPercChange + StDevs * StdDevChange); DownLevel = Close * (1 + AvgPercChange - StDevs * StdDevChange); Plot2[-1](UpLevel,""); Plot3[-1](DownLevel,""); Type : Indicator, Name : HighPercChange {Percentage Change Between Yesterday’s Closing Price and Today’s High} HighPercChange = (High - Close[1])/Close[1]; Type : Indicator, Name : 20-day Price Point MA Input: VSStd(1); Vars: SumVS(0), AvgVS(0), DiffVS(0), StdVS(0), SetArr(0), SumArr(0), DiffArr(0), VSLow(0), VSMid(0), VSHigh(0); {First we define the array} Array: VS[20](0); {Then we're using a loop function to fill it with the different price changes} For SetArr = 0 To 4 Begin VS[SetArr * 4 + 0] = (O[SetArr] - C[SetArr + 1]) / C[SetArr + 1]; VS[SetArr * 4 + 1] = (H[SetArr] - C[SetArr + 1]) / C[SetArr + 1]; VS[SetArr * 4 + 2] = (L[SetArr] - C[SetArr + 1]) / C[SetArr + 1]; VS[SetArr * 4 + 3] = (C[SetArr] - C[SetArr + 1]) / C[SetArr + 1]; End; For SumArr = 0 To 19 Begin If SumArr = 0 Then SumVS = 0; SumVS = SumVS + VS[SumArr]; If SumArr = 19 Then {Here we calculate the average price change over the period} AvgVS = SumVS / 20; For DiffArr = 0 To 19 Begin If DiffArr = 0 Then DiffVS = 0; {Then we calculate the standard deviation} DiffVS = DiffVS + Square(VS[DiffArr] - AvgVS); If DiffArr = 19 Then StdVS = SquareRoot(DiffVS / 20); End; End; {Finally, we add the moving average (and the standard deviations) to the latest close for an indication of tomorrow'âs trading range} VSLow = C * (1 + (AvgVS - StdVS * VSStd)); VSMid = C * (1 + AvgVS); VSHigh = C * (1 + (AvgVS + StdVS * VSStd)); Plot1[-1](VSLow, "VS Low"); Plot2[-1](VSMid, "VS Mid"); Plot3[-1](VSHigh, "VS High"); |
|