BollingerBands  |  BollingerOnBollingerBands  |  BBForex  |  EquityTrader  |  BollingerVideo  |  GroupPower  |  MarketTechnician  |  PatternPower  |  BBScript  |  Mobile  

The latest addition to BBScript is the ability to access stock-market timing data. Daily and weekly series like NYSE Advancing Issues or New 52-Week Highs are now available in BBScript, which means that you can now add market-timing components to your trading systems.

M_NYADVNYSE Advancing IssuesDaily
M_NYADVNYSE Advancing IssuesWeekly
M_NYDECNYSE Declining IssuesDaily
M_NYDECNYSE Declining IssuesWeekly
M_NYDVOLNYSE Down VolumeDaily
M_NYDVOLNYSE Down VolumeWeekly
M_NYNHINYSE New 52-week HighsDaily
M_NYNHINYSE New 52-week HighsWeekly
M_NYNLONYSE New 52-week LowsWeekly
M_NYNLONYSE New 52-Week LowsDaily
M_NYUNVONYSE Unchanged VolumeDaily
M_NYUVOLNYSE Up VolumeWeekly
M_OTCADVNASDAQ Advancing IssuesDaily
M_OTCADVNASDAQ Advancing IssuesWeekly
M_OTCDECNASDAQ Declining IssuesDaily
M_OTCDECNASDAQ Declining IssuesWeekly
M_OTCNHINASDAQ New 52-Week HighsWeekly
M_OTCNHINASDAQ New 52-Week HighsDaily
M_OTCNLONASDAQ New 52-Week LowsWeekly
M_OTCNLONASDAQ New 52-Week LowsDaily

Here is an example of the traditional NYSE Advance – Decline Line calculation in BBScript.

// NYSE advances
data("adv", "m_nyadv")
// NYSE declines
data("dec", "m_nydec")
// array to store the a-d line
a_d_line = array(0)
// net advances
a_d = close(adv)-close(dec)
// a-d line
a_d_line = a_d_line[-1] + a_d
// create the plot (blue line)
plot1 = plot(a_d_line, "NYSE A-D Line", "line", "0000ff")
// draw the chart in its own clip

BBScript will automagically select daily or weekly data depending on whether you are plotting daily or weekly data.

And here is an example of the NYSE 52-Week High-Low Histogram.

// 52-week NYSE new highs
data("hi", "m_nynhi")
// 52-week NYSE new lows
data("lo", "m_nynlo")
// array to store net new highs
hi_lo_hist = array(0)
// net new highs
hi_lo_hist = close(hi) - close(lo)
// create the plot (blue line)
plot1 = plot(hi_lo_hist, "NYSE High-Low", "histogram")
// draw the chart in its own clip

And here is another example of how to use market timing data in BBScript.

// price data from chart
plotData = close(x)
// the width of the channel in percent
width = 0.04
// the length of the channel and the oscillator
ChanLength = 21
OscLength = 21
// get the data for the Dow
// we'll use it for signals no matter what is plotted on the chart
data("DJ", "INDU")
dj = close(DJ)
// the channels
avg = sma(dj, ChanLength)
upper = avg * (1 + width)
lower = avg / (1 + width)
// daily advances and declines
data("adv", "m_nyadv")
data("dec", "m_nydec")
// array for the oscillator
a_d_osc = array(0)
// net advances
a_d = close(adv) - close(dec)
// a-d oscillator
a_d_osc = movsum(a_d, OscLength)
// create the oscillator plot
OscPlot = plot(a_d_osc, "a-d oscillator", "histogram")
// draw the oscillator in its own clip
// create a signal array and populate with zeros
signals = array(0)
// generate buy and sell signals
enterLong = less(dj, lower) * greater(a_d_osc, 0)
enterShort = greater(dj, upper) * less(a_d_osc, 0) * -2
signals = enterLong + enterShort
// test the signals
bt = backtest(DJ, signals, 4, 2)
// create the backtest signal/stops plot with their labels
PlotSignals = plot(plotData, "signals", "line", "00000000", bt)
// display signals and their labels in price chart
// must be plotting symbol "INDU" for the following to work
// uncoment the next three lines to plot the channels
//upperPlot = plot(upper, "upper channel", "line")
//lowerPlot = plot(lower, "lower channel", "line")
//pchart(upperPlot, lowerPlot)