LBR Paint Bars

LBR Paint Bars changes the color of the price bars depending on the trend direction. The trend is determined by the position of 2 volatility lines. The calculation of these lines uses a moving average of the Average True Range and applies it to (plus or minus) the highest highs and the lowest lows. The And Or option refers to the specific logic used see the code for details. The user may change the input (close), method (SMA), factor, period lengths and the and or option. This indicator’s definition is further expressed in the condensed code given in the calculation below


How To Trade Using LBR Paint Bars

The LBR Paint Bars may be used with other indicators. No signals are given for this indicator.

How To Access in MotiveWave

Go to the top menu, choose Add Study, start typing in this study name until you see it appear in the list, click on the study name, click OK.

Important Disclaimer: The information provided on this page is strictly for informational purposes and is not to be construed as advice or solicitation to buy or sell any security. Please see our Risk Disclosure and Performance Disclaimer Statement.


//input = price, user defined, default is closing price
//method = moving average (MA) user defined, default is SMA
//atrPeriod = Average True Range period user defined, default is 9
//hlPeriod = high low period user defined, default is 16
//factor = user defined, default is 2.5
//pb = paint bars user defined, default is true
//sv = show volatility lines user defined, default is true
//andOr = and or option user defined, default is and
//index = current bar number

atr = atr(index, atrPeriod);  //Average True Range
aatr = factor * ma(method, index, atrPeriod, ATR);
band1 = lowest(index, hlPeriod, LOW) + aatr;
band2 = highest(index, hlPeriod, HIGH) - aatr;
if (sv)
  Plot1: band1;
  Plot2: band2;
if (andOr.equals("And"))
     upperVolt=price moreThan band1 && price moreThan band2;
     lowerVolt=price lessThan band1 && price lessThan band2;
if (andOr.equals("Or"))
    upperVolt=price moreOrEqual band1 || price moreOrEqual band2;
    lowerVolt=price lessOrEqual band1 || price lessOrEqual band2;
if (upperVolt AND pb) 
   setPriceBarColor(index, bullColor);
if (lowerVolt AND pb) 
  setPriceBarColor(index, bearColor);