adline(x:
Data):
ArrayParameters
x:
Data - Data object variable name whose Accumulation-Distribution (AD) is to be calculated.
Returns
Array - Accumulation-Distribution of Data object x.
Accumulation-Distribution (AD) was created by Larry Williams to track buying pressure (accumulation) and selling pressure (distribution). AD compares the range between the open and clsoe relative to the range of the day. It is a concept very closely related to Japanese candlestick charts.
Returns the AD of Data object x.
Example
data("x") // Use the data from the chart
myAD = adline(x) // Compute Accumulation-Distribution
period = 50 // Period to use with Bollinger Bands
width = 2.1 // Width to use with Bollinger Bands
middleBB = sma(myAD,period) // Compute middle Bollinger Band of myAD
upperBB = middleBB + (width*(stdev(myAD,period))) // Compute upper Bollinger Band of myAD
lowerBB = middleBB - (width*(stdev(myAD,period))) // Compute lower Bollinger Band of myAD
plotAD = plot(myAD,"AD","line","000000") // Plot object for myAD
plotUpperBB = plot(upperBB,"upperBB","line","CC0000") // Plot object for upper Bollinger Band of myAD
plotMiddleBB = plot(middleBB,"middleBB","line","0000FF") // Plot object for middle Bollinger Band of myAD
plotLowerBB = plot(lowerBB,"lowerBB","line","009900") // Plot object for lower Bollinger Band of myAD
chart(plotAD,plotUpperBB,plotMiddleBB,plotLowerBB) // Plot myAD with Bollinger Bands in a clip
adosc(x:
Data, period:
Number):
ArrayParameters
x:
Data - Data object variable name whose Accumulation-Distribution Oscillator (AD%) is to be calculated.
period:
Number - Accumulation-Distrubition Oscillator (AD%) period value.
Returns
Array - Accumulation-Distribution Oscillator (AD%) of Data object x.
Accumulation-Distribution Oscillator (AD%) is the closed form of Acculuation-Distrubtion (AD). AD% is calculated by taking the n-day sum of AD and dividing by the n-day sum of volume; the result is a normalized AD that is now comparable from issue to issue. Specify the number of days used in the calculation using Number object period. If a decimal value is entered for period, the function will drop the decimal part and use the integer part as the period in the calculation without warning.
Returns the AD% of Data object x.
Example
data("x") // Use the data from the chart
myADOsc = adosc(x,20) // 20-day AD%
plotMyADOsc = plot(myADOsc,"AD%","histogram") // Plot object for myADOsc
ref1 = plot(25,"","line","000000") // Plot object for 25% reference level
ref2 = plot(-25,"","line","000000") // Plot object for -25% reference level
chart(plotMyADOsc,ref1,ref2) // Plot myADOsc in a clip with reference levels
aroon(x:
Data, period:
Number, series:
String["up","down","oscillator"]):
ArrayParameters
x:
Data - Data object variable name whose Aroon Indicator (AR) is to be calculated.
period:
Number - Aroon Indicator (AR) period value.
series:
String["up","down","oscillator"] - String to specify what is returned. Must be one of "up", "down", or "oscillator" for Aroon Up, Aroon Down and Aroon Oscillator, respectively.
Returns
Array - If "up" is specified for series, the Aroon Up line of Data object x.
If "down" is specified for series, the Aroon Down line of Data object x.
If "oscillator" is specified for series, the Aroon Oscillator of Data object x.
Aroon Indicator (AR), develoepd by Tushar Chande, is designed to identify direction and magnitude of a trend. AR consists of three lines: Aroon Up, Aroon Down, and Aroon Oscillator. Specify the lookback period value using Number object period. If a decimal value is entered for period, the function will drop the decimal part and use the integer part as the period in the calculation without warning.
Aroon Up line above 70 indicates an up trend, Aroon Down line above 70 indicatoes a down trend and Arooon Oscillator line near zero indicates a consolidation phase (no trend). The idea is to count the number of days since the high of the range (this is the Aroon Up line) and the low of the range (this is the Aroon Down line). it is a simple concept that produces suprisingly deep market insight.
Returns the Aroon Up line of Data object x if String object series is "up", returns the Aroon Down line of Data object x if String object series is "down", and returns the Aroon Oscillator line of Data object x if String object series is set to "oscillator".
Example
data("x") // Use the data from the chart
myARup = aroon(x,20,"up") // 20-day Aroon Up
myARdown = aroon(x,20,"down") // 20-day Aroon Down
myARosc = aroon(x,20,"oscillator") // 20-day Aroon Oscillator
plotARup = plot(myARup,"20-Day AR Up","line","00CC00") // Plot object for myARup
plotARdown = plot(myARdown,"20-Day AR Down","line","CC0033") // Plot object for myARdown
plotARosc = plot(myARosc,"20-Day AR%","line","000000") // Plot object for myARosc
chart(plotARup,plotARdown,plotARosc) // Plot myARup, myARdown, and myARosc in a clip
atr(x:
Data, n:
Number(optional)):
Array or
NumberParameters
x:
Data - Data object variable name whose average true range is to be calculated.
n:
Number(optional) - Average true range period value.
Returns
Returns the simple moving average Array of the true range of Data object x. if n is not provided, the total average of true range is returned.
Example
data("x")
period = 20
atrArray = atr(x,period)
print(atrArray)
atrTotal = atr(x)
print(atrTotal)
bbaccumulation(x:
Data, period:
Number, width:
Number):
ArrayParameters
x:
Data - Data object variable name whose BBAccumulation is to be calculated.
period:
Number - BBAccumulation length (period)
width:
Number - BBAccumulation width
Returns
Array - Bollinger Bands Accumulation of Data object x.
Bollinger Band Trend Accumulation...
Example
data("x") // Use the data from the chart
period = 20 // period
width = 2.0 // length
myBBAccum = bbaccumulation(x,period,width) // Compute BBAccumulation
myBBAccumplot = plot(myBBAccum,"BBAccum","histogram") // Plot object for myBBAccum
chart(myBBAccumplot) // Chart myBBAccum in a clip
bbands(x:
Data, period:
Number, width:
Number, series:
String["upper","middle","lower"]):
ArrayParameters
x:
Data - Data object variable name whose Bollinger Bands
® are to be calculated.
period:
Number - Period to compute the Bollinger Bands (default is 20).
width:
Number - Width to compute the Bollinger Bands (default is 2.0).
series:
String["upper","middle","lower"] - String to specify which Bollinger Band to be returned. Must be one of "upper", "middle", or "lower" for the upper band, middle band, or lower band, respectively.
Returns
Array - The specified band (upper, middle, or lower) of the Bollinger Bands for Data object x
Bollinger Bands are computed using parameters period and width. Period is the length of the simple moving average and width is the multiplier of standard deviation. An Array object of the specified band, taken as the series parameter, is returned.
If a decimal value is entered for period, the function will drop the decimal part and use the integer part as the period in the calculation without warning.
Example
data("x") // Use the data from the chart
period = 20 // Set the length
width = 2.0 // Set the width
upperBB = bbands(x,period,width,"upper") // Get the upper band
middleBB = bbands(x,period,width,"middle") // Get the middle band
lowerBB = bbands(x,period,width,"lower") // Get the lower band
myUpperBBPlot = plot(upperBB,"upperBB","line","00CC33") // Assign a plot function for the upper band
myMiddleBBPlot = plot(middleBB,"middleBB","line","3300CC") // Assign a plot function for the midle band
myLowerBBPlot = plot(lowerBB,"lowerBB","line","CC0033") // Assign a plot function for the lower band
pchart(myUpperBBPlot,myMiddleBBPlot,myLowerBBPlot) // Plot the bands to the price chart
bbimpulse(x:
Data, period:
Number, width:
Number, type:
String["bbands","benvelope"]):
ArrayParameters
x:
Data - Data object variable name whose BBImpulse is to be calcualted.
period:
Number - Period to compute the Bollinger Bands or Bollinger Envelopes (default is 20).
width:
Number - Width to compute the Bollinger Bands or Bollinger Envelopes (default is 2.0 for Bollinger Bands, 1.5 for Bollinger Envelopes).
type:
String["bbands","benvelope"] - String to specify the use of Bollinger Bands or Bollinger Envelopes in the calculation of BBImpulse. Must be one of "bbands" or "benvelope" for Bollinger Bands or Bollinger Envelopes, respectively.
Returns
Array - Bollinger Bands Impulse (BBImpulse, BBI) in percent of Data object x.
BBImpulse (BBI) is one of the newest Bollinger Bands indicators; it has also been adapted to Bollinger Envelopes. It is derived from %b (Percent b). Its value is the period change of %b (i.e., momentum of %b).
Returns the BBImpulse in percent of Data object x using period as the simple moving average and width as the standard deviation multiplier to compute Bollinger Bands or Bollinger Envelopes, whichever is specified by String object type. If a decimal value is entered for period, the function will drop the decimal part and use the integer part as the period in the calculation without warning.
Example
data("x") // Use the data from the chart
period = 10 // Set the length
width = 1.9 // Set the width
type = "benvelope" // Use Bollinger Envelopes
myBBI = bbimpulse(x,period,width,type) // Get the BBImpulse data and assign it to Array object myBBI
plotBBI = plot(myBBI,"BBI","histogram") // Assign a plot object for myBBI
plotRefUU = plot(40,"","line","000000") // Plot object for extreme upper reference level
plotRefU = plot(24,"","line","999999") // Plot object for upper reference level
plotRefL = plot(-24,"","line","999999") // Plot object for lower reference level
plotRefLL = plot(-40,"","line","000000") // Plot object for extreme lower reference level
chart(plotBBI,plotRefUU,plotRefU,plotRefL,plotRefLL) // Plot BBI with reference lines on a clip
bbindex(x:
Data, period:
Number):
ArrayParameters
x:
Data - Data object variable name whose BBIndex is to be calculated.
period:
Number - BBIndex period value.
Returns
Array - Bollinger Bands Index (BBIndex, BBX) of Data object x.
BBIndex (BBX) is the latest in a series of technical indicators derived from Bollinger Bands. BBX is a classic overought/oversold indicator similar in application to the Commodity Channel Index (CCI). Match the period to the trend you are trading, 20 is the default, and we use plus/minus 2.0 as the basic overbought/oversold reference levesl with plus/minus 3.0 as extreme levels.
Returns the BBIndex of Data object x using the specified period. If a decimal value is entered for the period, the function will drop the decimal part and use the integer part as the period in the calculation without warning.
Example
data("x") // Use the data from the chart
period = 20 // Set the length
myBBX = bbindex(x,period) // Get the BBIndex and assign it Array object myBBX
plotBBX = plot(myBBX,"BBX","histogram") // Assign a plot object for myBBX
plotRef3p = plot(3,"","line","000000") // Plot object for extreme overbought reference line
plotRef2p = plot(2,"","line","999999") // Plot object for overbought reference line
plotRef2m = plot(-2,"","line","999999") // Plot object for oversold reference line
plotRef3m = plot(-3,"","line","000000") // Plot object for extremem oversold reference line
chart(plotBBX,plotRef3p,plotRef2p,plotRef2m,plotRef3m) // Plot BBX with reference lines on a clip
bbmtm(x:
Data, period:
Number, width:
Number, period2:
Number, type:
String["bbands","benvelope"]):
ArrayParameters
x:
Data - Data object variable name whose BBMomentum is to be calculated.
period:
Number - Period to compute the Bollinger Bands or Bollinger Envelopes (default is 20).
width:
Number - Width to compute the Bollinger Bands or Bollinger Envelopes (default is 2.0 for Bollinger Bands, 1.5 for Bollinger Envelopes).
period2:
Number - BBMomentum period value.
type:
String["bbands","benvelope"] - String to specify the use of Bollinger Bands or Bollinger Envelopes in the calculation of BBMomentum. Must be one of "bbands" or "benvelope" for Bollinger Bands or Bollinger Envelopes, respectively.
Returns
Array - Bollinger Bands Momentum (BBMomentum, BBM) of Data object x.
BBMomentum (BBM) is one of the newest Bollinger Bands indicators; it has also been adapted to Bollinger Envelopes. It measures price moves os a function of the width of Bollinger Bands or Bollinger Envelopes. BBM's value is the periodic change divided by the upper band or envelope minus the lower band or envelope. A good starting place is half the length of the Bollinger Bands or Bollinger Envelopes calculation.
BBM normalizes momentum using the width of the Bollinger Bands or Bollinger Envelopes. In volatile times it takes a large change in price to create the same BBM reading that a much smaller change would create in calm times. BBM can be thought of as a form of volatility-normalized momentum and can be used the way any other momentum indicator is used.
Returns the BBM of Data object x using period as the simple moving average and width as the standard deviation multiplier to compute Bollinger Bands or Bollinger Envelopes, whichever is specified by String object type , with period2 as the BBM period value. If a decimal is used for period or period2, the function will drop the decimal part and use the integer part as period or period2 in the calculation without warning.
Example
data("x") // Use the data from the chart
period = 20 // Set the length
width = 1.5 // Set the width
period2 = 10 // Set the BBM period
type = "benvelope" // Use Bollinger Envelopes
myBBM = bbmtm(x,period,width,period2,type) // Compute BBM
myBBMplot = plot(myBBM,"BBM","line","000000") // Plot object for myBBM
chart(myBBMplot) // Plot myBBM in a clip
bbpersist(x:
Data, period:
Number, width:
Number, lookback:
Number, type:
String["bbands","benvelope"]):
ArrayParameters
x:
Data - Data object variable name whose BBPersist is to be calculated.
period:
Number - Period to compute the Bollinger Bands or Bollnger Envelopes (default is 20).
width:
Number - Width to compute the Bollinger Bands or Bollinger Envelopes (default is 2.0 for Bollinger Bands, 1.5 for Bollinger Envelopes).
lookback:
Number - BBPersist lookback period.
type:
String["bbands","benvelope"] - String to specify the use of Bollinger Bands or Bollinger Envelopes in the calculation of BBPersist. Must be one of "bbands" or "benevelope" for Bollinger Bands or Bollinger Envelopes, respectively.
Returns
Array - BBPersist of Data object x.
BBPersist...
Example
data("x") // Use the data from the chart
period = 20 // Set the length
width = 2.0 // Set the width
lookback = 125 // Set the lookback period
type = "benvelope" // Use Bollinger Envelopes
myBBPersist = bbpersist(x,period,width,lookback,type) // Get the BBPersist data and assign it to Array object myBBPersist
plotBBPersist = plot(myBBPersist,"BBPersist","histogram") // Assign a plot object for myBBPersist
chart(plotBBPersist) // Plot BBPersist in a clip
bbstops(x:
Data, entry_date:
String["YYYY-MM-DD"], trade_type:
Number[1,-1], af_step:
Number, af_max:
Number, beOffset:
Number):
ArrayParameters
x:
Data - Data object variable name whose BBStop is to be calculated
entry_date:
String["YYYY-MM-DD"] - String object variable of the date of trade entry in "YYYY-MM-DD" format
trade_type:
Number[1,-1] - Number object variable to specify the type of trade: 1 for long, -1 for short.
af_step:
Number - Number object variable name specifying the AF step value (default is 0.02)
af_max:
Number - Number object variable name specifying the maximum AF value (default is 0.20)
beOffset:
Number - Nnumber that specifies the BE offset( multiplier for the upper or lower Bollinger Envelope).
Returns
Array - BBStops entry and exit signals for Data object x.
BBStops™ are an adaptation of the stops included in Welles Wilder's Parabolic Price Time System. These stops increment both with the passage of time and the progress of the trade. They start at an interval above/below the entry day as a function of Bollinger Envelopes and then progress automatically as time passes and as price changes. If the entry is a buy, BBStops start beneath entry at an interval determined by the lower Bollinger Envelope calculation. For a sell the interval is a value above the entry determined by the upper Bollinger Envelope calculation. You chose the Bollinger Envelope multiplier. The default is 1.5.
Example
data("x") // Use the data from the chart
myCloses = close(x)
BBS = bbstops(x,"2012-01-02",1,0.04,0.44,1.5) // Generate bbstop signals for the data. The trade is long starting on January 2, 2012, using an AF step of 0.04 and a maximum AF of 0.44. The multiplier is 1.5.
plotBBS = plot(myCloses,"BBStop","line","00000000",BBS) // Anchor the bbstop signals to the closes (the line will not be shown but the signals will)
pchart(plotBBS) // Plot the bbstops signals on the price chart
bbtrend(x:
Data, period1:
Number, period2:
Number):
ArrayParameters
x:
Data - Data object variable name whose BBTrend is to be calculated.
period1:
Number - BBTrend short period value.
period2:
Number - BBTrend long period value.
Returns
Array - Bollinger Bands Trend (BBTrend, BBT) of Data object x.
Bollinger Band Trend (BBTrend) takes advantage of the ways in which Bollinger Bands of various lengths interact to determine whether the market is trending or not. Amongst commonly used technical indicators, ADX and Choppiness serve similar purposes.
Two time periods must be specified. The Number object period1 is the "short" period and Number object period2 is the "long" period. 20 and 50 are the defaults, but 10 and 30 or 40 may be more attractive for shorter-term traders.
Unlike the traditional trend indicators, BBTrend combines directional information with the trend information. Readings below zero are indiciative of negative trends and readings above sero are indicative of positive trends.
Returns BBT of Data object x using period1 as the short-term BBT period value and period2 as the long-term BBT period value. If a decimal value is entered for period1 or period2, the function will drop the decimal part and use the integer part as period1 or period2 in the calculation without warning.
Example
data("x") // Use the data from the chart
shortPeriod = 10 // Short period
longPeriod = 30 // Long period
myBBT = bbtrend(x,shortPeriod,longPeriod) // Compute BBTrend
myBBTplot = plot(myBBT,"BBT","histogram") // Plot object for myBBT
chart(myBBTplot) // Chart myBBT in a clip
benvelope(x:
Data, period:
Number, width:
Number, series:
String["upper","middle","lower"]):
ArrayParameters
x:
Data - Data object variable name whose Bollinger Envelope is to be calculated.
period:
Number - Period to compute the Bollinger Envelope (default is 20)
width:
Number - Width to compute the Bollinger Envelopes (default is 1.5).
series:
String["upper","middle","lower"] - String to specify which Bollinger Envelope to be returned. Must be one of "upper", "middle", or "lower" for the upper envelope, middle envelope, or lower envelope, respectively.
Returns
Array - The specified envelope (upper, middle, or lower) of the Bollinger Envelopes for Data object x
Bollinger Envelopes are a variation on Bollinger Bands that focus on the extremes of price action. While Bollinger Bands are centered on a moving average, usually of closing prices, Bollinger Envelopes are anchored by the extremes: the highs and the lows.
The upper Bollinger Envelope is constructed froma moving average of the highs and the standard deviation of the highs; the lower Bollinger Envelope is construted from a moving average of the lows and the standard deviation of the lows. The middle Bollinger Envelope is implied by taking a mean of the upper and lower Bollinger Envelopes.
Returns the specified Bollinger Envelope of Data object x using period as the simple moving average period and width as the multiplier of standard deviation. If a decimal value is entered for period, the function will drop the decimal part and use the integer part as the period in the calculation without warning.
Example
data("x") // Use the data from the chart
period = 20 // Set the length
width = 1.5 // Set the width
upperBE = benvelope(x,period,width,"upper") // Get the upper envelope
middleBE = benvelope(x,period,width,"middle") // Get the middle envelope
lowerBE = benvelope(x,period,width,"lower") // Get the lower envelope
myUpperBEPlot = plot(upperBE,"upperBE","line","00CC33") // Assign a plot object for the upper band
myMiddleBEPlot = plot(middleBE,"middleBE","line","3300CC") // Assign a plot object for the middle band
myLowerBEPlot = plot(lowerBE,"lowerBE","line","CC0033") // Assign a plot object for the lower band
pchart(myUpperBEPlot,myMiddleBEPlot,myLowerBEPlot) // Plot the envelopes on the price chart.
bwdelta(x:
Data, period:
Number, width:
Number, period2:
Number, type:
String["bbands","benvelope"]):
ArrayParameters
x:
Data - Data object variable name whose BandWidth Delta is to be calculated.
period:
Number - Period to compute the Bollinger Bands or Bollinger Envelopes (default is 20).
width:
Number - Width to compute the Bollinger Bands or Bollinger Envelopes (default is 2.0 for Bollinger Bands, 1.5 for Bollinger Envelopes).
period2:
Number - BandWidth Delta period value.
type:
String["bbands","benvelope"] - String to specify the use of Bollinger Bands or Bollinger Envelopes in the calculation of BandWidth Delta. Must be one of "bbands" or "benvelope" for Bollinger Bands or Bollinger Envelopes, respectively.
Returns
Array - BandWidth Delta of Data object x.
BandWidth Delta (BWD) depcits the n-period momentum in BandWidth (BW) and is useful in diagnosing the peaks and troughs in BW as markers of potnetial trend changes. This indicator is especially useful when trying to analyze the potential for consolidations or reversals after large moves. You can think of BWD as a magnifying glass for BW.
Returns the BWD of Data object x using period as the simple moving average and width as the standard deviation multiplier to compute Bollinger Bands or Bollinger Envelopes, whichever is specified by String object type, with period2 as the BWD period value. If a decimal is entered for period or period2, the function will drop the decimal part and use the integer part as period and period2 in the calculation without warning.
Example
data("x") // Use the data from the chart
periodA1 = 20 // Set the length
widthA = 2.0 // Set the width
periodA2 = 1 // Set the bwdA period
periodB1 = 50 // Set the length
widthB = 2.1 // Set the width
periodB2 = 5 // Set the bwdB period
type = "bbands" // Use Bollinger Bands to compute bwdA and bwdB
bwdA = bwdelta(x,periodA1,widthA,periodA2,type) // Get first BWD
bwdB = bwdelta(x,periodB1,widthB,periodB2,type) // Get second BWD
plotbwdA = plot(bwdA,"bwdA","line","00FF00") // plot object for bwdA
plotbwdB = plot(bwdB,"bwdB","line","FF00FF") // plot object for bwdB
chart(plotbwdA,plotbwdB) // Chart both bwdA and bwdB in the same clip
bwdth(x:
Data, period:
Number, width:
Number, type:
String["bbands","benvelope"]):
ArrayParameters
x:
Data - Data object variable name whose BandWidth is to be calculated.
period:
Number - Period used to compute Bollinger Bands or Bollinger Envelopes (default is 20).
width:
Number - Width to compute Bollinger Bands or Bollinger Envelopes (default is 2.0 for Bollinger Bands, 1.5 for Bollinger Envelopes)
type:
String["bbands","benvelope"] - String to specify the use of Bollinger Bands or Bollinger Envelopes in the calculation of BandWidth. Must be one of "bbands" or "benvelope" for Bollinger Bands or Bollinger Envelopes, respectively.
Returns
Array - The width of the Bollinger Bands or Bollinger Envelopes as a function of the middle band or envelope.
This was the first indicator derived from Bollinger Bands; it has also been adapted to Bollinger Envelopes. BandWidth depicts how wide the Bollinger Bands or Bollinger Envelopes are as a function of the middle band or envelope. The most popular use of BandWidth is to identify a Squeeze or a Bulge.
Returns the BandWidth of Data object x using period as the simple moving average period and width as the standard deviation multiplier to compute Bollinger Bands or Bollinger Envelopes, whichever is specified by String object type. If a decimal value is entered for period, the function will drop the decimal part and use the integer part as the period in the calculation without warning.
Example
data("x") // Use the data from the chart
period = 20 // Set the length
width = 2.0 // Set the width
type = "bbands" // Use Bollinger Bands in the calculation of BandWidth
myBW = bwdth(x,period,width,type) // Get BandWidth and store it in Array object myBW
mySmoothBW = ema(myBW,21) // Get a 21-day exponential moving average of myBW and store it in Array object mySmoothBW
plotBW = plot(myBW,"BandWidth","line","000000") // Assign a plot object for myBW
plotSmoothBW = plot(mySmoothBW,"EMA","line","00FF00") // Assign a plot object for mySmoothBW
chart(plotBW,plotSmoothBW) // Plot myBW and mySmoothBW in the same clip
cci(x:
Data, period:
Number):
ArrayParameters
x:
Data - Data object variable name whose Commodity Channel Index (CCI) is to be calculated.
period:
Number - Commodity Channel Index (CCI) period value.
Returns
Array - Commodity Channel Index (CCI) of Data object x.
Commodity Channel Index (CCI) is a sophisticated overbought/oversold tool that uses volatility as its gauge. It uses an old scaling convention derived from its commodity futures market heritage. Specify the CCI period value using Number object period. If a decimal value is entered for period, the function will drop the decimal part and use the integer part as the period in the calculation without warning.
Returns the CCI of Data object x.
Example
data("x") // Use the data from the chart
myCCI = cci(x,14) // 14-period CCI
plotCCI = plot(myCCI,"CCI","line","000000") // Plot object for myCCI
refOB = plot(100,"","line","FF0000") // Overbought reference line (+100)
refOS = plot(-100,"","line","00FF00") // Oversold reference line (-100)
chart(plotCCI,refOB,refOS) // Chart myCCI and reference lines in a clip
chandelierstops(x:
Data, entry_date:
String["YYYY-MM-DD" or "YYYY-MM-DD HH:MM"], trade_type:
Number[1,-1], m:
Number, n:
Number, always_in:
Number[1,0]):
ArrayParameters
x:
Data - Data object variable name whose Chandelier stop is to be calculated
entry_date:
String["YYYY-MM-DD" or "YYYY-MM-DD HH:MM"] - String object variable of the date of trade entry in "YYYY-MM-DD" or "YYYY-MM-DD HH:MM." The latter is helpful for ForEx data.
trade_type:
Number[1,-1] - Number object variable to specify the type of trade: 1 for long, -1 for short.
m:
Number - Number object variable specifying the period to compute Average True Range (ATR) (default is 10).
n:
Number - Number object variable specifying the multiplication factor of Average True Range (ATR) in the stop calculation (default is 3).
always_in:
Number[1,0] - Number ojbect variable name specifying whether the trade is always in the market (1] or not (0).
Returns
Array - Chandelier stops entry and exit signals for Data object x.
Chandelier stops were popularized by Cuck LeBeau. They are dynamic, progressive stops that cna be calculated starting with the period after you enter a trade. The formulas are simple and robust. For sell stops when you are long the stop is the highest high since you netered the trade less n times the m-day Average True Range (ATR). For buy stops when you are short the stop is the lowest low since you entered the trade plus n times the m-day ATR. The usual defaults are n = 3 and m = 10, so that means a "normal" Chandelier sell stop is the highest high since entry less three times the 10-period ATR.
Chandelier stops can be computed each period an open position is hed as ATR will change even if a new high (when long) or low (when short) since entry isn't recorded. One question that often comes up is whether to allow the stop to back off? For example, if this period's stop for a short position is 33.35 and next period's is 33.5 due to an expansion in ATR, should we stick with the more conservative stop of 33.35 or allow it to back off a bit to 33.5? Chuck LeBeau's answer is that backing off is a feature of Chandelier stops that should be allowed and that is good enogh for us.
This function returns the buy and sell signals. The signals can be computed for a single trade ("always_in=0") or as a trading system always in the market ("always_in=1") from the entry date specified.
Example
data("x") // Use the data from the chart
myCloses = close(x) // An array of closes
myStop = chandelierstops(x,"2012-01-02",-1,15,3.5,0) // Entered a short trade on January 2, 2012; compute the Chandelier stop for this trade only using a 15-day ATR and 3.5 multiplication factor
plotStop = plot(myCloses,"Chandelier stop","line","00000000",myStop) // Anchor the Chandelier stop to the closes (line will not display but signal will)
pchart(plotStop) // Plot the Chandelier stop on the price chart
chop(x:
Data, period:
Number):
ArrayParameters
x:
Data - Data object variable name whose Choppiness Index (CI) is to be calculated.
period:
Number - Choppiness Index (CI) period value.
Returns
Array - Choppiness Index (CI) of Data object x.
Choppiness Index (CI), developed by E.W. Dreiss, uses chaos principles to measure "choppiness" or directionality of the market, whether prices are trending or we are in a period of trendless consolidation. The core idea is to compare the combined length of all the bars in a range (the ink) with the range itself. Low values (below 38) indicate trending markets (up or down) and high values (above 62) indicate significant consolidations. Specify the CI period value using Number object period. If a decimal value is entered for period, the function will drop the decimal part and use the integer part as the period in the calculation without warning.
Returns the CI of Data object x.
Example
data("x") // Use the data from the chart
period = 14 // Use 14 as the calculation period
myCI = chop(x,period) // 14-period CI
plotCI = plot(myCI,"CI","line","000000") // Plot object for myCI
chart(plotCI) // Chart myCI in a clip
cmo(x:
Data, period:
Number):
ArrayParameters
x:
Data - Data object variable name whose Chande Momentum Oscillator (CMO) is to be calculated.
period:
Number - Chande Momentum Oscillator (CMO) period value.
Returns
Array - Chande Mometum Oscillator (CMO) of Data object x.
Chande Momentum Oscillator (CMO) is Tushar Chande's attempt to capture Pure Momentum. The idea is to separately sum up and down momentum over a given period and compare them with a normalized ratio. Specify the lookback period using Number object period. If a decimal value is entered for period, the function will drop the decimal part and use the integer part as the period in the calculation without warning.
Returns the CMO of Data object x.
Example
data("x") // Use the data from the chart
myCMO = cmo(x,14) // 14-period CMO
plotCMO = plot(myCMO,"CMO","histogram") // Plot object for CMO
chart(plotCMO) // Chart myCMO in a clip
conviction(x:
Data, period:
Number):
ArrayParameters
x:
Data - Data object variable name whose Alphier Conviction curve is to be calculated.
period:
Number - Alphier Conviction period value.
Returns
Array - Alphier Conviction curve of Data object x.
Alphier Conviction is a classic divergence indicator, implemented only as Jim Alphier might have, that works by providing a comparison of the counts of plus and minus days versus the actual gains recorded. Classic divergence analysis is at is best here. Specify the period used in the calculation using Number object period. If a decimal value is entered for period, the function will drop the decimal part and use the integer part as the period in the calculation without warning.
Returns the Alphier Conviction curve of Data object x.
Example
data("x") // Use the data from the chart
myConviction = conviction(x,50) // 50-period Alphier Conviction
plotConviction = plot(myConviction,"Alphier Conviction","line","000000") // Plot object for myConviction
chart(plotConviction) // Chart myConviction in a clip
departure(x:
Data, period1:
Number, period2:
Number):
ArrayParameters
x:
Data - Data object variable name whose Departure Chart (DC) is to be calculated.
period1:
Number - Departure Chart (DC) short period value.
period2:
Number - Departure Chart (DC) long period value.
Returns
Array - Departure Chart (DC) of Data object x.
The Departure Chart (DC) is one of the oldest technical studies. Its primary use is as a trend identification tool, but it is also often employed to idnetify overbought and oversold conditions. The DC measures the difference between two moving averages of a data series, one short and one long. Specify the DC short period value with Number object period1; specify the DC long period value with Number object period2. If a decimal value is entered for period1 or period2, the function will drop the decimal part and use the integer part as period1 or period2 in the calculation without warning.
Returns the DC of data object x.
Example
data("x") // Use the data from the chart
myDC = departure(x,10,20) // Short period = 10, long period = 20
plotDC = plot(myDC,"Departure Chart","histogram") // Plot object for myDC
chart(plotDC) // Plot myDC in a clip
dfa(x:
Data, period:
Number):
ArrayParameters
x:
Data - Data object variable name whose Deviation from Average is to be calculated.
period:
Number - Deviation from Average period value.
Returns
Array - Deviation from Average of Data object x.
The most basic overbought/oversold tool. Deviation from Average expresses how far a data series has deviated from the mean as measured by an n-day average. If a decimal value is entered for period, the function will drop the decimal part and use the integer part as the period in the calculation without warning.
Returns the Deviation from Average in percent of Data object x.
Example
data("x") // Use the data from the chart
myDFA = dfa(x,50) // 50-period average
plotDFA = plot(myDFA,"DFA","histogram") // Plot object for myDFA
chart(plotDFA) // Plot myDFA in a clip
dmi(x:
Data, period:
Number, series:
String["adx","dmiplus","dmiminus"]):
ArrayParameters
x:
Data - Data object variable name whose Directional Movement Index (DMI) is to be calculated.
period:
Number - Directional Movement Index (DMI) period value.
series:
String["adx","dmiplus","dmiminus"] - String to specify what is to be returned. Must be one of "adx", "dmiplus", or "dmiminus" for Average Directional Index (ADX), Plus Directional Movement Index (DMI+), or Minus Directional Movement Index (DMI-), respectively.
Returns
Array - If "adx" is specified for series, the Average Directional Index (ADX) of Data object x.
If "dmiplus" is specified for series, the Plus Directional Movement Index (DMI+) of Data object x. If "dmiminus" is specified for eseries, the Minus Directional Movement Index (DMI-) of Data object x.
Created by Welles Wilder, these indicators parse the price structure into plus and minus components, Plus Directional Movement Index (DMI+) and Minus Directional Movement Index (DMI-). Howeveer, the most interesting feature is a derivative of the DMI indeces called Average Directional Index (ADX). ADX indicates whether the data is trending or not. Values above 18 are considered to indicate trending markets while values below 18 are associated with trading-range markets. Specify the calcualtion lookback period using Number object period. If a deimal value is entered for period, the function will drop the decimal part and use the integer part as the period in the calculation without warning.
Returns the DMI+ of Data object x if String object series is "dmiplus", returns the DMI- of Data object x if String object series is "dmiminus", and returns the ADX of Data object x if String object series is set to "adx".
Example
data("x") // Use the data from the chart
plusDMI = dmi(x,14,"dmiplus") // 14-Day DMI+
minusDMI = dmi(x,14,"dmiminus") // 14-day DMI-
ADX = dmi(x,14,"adx") // 14-day ADX
plusDMIplot = plot(plusDMI,"DMI+","line","000000") // Plot object for plusDMI
minusDMIplot = plot(minusDMI,"DMI-","line","CC0033") // Plot object for minusDMI
ADXplot = plot(ADX,"ADX","histogram") // Plot object for ADX
chart(plusDMIplot,minusDMIplot,ADXplot) // Plot plusDMI, minusDMI, and ADX in a clip
expectation(x:
Data, series:
String["expect","signal"]):
ArrayParameters
x:
Data - Data object variable name whose Alphier Expectation is to be calculated.
series:
String["expect","signal"] - String to specify what is returned. Must be one of "expect" or "signal" for Alphier Expectation curve or Alphier Expectation Alerts, respectively.
Returns
Array - If "exepct" is specified for series, the Alphier Expectation curve of Data object x. If "signal" is specified, the Alphier Expectation Alerts for Data object x.
This function will return the Alphier Expectation curve or signal data. The Alphier Exectation curve is a supply-demand calculation along the lines of Accumulation-Distribution or Intraday Intensity. Use it as you would any other supply-demand tool - volume is not a factor. If "expect" is specified, an Array for Data object x will be returned. The Array will contain the values of the Alphier Expectation line.
If "signal" is specified, an Array for Data object x will be returned. The Array will contain the following:
0: no signal
-5: 200 Sell Rule
-4: Major Shift Sell
-3: Sell from 200
-2: Sell Signal
-1: Sell Alert
5: 0 Buy Rule
4: Major Shift Buy
3: Buy from 0
2: Buy Signal
1: Buy Alert
The above signals are generated based on rules we have implemented.
Example
data("x") // Use the data from the chart
myClose = close(x) // An array of closes
myExpectationCurve = expectation(x,"expect") // Get the Expectation curve
myExpectationAlerts = expectation(x,"signal") // Get the Expectation signals
PlotCurve = plot(myExpectationCurve,"myExpectCurve","line","000000") // Plot object to plot the Expectation Curve
PlotAlerts = plot(myClose,"","line","00000000",myExpectationAlerts) // Plot object to anchor the Expectation Alerts to the closes (line will not be shown, but alerts will)
chart(PlotCurve) // Plot the Expectation Curve in a clip
pchart(PlotAlerts) // Plot the Expectation Alerts on the price chart
ialine(x:
Data):
ArrayParameters
x:
Data - Data object variable name whose Interday Accumulation (IA) is to be calculated.
Returns
Array - Interday Accumulation (IA) of Data object x.
Interday Accumulation (IA) is a version of Accumulation-Distrubtion (AD) that uses true highs and true lows instead of period highs and period lows in its calculation. If you trade something that has frequent and/or large gaps, you may want to use this instead of AD.
Returns the IA of Data object x.
Example
data("x") // Use the data from the chart
myIA = ialine(x) // Compute Interday Accumulation
myIAplot = plot(myIA,"IA","line","000000") // Plot object for myIA
chart(myIAplot) // Plot myIA in a clip
iaosc(x:
Data, period:
Number):
ArrayParameters
x:
Data - Data object variable name whose Interday Accumulation Oscillator (IA%) is to be calculated.
period:
Number - Interday Accumulation Oscillator (IA%) period value.
Returns
Array - Interday Accumulation Oscillator (IA%) of data object x.
Interday Accumulation Oscillator (IA%) is the closed form of Interday Accumulation (IA). IA% is created by taking the n-day sum of IA and dividing by the n-day sum of volume; the result is a normalized IA that is comparable from issue to issue. Specify the IA% period value using Number object period. If a decimal value is entered for period, the function will drop the decimal part and use the integer part as the period in the calculation without warning.
Returns the IA% of Data object x.
Example
data("x") // Use the data from the chart
period = 21 // Use 21 for calculation period
myIAOsc = iaosc(x,period) // 21-period IA%
plotIAOsc = plot(myIAOsc,"IA%","histogram") // Plot object for myIAOsc
chart(plotIAOsc) // Chart myIAOsc in a clip
icebreaker(tdata:
Data, sdata:
Data):
ArrayParameters
tdata:
Data - Data object variable name that will be traded.
sdata:
Data - Data object variable name whose Ice Breaker Signals will be generated for.
Returns
Array - John Bollinger's Ice Breaker signals of Data object sdata to trade Data object tdata.
The Ice Breaker signal is generated using Bollinger Envelopes (BEs). A buy alert (1] is generated when the close penetrates the 10-day, 1.5 standard deviation lower BE, a condition considered as oversold. A sell alert (-1] is generated when the close penetrates the 10-day, 1.5 standard deviation upper BE, a condition considered as overbought.
Returns the Ice Breaker signals (an array of 1s, 0s, and -1s) of Data object sdata used to trade Data object tdata. A value of 1 is a buy signal, a value of 0 is no signal, and a value of -1 is a sell signal.
Example
data("x") // Use the data from the chart
data("ref","SPX") // Use SPX data
myIBSig = icebreaker(x,ref) // Trade x using signals generated for ref
myCloses = close(x) // An array of closes
plotIBSig = plot(myCloses,"Ice Breaker Signals","line","00000000",myIBSig) // Anchor the Ice Breaker Signals to the closes (line will not display but signals will)
pchart(plotIBSig) // Plot the Ice Breaker Signals on the price chart
iiline(x:
Data):
ArrayParameters
x:
Data - Data object variable name whose Intraday Intensity (II) is to be calculated.
Returns
Array - Intraday Intensity (II) of Data object x.
Intraday Intensity (II) was developed by the economist David Bostian. This indicator uses the position of the close in relation to the high and low to parse volume. It is meant to track the activities of institutional traders; large blocks move the market in the direction of their order flow -- increasingly so toward the close.
Returns the II of Data object x.
Example
data("x") // Use the data from the chart
myII = iiline(x) // Compute Intraday Intensity (II)
mtmPeriod = -9 // Period to compute Momentum of myII
myIImtm = myII[0]-myII[mtmPeriod] // Compute Momentum
plotIImtm = plot(myIImtm,"II Momentum","line","000000") // Plot object for myIImtm
chart(plotIImtm) // Plot myIImtm in a clip
iiosc(x:
Data, period:
Number):
ArrayParameters
x:
Data - Data object variable name whose Intraday Intensity Oscillator (II%) is to be calculated.
period:
Number - Intraday Intensity Oscillator (II%) period value.
Returns
Array - Intraday Intensity Oscillator (II%) of Data object x.
Intraday Intensity Oscillator (II%) is the closed form of Intraday Intensity (II). II% is calcualted by taking the n-day sum of II and dividing by the n-day sum of volume; the result is a normalized II that is now comparable from issue to issue. Specify the number of days used in the calculation using Number object period. If a decimal value is entered for period, the function will drop the decimal part and use the integer part as the period in the calculation without warning.
Returns the II% of Data object x.
Example
data("x") // Use the data from the chart
myIIOsc = iiosc(x,21) // 21-day II%
plotMyIIOsc = plot(myIIOsc,"II%","line","000000") // Plot object for myIIOsc
ref1 = plot(25,"","line","CCCCCC") // Plot object for 25% reference level
ref2 = plot(-25,"","line","CCCCCC") // Plot object for -25% reference level
chart(plotMyIIOsc,ref1,ref2) // Plot myIIOsc in a clip with reference levels
macd(x:
Data, p1:
Number, p2:
Number, p3:
Number, series:
String["macd","signal"]):
ArrayParameters
x:
Data - Data object variable name whose Moving Average Convergence-Divergence (MACD) is to be calculated.
p1:
Number - Short period value
p2:
Number - Long period value.
p3:
Number - Singal period value.
series:
String["macd","signal"] - String to specify what is to be returned. Must be one of "macd" or "signal" for Moving Average Convergence-Divergence (MACD) or Signal line, respectively.
Returns
Array - If "macd" is specified for series, the Moving Average Convergence-Divergence (MACD) of Data object x.
If "signal" is specified for series, the MACD Signal of Data object x.
Gerald Appel created Moving Average Convergencve-Divergence (MACD), a departure chart with an additional average added that acts as a signal line. The MACD curve is the difference between a short- and long-period exponential moving average. This signal line is an exponential moving average of the MACD curve.
Specify the MACD short period value using Number object p1, specify the MACD long period value using Number object p2, and specify the signal line exponential moving average period value using Number object p3. If a decimal is entered for p1, p2 or p3, the function will drop the decimal part and use the integer part for p1, p2 or p3 in the calculation without warning.
Returns the MACD curve of Data object x if "macd" is specified by String object type, or returns the MACD Signal line of Data object x if "signal" is specified for String object type.
Example
data("x") // Use the data from the chart
myMACDcurve = macd(x,24,50,12,"macd") // MACD curve using 24- and 50-day exponential moving averages and 12-day signal line
myMACDsignal = macd(x,24,50,12,"signal") // Signal line using 24-day and 50-day exponential moving averages and 12-day signal line
MACDdiff = myMACDcurve - myMACDsignal // Difference between MACD curve and MACD Signal line
plotMACDcurve = plot(myMACDcurve,"MACD","line","000000") // Plot object for myMACDcurve
plotMACDsignal = plot(myMACDsignal,"Signal","line","FF0000") // Plot object for myMACDsignal
plotMACDdiff = plot(MACDdiff,"Difference","histogram") // Plot object for MACDdiff
chart(plotMACDcurve,plotMACDsignal,plotMACDdiff) // Plot myMACDcurve, myMACDsignal and MACDdiff in a clip
mfi(x:
Data, period:
Number):
ArrayParameters
x:
Data - Data object variable name whose Money Flow Index (MFI) is to be calculated.
period:
Number - Money Flow Index (MFI) period value.
Returns
Array - Money Flow Index (MFI) of Data object x in an Array object.
Money Flow Index (MFI) compares volume on up days to volume on down days in a manner similar to Relative Strength Index (RSI). The typical price, (high+low+close)/3, is used to separate up periods from down. The periods are averaged and a ratio of up to down is taken. Specify the number of days used in the calculation using Number object period. If a decimal value is entered for period, the function will drop the decimal part and use the integer part as the period in the calculation without warning.
Returns the MFI of Data object x.
Example
data("x") // Use the data from the chart
myMFI1 = mfi(x,14) // 14-day MFI
myMFI2 = mfi(x,50) // 50-day MFI
MFIdiff = myMFI1-myMFI2 // Difference between 14-day MFI and 50-day MFI
plotMFI1 = plot(myMFI1,"14-day MFI","line","000000") // Plot object for myMFI1
plotMFI2 = plot(myMFI2,"50-day MFI","line","00CC00") // Plot object for myMFI2
plotMFIdiff = plot(MFIdiff,"Delta","histogram") // Plot object for MFIdiff
chart(plotMFI1,plotMFI2,plotMFIdiff) // Plot myMFI1, myMFI2, MFIdiff in a clip
mtm(x:
Data, period:
Number):
ArrayParameters
x:
Data - Data object variable name whose Momentum is to be calculated.
period:
Number - Mometum period value.
Returns
Array - Momentum (MTM) of Data object x.
Momentum (MTM) is the point change of a data series over a specified time period. This may be the most elemental indicator in the technician's tool chest. Specify the period to compute MTM using Number object period. If a decimal value is entered for period, the function will drop the decimal part and use the integer part as the period in the calculation without warning.
Returns the MTM of Data object x.
Example
data("x") // Use the data from the chart
MTM1 = mtm(x,5) // 5-period MTM
MTM2 = mtm(x,20) // 20-period MTM
MTMdiff = MTM1-MTM2 // difference of 5- and 20-day MTM
plotMTM1 = plot(MTM1,"5-period MTM","line","000000") // Plot object for MTM1
plotMTM2 = plot(MTM2,"20-period MTM","line","FFBF00") // Plot object for MTM2
plotMTMdiff = plot(MTMdiff,"Delta","histogram") // Plot object for MTMdiff
chart(plotMTM1,plotMTM2,plotMTMdiff) // Plot MTM1, MTM2 and MTMdiff in a clip
normvol(x:
Data, period:
Number):
ArrayParameters
x:
Data - Data object variable name whose Normalized Volume (Vol%) is to be calculated.
period:
Number - Normalized Volume (Vol%) period value.
Returns
Array - Normalized Volume (Vol%) of Data object x.
Normalized volume (Vol%) is volume divided by an average, specified by Number object period.
Returns the Vol% of Data object x. When volume equals its average volume, Vol% is 100. Above average volume is indicated by Vol% greater than 100; below average volume is indicated by Vol% less than 100. If a decimal value is entered for period, the function will drop the decimal part and use the integer part as the period in the calculation without warning.
Example
data("x") // Use the data from the chart
myNV1 = normvol(x,5) // 5 day normalized volume
myNV2 = normvol(x,10) // 10 day normalized volume
myNV3 = normvol(x,25) // 25 day normalized volume
myNV4 = normvol(x,50) // 50 day normalized volume
plotNV1 = plot(myNV1,"5-day Vol%","line","000000") // Plot object for myNV1
plotNV2 = plot(myNV2,"10-day Vol%","line","00CC00") // Plot object for myNV2
plotNV3 = plot(myNV3,"25-day Vol%","line","0000CC") // Plot object for myNV3
plotNV4 = plot(myNV4,"50-day Vol%","line","00CCCC") // Plot object for myNV4
chart(plotNV1,plotNV2,plotNV3,plotNV4) // Plot myNV1, myNV2, myNV3, myNV4 in a clip
nrsi(x:
Data, period:
Number):
ArrayParameters
x:
Data - Data object variable name whose Normalized Relative Strength Index (NRSI) is to be calculated.
period:
Number - Normalized Relative Strength Index (NRSI) period value.
Returns
Array - Normalized Relative Strenght Index (NRSI) of Data object x. Normalization is performed using 50-day, 2.1 standard deviation Bollinger Bands.
See Relative Strength Index (RSI) Plotting 50-day, 2.1 standard deviation Bollinger Bands on Relative Strength Index (RSI) allows the analyst to dispense with fixed levels and focus on indicator action. The upper band serves the same role as RSI 70 (overbought) and the lower band serves the same role as RSI 30 (oversold).
Here we go one stop further and create a Normalized RSI by plotting %b of RSI and 50-day Bollinger Bands. Specify the RSI period value used in the NRSI calculation using Number object period. If a decimal value is entered for period, the function will drop the decimal part and use the integer part as the period in the calculation without warning.
Returns the NRSI of Data object x.
Example
data("x") // Use the data from the chart
period = 14 // Use 14 as the calculation period
myNRSI = nrsi(x,period) // 14-Period NRSI
plotNRSI = plot(myNRSI,"NRSI","line","000000") // Plot object for myNRSI
ref0 = plot(0,"","line","808080") // Reference line at 0%
ref50 = plot(50,"","line","C0C0C0") // Reference line at 50%
ref100 = plot(100,"","line","808080") // Reference line at 100%
chart(plotNRSI,ref0,ref50,ref100) // Chart myNRSI with reference lines in a clip
obv(x:
Data):
ArrayParameters
x:
Data - Data object variable name whose On-Balance Volume (OBV) is to be calculated.
Returns
Array - On-Balance Volume (OBV) of Data object x.
This is one of the oldest and best known of all the volume indicators. On-Balance Volume (OBV) was poularized by Joe Granville and is a good trend indicator. OBV adds volume to a running sum when price advances and subtracts volume from the running sum when price declines. It is meant to model the basic forces of supply and demand.
Returns the OBV of Data object x.
Example
data("x") // Use the data from the chart
myOBV = obv(x) // Compute On-Balance Volume
rocPeriod = -5 // Period to compute Rate of Change of myOBV
myOBVroc = ((myOBV[0]-myOBV[rocPeriod])/myOBV[rocPeriod])*100 // Compute Rate of Change
plotOBVroc = plot(myOBVroc,"OBV RoC","histogram") // Plot object for myOBVroc
chart(plotOBVroc) // Plot myOBVroc in a price clip
parabolicstops(x:
Data, entry_date:
String["YYYY-MM-DD"], trade_type:
Number[1,-1], af_step:
Number, af_max:
Number):
ArrayParameters
x:
Data - Data object variable name whose Parabolic stop-and-reverse is to be calculated
entry_date:
String["YYYY-MM-DD"] - String object variable of the date of trade entry in "YYYY-MM-DD" format
trade_type:
Number[1,-1] - Number object variable to specify the type of trade: 1 for long, -1 for short.
af_step:
Number - Number object variable name specifying the AF step value (default is 0.02)
af_max:
Number - Number object variable name specifying the maximum AF value (default is 0.20)
Returns
Array - Parabolic stop and reversal entry and exit system signals for Data object x.
Welles wilder's Parabolic stop-and-reverse is a price and time trading system. The SAR (stop-and-reverse) indicator trails the price as the trend extends over tiem. In an uptrend the indicator rises below the price line while in a downtrend the indicator falls above the price line. When the price trend breaks below or above the indicator line, the indicator stops and reverses.
The function computes a sell signal when the price moves below a long stop and a buy signal when the price moves above a short stop.
The signals are computed as a trading system always in the market from the entry date specified.
Example
data("x") // Use the data from the chart
myCloses = close(x)
SAR = parabolicstops(x,"2012-01-02",1,0.04,0.44) // Generate stop-and-reverse signals for the data. The first trade is long starting on January 2, 2012, using an AF step of 0.04 and a maximum AF of 0.44.
plotSAR = plot(myCloses,"Stop-and-Reverse","line","00000000",SAR) // Anchor the stop-and-reverse signals to the closes (the line will not be shown but the signals will)
pchart(plotSAR) // Plot the stop-and-reverse signals on the price chart
perb(x:
Data, period:
Number, width:
Number, type:
String["bbands","benvelope"]):
ArrayParameters
x:
Data - Data object variable name whose %b is to be calculated.
period:
Number - Period to used to compute Bollinger Bands or Bollinger Envelopes (default is 20).
width:
Number - Width to compute Bollinger Bands or Bollinger Envelopes (default is 2.0 for Bollinger Bands, 1.5 for Bollinger Envelopes)
type:
String["bbands","benvelope"] - String to specify the use of Bollinger Bands or Bollinger Envelopes in the calculation of %b. Must be one of "bbands" or "benvelope" for Bollinger Bands or Bollinger Envelopes, respectively.
Returns
Array - The position of Data object x within Bollinger Bands or Bollinger Envelopes.
%b (Percent b) was the second indicator derived from Bollinger Bands; it has also been adapted to Bollinger Envelopes. It employs a variation of the formula for Stochastics. %b depcits the location of the most recent close within the Bollinger Bands or Bollinger Envelopes. At 1.0, the close is at the upper band or upper envelope, at 0.0 the close is at the lower band or lower envelope, and at 0.5 the close is at the middle band or middle envelope. A %b above 1.0 means that you are above the upper band or upper envelope, and a %b below 0.0 means that you are below the lower band or lower envelope.
%b is a useful tool for idnetifying divergences, diagnosing tops and bottoms, and pattern recognition. %b is also used extensively in trading system construction.
Returns %b of Data object x using period as the simple moving average period and width as the standard deviation multipler to compute Bollinger Bands or Bollinger Envelopes, whichever is specified by String object type. If a decimal value is entered for period, the function will drop the decimal part and use the integer part as the period in the calculation without warning.
Example
data("x") // Use the data from the chart
period = 50 // Set the length
width = 2.1 // Set the width
type = "bbands" // Use Bollinger Bands in the calculation of %b
myPerb = perb(x,period,width,type) // Get %b and store it in Array object myPerb
myPerb1 = ema(myPerb,5) // Get the 5-day exponential moving average of myPerb and store it in Array object myPerb1
myPerb2 = ema(myPerb1,5) // Get the 5-day exponential moving average of myPerb1 and store it in Array object myPerb2
plotPerb = plot(myPerb,"myPerb","line","000000") // Assign a plot object for myPerb
plotPerb1 = plot(myPerb1,"myPerb1","line","00FF00") // Assign a plot object for myPerb1
plotPerb2 = plot(myPerb2,"myPerb2","line","FF00FF") // Assign a plot object for myPerb2
chart(plotPerb,plotPerb1,plotPerb2) // Plot myPerb,myPerb1,myPerb2 in the same clip
perbw(x:
Data, period:
Number, width:
Number, period2:
Number, type:
String["bbands","benvelope"]):
ArrayParameters
x:
Data - Data object variable name whose %BandWidth is to be calculated.
period:
Number - Period to compute the Bollinger Bands or Bollnger Envelopes (default is 20).
width:
Number - Width to compute the Bollinger Bands or Bollinger Envelopes (default is 2.0 for Bollinger Bands, 1.5 for Bollinger Envelopes).
period2:
Number - %BandWidth lookback period.
type:
String["bbands","benvelope"] - String to specify the use of Bollinger Bands or Bollinger Envelopes in the calculation of %BandWidth. Must be one of "bbands" or "benevelope" for Bollinger Bands or Bollinger Envelopes, respectively.
Returns
Array - %BandWidth (Percent BandWidth) of Data object x.
%BandWidth (Percent BandWidth) uses the formula for Stochastics to normalize BandWidth (BW) as a function of its n-day lookback period. 1.0 equals the highest BW in the past n periods, while 0.0 equals the lowest BW in the past n periods. If you use 125 as the lookback period, then 0.0 = The Squeeze and 1.0 = The Bulge.
Interpretations are similar to BandWidth, but some find the normalized, or closed presentation more intuitive.
%BandWidth, along with %b, are two primary building blocks for Bollinger Band tranding systems.
Returns the %BandWidth in percent of Data object x using period as the simple moving average and width as the standard deviation multiplier to compute Bollinger Bands or Bollinger Envelopes, whichever is specified by String object type, with period2 as the lookback period value. If a decimal value is entered for period or lookback, the function will drop the decimal part and use the integer part for period and lookback in the calculation without warning.
Example
data("x") // Use the data from the chart
period = 20 // Set the length
width = 2.0 // Set the width
lookback = 125 // Set the lookback period
type = "benvelope" // Use Bollinger Envelopes
myPBW = perbw(x,period,width,lookback,type) // Get the %BandWidth data and assign it to Array object myPBW
plotPBW = plot(myPBW,"%BandWidth","line","000000") // Assign a plot object for myPBW
chart(plotPBW) // Plot %BandWidth in a clip
psychology(x:
Data, period:
Number):
ArrayParameters
x:
Data - Data object variable name whose Alphier Psychology curve is to be computed.
period:
Number - Alphier Psychology period value.
Returns
Array - Alphier Psychology curve of Data object x.
This is a short-term component of the Alphier Expectation curve that is more sensitive than Alphier Expectation. It is shorter-term in outlook and can be used on its own or to help anticiapte changes in the Alphier Expectation curve. Specify the Alphier Psychology period value using Number object period. If a decimal value is entered for period, the function will drop the decimal part and use the integer part as the period in the calculation without warning.
Returns the Alphier Psychology curve of Data object x.
Example
data("x") // Use the data from the chart
myAP = psychology(x,19) // Compute 19-period Alphier Psychology
plotAP = plot(myAP,"Alphier Psychology","line","000000") // Plot object for myAP
chart(plotAP) // Chart myAP in a clip
pvt(x:
Data):
ArrayParameters
x:
Data - Data object variable name whose Price-Volume Trend (PVT) is to be calculated.
Returns
Array - Prive-Volume Trend (PVT) of Data object x in an Array object.
Price-Volume Trend (PVT) is David Markstein's variation on On-Balance Volume (OBV) in which the percentage changes from period to period are used to parse volume.
Returns the PVT of Data object x.
Example
data("x") // Use the data from the chart
myPVT = pvt(x) // Compute Price-Volume Trend
myPVTs1 = ema(myPVT,3) // 3-day EMA of myPVT
myPVTs2 = ema(myPVTs1,3) // 3-day EMA pf myPVTs1
myPVTplot = plot(myPVT,"PVT","line","000000") // Plot object for myPVT
myPVTs1plot = plot(myPVTs1,"PVT(s1)","line","58FA58") // Plot object for myPVTs1
myPVTs2plot = plot(myPVTs2,"PVT(s2)","line","F781F3") // Plot object for myPVTs2
chart(myPVTplot,myPVTs1plot,myPVTs2plot) // Plot myPVT, myPVTs1, and myPVTs2 in a clip
qstk(x:
Data, period:
Number):
ArrayParameters
x:
Data - Data object variable name whose Qstick (QSTK) is to be calculated.
period:
Number - Qstick (QSTK) period value.
Returns
Array - Qstick (QSTK) of Data object x.
Qstick (QSTK) is a moving average of the bodies of Japanese candlesticks, the relations between the opens and the closes. QSTK is negative when the closes have been less than the opens for a certain period and is positive when the clsoes have been greater than the opens for the same period. Thus it is a look at the internal trend of the price structure. Specify the the QSTK period value using Number object period. If a decimal value is entered for period, the function will drop the decimal part and use the integer part as the period in the calculation without warning.
Returns the QSTK of Data object x.
Example
data("x") // Use the data from the chart
myQSTK = qstk(x,9) // 9-period QSTK
plotQSTK = plot(myQSTK,"9-period QSTK","line","000000") // Plot object for myQSTK
chart(plotQSTK) // Plot myQSTK in a clip
range(x:
Data, n:
Number(optional)):
Array,
NumberParameters
x:
Data - Data object variable name whose range is to be calculated.
n:
Number(optional) - Range period value.
Returns
Returns the range Array of a Data object as defined by the equation: max(high(x),n) - min(low(x),n); if n not provided, the maximum high of x minus minimum low of x will be returned.
Example
data("x")
period = 20
rangeArray = range(x,period)
print(rangeArray)
rangeTotal = range(x)
print(rangeTotal)
rmi(x:
Data, p1:
Number, p2:
Number):
ArrayParameters
x:
Data - Data object variable name whose Relative Momentum Index (RMI) is to be calculated.
p1:
Number - Period to compute Relative Strenght Index (RSI).
p2:
Number - Relative Momentum Index (RMI) period value.
Returns
Array - Relative Momentum Index (RMI) of Data object x.
Relative Momentum Index (RMI) is Roger Altman's momentumm variation of Welles Wilder's Relative Strength Index (RSI). Instead of accumulation plus and minus price changes, RMI accumulates changes in momentum. Over 70 is considered overbought and under 30 is considered oversold. (NOTE: RMI = RSI when the time frames are the same and RMI momentum period value is set to 1.)
Specify the time frame using Number object p1; specify the momentum period value using Number object p2. If a decimal value is entered for p1 or p2, the function will drop the decimal part and use the integer part as p1 or p2 in the calculation without warning.
Returns the RMI of data object x.
Example
data("x") // Use the data from the chart
myRMI = rmi(x,14,4) // 4-day lookback, 14-day period
plotRMI = plot(myRMI,"RMI","line","000000") // Plot object for myRMI
ref1 = plot(70,"","line","FF0000") // Overbought reference line
ref2 = plot(30,"","line","00CC00") // Oversold reference line
chart(plotRMI,ref1,ref2) // Plot myRMI with reference lines in a clip
roc(x:
Data, period:
Number):
ArrayParameters
x:
Data - Data object variable name whose Rate of Change is to be calculated.
period:
Number - Rate of Change period value.
Returns
Array - Rate of Change (ROC) of Data object x.
Rate of Change (ROC) is the percent difference of a data series over a specified time period. Specify the period to compute ROC using Number object period. If a decimal value is entered for period, the function will drop the decimal part and use the integer part as the period in the calculation without warning.
Returns the ROC of Data object x.
Example
data("x") // Use the data from the chart
ROC1 = roc(x,5) // 5-period ROC
ROC2 = roc(x,20) // 20-period ROC
ROCdiff = ROC1-ROC2 // difference of 5- and 20-day ROC
plotROC1 = plot(ROC1,"5-period ROC","line","000000") // Plot object for ROC1
plotROC2 = plot(ROC2,"20-period ROC","line","00CC00") // Plot object for ROC2
plotROCdiff = plot(ROCdiff,"Delta","histogram") // Plot object for ROCdiff
chart(plotROC1,plotROC2,plotROCdiff) // Plot ROC1, ROC2 and ROCdiff in a clip
rsi(x:
Data, period:
Number):
ArrayParameters
x:
Data - Data object variable name whose Relative Strength Index (RSI) is to be calculated.
period:
Number - Relative Strength Index (RSI) period value.
Returns
Array - Relative Strength Index (RSI) of Data object x.
Welles Wilder's Relative Strength Index (RSI) is a classic technical analysis tool that compares strength on up days to weakness on down days. The fixed values of 70 (overbought) and 30 (oversold) are most often used as signal levels. However, in a bullish environment 80 and 40 may be better suited and 60 and 20 are often used in bear markets. Many analysts use the swings of RSI through various levels to define bull and bear markets.
Returns the RSI of Data object x. If a decimal value is entered for period, the function will drop the decimal part and use the integer part as the period in the calculation without warning.
Example
data("x") // Use the data from the chart
myRSI = rsi(x,14) // 14-period RSI
myRSIplot = plot(myRSI,"14-Period RSI","line","000000") // Plot object for myRSI
ref1 = plot(30,"","line","00FF00") // Reference line at 30
ref2 = plot(45,"","line","FFFF00") // Reference line at 45
ref3 = plot(60,"","line","FFBF00") // Reference line at 60
ref4 = plot(75,"","line","FF4000") // Reference line at 75
ref5 = plot(90,"","line","000000") // Reference line at 90
chart(myRSIplot,ref1,ref2,ref3,ref4,ref5) // Chart all Plot objects in a clip
spvol(x:
Data):
ArrayParameters
x:
Data - Data object variable name whose Sponsored Volume (SV) is to be calculated.
Returns
Array - Sponsored Volume (SV) of Data object x.
Sponsored Volume (SV) is a verion of Intraday Intensity (II) from Jim Alphier that uses true highs and true lows instead of periodic highs and periodic lows in its calculation. If you trade something that has frequent and/or large gaps, you may want to use this verision of II.
Returns the SV of Data object x.
Example
data("x") // Use the data from the chart
mySV = spvol(x) // Compute Sponsored Volume
mySVplot = plot(mySV,"SV","line","000000") // Plot object for mySV
chart(mySVplot) // Plot mySV in a clip
spvolp(x:
Data, period:
Number):
ArrayParameters
x:
Data - Data object variable name whose Sponsored Volume Oscillator (SV%) is to be calculated.
period:
Number - Sponsored Volume Oscillator (SV%) period value.
Returns
Array - Sponsored Volume Oscillator (SV%) of Data object x.
Sponsored Volume Oscillator (SV%) is the closed form of Sponsored Volume. SV% is created by taking the n-day sum of SV and dividing by the n-day sum of volume. Specify the SV% period value using Number object period. If a decimal value is entered for period, the function will drop the decimal part and use the integer part as the period in the calculation without warning.
Returns the SV% of Data object x.
Example
data("x") // Use the data from the chart
period = 50 // Use 50 for calculation period
mySVOsc = spvolp(x,period) // 50-Period SV%
plotSVOsc = plot(mySVOsc,"SV%","histogram") // Plot object for mySVOsc
chart(plotSVOsc) // Chart mySVOsc in a clip
stochimp(x:
Data, period:
Number):
ArrayParameters
x:
Data - Data object variable name whose Stochastic Impulse is to be calculated.
period:
Number - Stochastic Impulse period value.
Returns
Array - Stochastic Impulse of Data object x.
Stochastic Impulse is an another Bollinger Bands exclusive indicator. It is a variation on BBImpulse that depcits the changes in Stochastics rather than the changes in %b. Another way of saying this is that BBImpulse measures impulse strength in relation to the Bollinger Bands and Stochastic Impulse measures impulse strength in relation to range (See BBImpulse). Specify the Stochastic Impuse period using Number object period. If a decimal value is entered for period, the function will drop the decimal part and use the integer part as the period in the calculation without warning.
Returns the Stochastic Impulse of Data object x.
Example
data("x") // Use the data from the chart
period = 14 // Use a 14 periods in the calculation
mySI = stochimp(x,period) // Calculate 14-Period Stochastic Impulse
plotSI = plot(mySI,"Stochastic Impulse","histogram") // Plot object for mySI
chart(plotSI) // Plot mySI in a clip
stochkd(x:
Data, p1:
Number, p2:
Number, type:
String["fast","slow"], series:
String["k","d"]):
ArrayParameters
x:
Data - Data object variable name whose Stochastics is to be calculated.
p1:
Number - %k lookback period value.
p2:
Number - %d lookback period value.
type:
String["fast","slow"] - String to specify the type of Stochastic to be calculated. Must be one of "fast" or "slow" for fast Stochastics or slow Stochastics, respectively.
series:
String["k","d"] - STring to specify what is to be returned. Must be one of "k" or "d" for %k and %d, respectively.
Returns
Array - If "k" is specified for series, the fast or slow (specified by type) %k of Data object x. If "d" is specified for series, the fast or slow (specified by type) %d of Data object x.
This is George Lane's Stochastics, an indicator of the position of current price relative to the price range of the past n days.
Specify the lookback period value for the lowest low and highest high using Number object p1. Specify the length of the averages using Number object p2. If a decimal value is entered for p1 or p2, the function will drop the decimal part and use the integer part for p1 or p2 as the period inthe calculation without warning.
If String object type is "fast", raw %k will be returned if String object series is "k" and an average of %k (%d) will be returned if String object series is "d".If String object type is "slow", %d will be returned if String object series is "k" and an average of %d (a second averaging of raw %k) will be returned if String object series is "d".
Example
data("x") // Use the data from the chart
fastk = stochkd(x,14,3,"fast","k") // Fast %k using 14-period calculation and 3-period simple moving average (raw %k)
fastd = stochkd(x,14,3,"fast","d") // Fast %d using 14-period calculation and 3-period simple moving average (3-period sma of fast %k)
slowk = stochkd(x,14,3,"slow","k") // Slow %k using 14-period calculation and 3-period simple moving average
slowd = stochkd(x,14,3,"slow","d") // Slow %d using 14-period calculation and 3-period simple moving average (3-period sma of slow %k)
plotfk = plot(fastk,"Fast %k","line","000000") // Plot object for fast %k
plotfd = plot(fastd,"Fast %d","line","CC0033") // Plot object for fast %d
plotsk = plot(slowk,"Slow %k","line","00CC33") // Plot object for slow %k
plotsd = plot(slowd,"Slow %d","line","3300CC") // Plot object for slow %d
chart(plotfk,plotfd,plotsk,plotsd) // Plot fast %k, fast %d, slow %k, and slow %d in a clip
tri(x:
Data, q:
Number, m:
Number):
ArrayParameters
x:
Data - Data object variable name whose The Range Indicator (TRI) is to be calculated.
q:
Number - Exponential moving average of Stochastic Range.
m:
Number - Stochastic Range lookback period.
Returns
Array - True Range Indicator (TRI) of Data object x.
The Range Indicator (TRI) was published by Jack L. Weinberg in the June 1995 issue of Technical Analysis of Stocks & Commodities. The idea here is to compare high minus low (the range) with close versus the close (the change). Look for trends to start from low levels when range and change are in gear and end from high levels of TRI when range and change are out of gear.
Specify the Stochastic Range lookback period value using Number object q; specify the Stochastic Range exponential moving average period value using Number object m. If a decimal value is entered for q or m, the function will drop the decimal part and use the integer part as q or m in the calculation without warning.
Returns the TRI of Data object x.
Example
data("x") // Use the data from the chart
myTRI = tri(x,3,10) // Standard TRI values
plotTRI = plot(myTRI,"TRI","line","000000") // Plot object for myTRI
ref1 = plot(20,"","line","00CC00") // Reference line
ref2 = plot(70,"","line","FF0000") // Reference line
chart(plotTRI,ref1,ref2) // Plot myTRI with reference lines in a clip
truerange(x:
Data):
ArrayParameters
x:
Data - Data object variable name whose true range is to be calculated.
Returns
Array - True Range of Data object x.
Returns the true range Array of a Data object x as defined by the formula: if(high(x) < close(x)[-1], close(x)[-1], high(x)) - if(low(x) > close(x)[-1], close(x)[-1], low(x)).
Example
data("x")
truerangeArray = truerange(x)
print(truerangeArray)
uos(x:
Data, p1:
Number, p2:
Number, p3:
Number):
ArrayParameters
x:
Data - Data object variable name whose Ultimate Oscillator (UO) is to be calculated.
p1:
Number - Ultimate Oscillator (UO) short period value.
p2:
Number - Ultimate Oscillator (UO) intermediate period value.
p3:
Number - Ultimate Oscillator (UO) long period value.
Returns
This is Larry Williams's weighted momentum oscillator. The Ultimate Oscillator (UO) is a combination of three different individual oscillators of varying time frames. This is usually one of the smoothest momentum tools. Specify the periods for the three underlying oscillators using Number object p1 (short), Number object p2 (intermediate), and Number object p3 (long). If a decimal value is entered for p1, p2 or p3, the function will drop the decimal part and use the integer part as p1, p2 or p3 in the calculation without warning.
Returns the UO of Data object x.
Example
data("x") // Use the data from the chart
short_period = 7 // UO short period
intermediate_period = 28 // UO intermediate period
long_period = 91 // UO long period
myUO = uos(x,short_period,intermediate_period,long_period) // Calculate UO with short, intermediate and long periods
plotUO = plot(myUO,"UO (7,28,91)","line","000000") // Plot object for myUO
ref1 = plot(30,"","line","00CC00") // Reference line
ref2 = plot(70,"","line","FF0000") // Reference line
chart(plotUO,ref1,ref2) // Plot myUO with reference lines in a clip
vhf(x:
Data, period:
Number):
ArrayParameters
x:
Data - Data object variable name whose Vertical Horizontal Filter (VHF) is to be calculated.
period:
Number - Vertical Horizontal Filter (VHF) period value.
Returns
Array - Vertical Horizontal Filter (VHF) of Data object x.
Vertical Horizontal Filter (VHF), Tushar Chande's trend analysis tool, compares the distance traveled within a range to the range itself. In a perfectly trending market the distance traveled and the range will be the same. The formula is range/distance. As it takes more and more travel to cover the range, the value of VHF falls. Specify the VHF period value using Number object period. If a decimal value is entered for period, the function will drop the decimal part and use the integer part as the period in the calculation without warning.
Returns the VHF of Data object x.
Example
data("x") // Use the data from the chart
myVHF1 = vhf(x,14) // 14-period VHF
myVHF2 = vhf(x,50) // 50-period VHF
plotVHF1 = plot(myVHF1,"14-Period VHF","line","000000") // Plot object for myVHF1
plotVHF2 = plot(myVHF2,"50-Period VHF","line","00CC00") // Plot object for myVFH2
chart(plotVHF1,plotVHF2) // Plot myVHF1 and myVHF2 in a clip
vos(x:
Data, period1:
Number, period2:
Number):
ArrayParameters
x:
Data - Data object variable name whose Volume Oscillator (VO) is to be calculated.
period1:
Number - Volume Oscillator (VO) short period value.
period2:
Number - Volume Oscillator (VO) long period value.
Returns
Array - Volume Oscillator (VO) of Data object x.
The Volume Oscillator (VO) considers nothing but volume. It is the difference betwen a short moving average of volume and a longer one. It is used to confirm volume patterns in relation to price patterns. Specify the short period value with Number object period1 and the long period value with Number object period2. If a decimal value is entered for period1 or period2, the function will drop the decimal part and use the integer part as period1 or period2 in the calculation without warning.
Returns the VO of Data object x.
Example
data("x") // Use the data from the chart
myVO = vos(x,20,50) // Compute Volume Oscillator (VO) using 20- and 50-day periods
plotVO = plot(myVO,"VO (20,50)","histogram") // Plot object for myVO
chart(plotVO) // Plot myVO in a clip
vpci(x:
Data, shortPeriod:
Number, longPeriod:
Number):
ArrayParameters
x:
Data - Data object variable name whose volume price confirmation indicator is to be calculated.
shortPeriod:
Number - VPCI short period.
longPeriod:
Number - VPCI long period.
Returns
Array - Volume price confirmation indicator array.
This function will return the volume price confirmation indicator array using the short and long periods provided (shortPeriod and longPeriod respectively).
VPCI is Buff Dormeier's effort to codify the old technical analysis concept of price-volume confirmation in a technical indicator. VPCI won the Dow Award in 2007. You can read the paper complete with examples of usage here.
http://tinyurl.com/8clzjhqThere are four price/volume confirmation possibilities that this indicator encompasses:
Rising price and volume, strong demand, bullish.
Falling price and volume, weak supply, bullish.
Rising price and falling volume, weak demand, bearish.
Falling price and rising volume, strong supply, bearish.
Example
data("x") // Use the data from the chart
vpci_array = vpci(x,5,20) // VPCI short period 5, long period 20
plotVPCI = plot(vpci_array,"VPCI","line","000000") // Plot object for vpci
chart(plotVWMA) // Plot VPCI short period 5, long period 20 in a indicator clip
vwma(x:
Data, p1:
Number):
ArrayParameters
x:
Data - Data object variable name whose volume weight moving average is to be calculated.
p1:
Number - Volume weighted moving average period value.
Returns
Array - Volume weighted moving average array.
This function will return the volume weighted moving average array to the period p1 specified.
The volume weighted moving average is the average price weighted by volume.
Example
data("x") // Use the data from the chart
vwma_array = vwma(x,20) // 20-period volume weighted moving average
plotVWMA = plot(vwma_array,"VWMA","line","000000") // Plot object for vwma
pchart(plotVWMA) // Plot 20-period vwma on price chart
vwmacd(x:
Data, p1:
Number, p2:
Number, p3:
Number, series:
String["vwmacd","signal"]):
ArrayParameters
x:
Data - Data object variable name whose Volume-Weighted Moving Average Convergence-Divergence (VWMACD) is to be computed.
p1:
Number - Short period value.
p2:
Number - Long period value.
p3:
Number - Signal period value.
series:
String["vwmacd","signal"] - String to specify what is to be returned. Must be one of "vwmacd" or "singal" for Volume-Weighted Moving Average Convergence-Divergence (VWMACD) or Signal line, respectively.
Returns
Array - If "vmacd" is specified for series, the Volume-Weighted Moving Average Convergence-Divergence of Data object x.
If "signal" is specified for series, the VWMACD Signal of Data object x.
Volume-Weighted Moving Average Convergence-Divergence (VWMACD) was created by Buff Domeier and uses the same calculation as Moving Average Convergence-Divergence (MACD), but volume-weighted averages are used instead of exponential averages. Treat exactly as you would MACD. Specify the fast period using Number object p1, specify the slow period using Number object p2, and specify the signal period using Number object p3. If a decimal value is entered for p1, p2 or p3, the function will drop the decimal part and use the integer part for p1, p2 or p3 in the calculation without warning.
Returns the VWMACD curve of Data object x if "vwmacd" is specified by String object type, or returns the VWMACD Signal line of Data object x if "signal" is specified by String object type.
Example
data("x") // Use the data from the chart
myVWMACDcurve = vwmacd(x,24,50,12,"vwmacd") // VWMACD curve using 24- and 50-day exponential moving averages and 12-day signal line
myVWMACDsignal = vwmacd(x,24,50,12,"signal") // Signal line using 24-day and 50-day exponential moving averages and 12-day signal line
VWMACDdiff = myVWMACDcurve - myVWMACDsignal // Difference between VWMACD curve and VWMACD Signal line
plotVWMACDcurve = plot(myVWMACDcurve,"VWMACD","line","000000") // Plot object for myVWMACDcurve
plotVWMACDsignal = plot(myVWMACDsignal,"Signal","line","FF0000") // Plot object for myVWMACDsignal
plotVWMACDdiff = plot(VWMACDdiff,"Difference","histogram") // Plot object for VWMACDdiff
chart(plotVWMACDcurve,plotVWMACDsignal,plotVWMACDdiff) // Plot myVWMACDcurve, myVWMACDsignal and VWMACDdiff in a clip
williams(x:
Data, period:
Number):
ArrayParameters
x:
Data - Data object variable name whose Williams %R is to be calculated.
period:
Number - Williams %R period value.
Returns
Array - Williams %R of Data object x.
This is a variation of Stochastics that some prefer. Williams %R depicts where you are in the range of the past n-days without smoothing. Note that the scale is reversed from that for Stochastics. Specify the %R period value using Number object period. If a decimal value is entered for period, the function will drop the decimal part and use the integer part as the period in the calculation without warning.
Returns %R of Data object x.
Example
data("x") // Use the data from the chart
myR1 = williams(x,5) // 5-period %R
myR2 = williams(x,21) // 21-period %R
myR3 = williams(x,50) // 50-period %R
plotR1 = plot(myR1,"5-period %R","line","000000") // Plot object for myR1
plotR2 = plot(myR2,"21-period %R","line","00CC00") // Plot object for myR2
plotR3 = plot(myR3,"50-period %R","line","FF0000") // Plot object for myR3
ref20 = plot(-20,"","line","808080") // Reference line at -20
ref80 = plot(-80,"","line","808080") // Reference line at -80
chart(plotR1,plotR2,plotR3,ref20,ref80) // Plot myR1, myR2, and myR3 with reference lines in a clip
wynia(x:
Data, threshold:
Number):
ArrayParameters
x:
Data - Data object variable name whose Wynia Volume Profile (WVP) is to be calculated.
threshold:
Number - Zig zag price filter threshold in percent
Returns
Array - Wynia Volume Profile (WVP) of Data object x.
The Wynia Volume Profile (WVP) was developed by Fred Wynia and uses a zig zag function to filter price and then compares the volume in up swings versus down swings. The function computes the ratio of the volume in the up swings to the volume in the down swings or vice versa.
The calculation is performed daily and the function returns the daily data in an Array object.
Example
data("x") // Use the data from the chart
threshold = 5; // Set the zig zag price filter to 5%
myWVP = wynia(x,threshold) // Get the Wynia Volume Profile (WVP)
myWVPplot = plot(myWVP,"myWVP","line","000000") // Create a plot object
chart(myWVPplot) // Plot myWVP in a clip