Set of functions containing the built-in scripting operators, such as moving average calculations.
Members
-
sma
-
sma: compute simple moving average calculation
Same as ma
Methods
-
cmo()
-
cmo: compute a Chande Momentum calculation
Examples
result = stddev('Close', 50)
study("Hello World") field = input("Field", "Close") # Define the Period input for the study period = input("Period", 50) # Use the cmo builtin that calculates a Chande Momentum cmo = cmo(field, period) plot(cmo, color: "orange")
-
dataset()
-
dataset: pull quote values out of the (scrubbed) symbol values
Examples
close = dataset('Close')
close = dataset('Close', -1)
study("Simple MA") field = input("Field", "field") period = input("Period", 20) sum = (length) -> total = 0 while length value = dataset(field, -(--length)) return null if not value? total += value total total = sum period if total? average = total / period plot average
-
ema()
-
ema: compute exponential moving average calculation
Examples
result = ema('Close', 50)
study("Hello World") field = input("Field", "Close") # Define the Period input for the study period = input("Period", 50) # Use the ema builtin that calculates an exponential moving average ema = ema(field, period) plot(ema, color: "orange")
-
fill()
-
Create parameters for {CIQ.prepareChannelFill}. Store in sd.scriptStates.
Example
top = dataset("High") bottom = dataset("Low") topBand = plot(top) bottomBand = plot(bottom) fill(topBand, bottomBand, color: "green")
-
histogram()
-
Set the value in the dataset to create a histogram. There can only be a single histogram per study.
Examples
histogram(field)
histogram(field, colorPositive: '#01ff01', colorNegative: '#ff0101')
histogram(field, colorIncreasing: '#0101ff', colorDecreasing: '#767600', opacity: 0.4)
-
ma()
-
ma: compute a simple moving average calculation
Examples
result = ma('Close', 50)
study("Hello World") field = input("Field", "Close") # Define the Period input for the study period = input("Period", 50) # Use the ma builtin that calculates a simple moving average simple = ma(field, period) plot(simple, color: "orange")
-
plot()
-
plot: plots a line on the chart
Example
plot(field, color: "orange")
-
smma()
-
smma: compute welles-wilder moving average calculation
Examples
result = smma('Close', 50)
study("Hello World") field = input("Field", "Close") # Define the Period input for the study period = input("Period", 50) # Use the smma builtin that calculates a welles-wilder moving average smma = smma(field, period) plot(smma, color: "orange")
-
stddev()
-
stddev: Standard Deviation calculation.
Examples
result = stddev('Close', 50)
study("Hello World") field = input("Field", "Close") # Define the Period input for the study period = input("Period", 50) # Use the stddev builtin that calculates a Standard Deviation stddev = stddev(field, period) plot(stddev, color: "orange")
-
tma()
-
tma: compute triangular moving average calculation
Examples
result = tma('Close', 50)
study("Hello World") field = input("Field", "Close") # Define the Period input for the study period = input("Period", 50) # Use the tma builtin that calculates a triangular moving average tma = tma(field, period) plot(tma, color: "orange")
-
tsma()
-
tsma: compute time-series moving average calculation
Examples
result = stma('Close', 50)
study("Hello World") field = input("Field", "Close") # Define the Period input for the study period = input("Period", 50) # Use the tsma builtin that calculates a time-series moving average tsma = tsma(field, period) plot(tsma, color: "orange")
-
vdma()
-
vdma: compute vidya (based on variable) moving average calculation
Examples
result = vdma('Close', 50)
study("Hello World") field = input("Field", "Close") # Define the Period input for the study period = input("Period", 50) # Use the vdma builtin that calculates a vidya moving average vdma = vdma(field, period) plot(vdma, color: "orange")
-
vma()
-
vma: compute variable moving average calculation
Examples
result = vma('Close', 50)
study("Hello World") field = input("Field", "Close") # Define the Period input for the study period = input("Period", 50) # Use the vma builtin that calculates a variable moving average vma = vma(field, period) plot(vma, color: "orange")
-
wma()
-
wma: compute weighted moving average calculation
Examples
result = wma('Close', 50)
study("Hello World") field = input("Field", "Close") # Define the Period input for the study period = input("Period", 50) # Use the wma builtin that calculates a triangular moving average wma = wma(field, period) plot(wma, color: "orange")