I want this indicator and the indicator below to appear in the same chart like the main…
- User
I want this indicator and the indicator below to appear in the same chart like the main window on the graph ,put them in one script // This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © loxx
//@version=5 indicator("STD-Filtered, N-Pole Gaussian Filter [Loxx]", shorttitle="STDFNPGF [Loxx]", overlay = true)
import loxx/loxxexpandedsourcetypes/4
greencolor = #2DD204
redcolor = #D2042D//factorial calc fact(int n)=> float a = 1 for i = 1 to n a *= i a
//alpha calc _alpha(int period, int poles)=> w = 2.0 * math.pi / period float b = (1.0 - math.cos(w)) / (math.pow(1.414, 2.0 / poles) - 1.0) float a = - b + math.sqrt(b * b + 2.0 * b) a
//n-pole calc _makeCoeffs(simple int period, simple int order)=> coeffs = matrix.new(order + 1, 3, 0.) float a = _alpha(period, order) for r = 0 to order out = nz(fact(order) / (fact(order - r) * fact(r)), 1) matrix.set(coeffs, r, 0, out) matrix.set(coeffs, r, 1, math.pow(a, r)) matrix.set(coeffs, r, 2, math.pow(1.0 - a, r)) coeffs
//n-pole calc _npolegf(float src, simple int period, simple int order)=> var coeffs = _makeCoeffs(period, order) float filt = src * matrix.get(coeffs, order, 1) int sign = 1 for r = 1 to order filt += sign * matrix.get(coeffs, r, 0) * matrix.get(coeffs, r, 2) * nz(filt[r]) sign *= -1 filt
//std filter _filt(float src, int len, float filter)=> float price = src float filtdev = filter * ta.stdev(src, len) price := math.abs(price - nz(price[1])) < filtdev ? nz(price[1]) : price price
smthtype = input.string("Kaufman", "Heiken-Ashi Better Smoothing", options = ["AMA", "T3", "Kaufman"], group= "Source Settings") srcoption = input.string("Close", "Source", group= "Source Settings", options = ["Close", "Open", "High", "Low", "Median", "Typical", "Weighted", "Average", "Average Median Body", "Trend Biased", "Trend Biased (Extreme)", "HA Close", "HA Open", "HA High", "HA Low", "HA Median", "HA Typical", "HA Weighted", "HA Average", "HA Average Median Body", "HA Trend Biased", "HA Trend Biased (Extreme)", "HAB Close", "HAB Open", "HAB High", "HAB Low", "HAB Median", "HAB Typical", "HAB Weighted", "HAB Average", "HAB Average Median Body", "HAB Trend Biased", "HAB Trend Biased (Extreme)"])
period = input.int(25,'Period', group = "Basic Settings") order = input.int(5,'Order', group = "Basic Settings", minval = 1)
filterop = input.string("Gaussian Filter", "Filter Options", options = ["Price", "Gaussian Filter", "Both", "None"], group= "Filter Settings") filter = input.float(1, "Filter Devaitions", minval = 0, group= "Filter Settings") filterperiod = input.int(10, "Filter Period", minval = 0, group= "Filter Settings")
colorbars = input.bool(true, "Color bars?", group = "UI Options") showSigs = input.bool(true, "Show signals?", group= "UI Options")
- Assistant