achel

Bollinger Bandit

Category: Indicators By: achel Created: November 11, 2018, 1:23 PM
November 11, 2018, 1:23 PM
Indicators
5 Comments
Bollinger Bandit

The Bollinger Bandit uses one standard deviation above the 50-day moving average as a potential long entry and one standard deviation below the 50-day moving average as a potential short entry.

When a position is initiated, the protective stop is set at the 50-day moving average. Every day that we are in a position, we decrement the number of days for our moving average calculation by one. The longer that we are in a trade, the easier it is to exit the market with a profit. We keep decrementing the number of days in our moving average calculation until we reach 10. From that point on, we do not decrement.

There is one more element to our exit technique: the moving average must be below the upper band if we are long and above the lower band if we are short.

Previously, we stated that the upper band and lower band were  potential buy/sell entries. Potential is the key word. One more test must be passed before we initiate a position; the close of today must be greater than the close of 30 days ago for a long position and the close of today must be less than the close of 30 days ago for a short position. This additional requirement is a trend filter. We only want to go long in an uptrend and short in a downtrend.

bollingerLengths=50
liqLength=50
rocCalcLength=30

avg = average[bollingerLengths]
upBand = avg+std[bollingerlengths]*1.25
dnBand = avg-std[bollingerlengths]*1.25

atr = AverageTrueRange[14](close)
rocCalc = Close - Close[rocCalcLength-1]// {remember to subtract 1}
if(lastsignal<=0 and rocCalc > 0) and close<upBand then
 drawarrowup(barindex,low-atr) coloured(0,255,0)
 lastsignal=1
endif

if(lastsignal>=0 and rocCalc < 0) and close>dnBand then
 drawarrowdown(barindex,high+atr) coloured(255,0,0)
 lastsignal=-1
endif

if lastsignal=0 then
 liqDays = liqLength
else
 liqDays = liqDays - 1
 liqDays = Max(liqDays,10)
endif

return

 

Download
Filename: Bollinger-Bandit.itf
Downloads: 590
achel
achel Average
As an architect of digital worlds, my own description remains a mystery. Think of me as an undeclared variable, existing somewhere in the code.
Author’s Profile

Comments

achel
8 years ago
#

I believe so but I leave it to Nicolas to decide if it is possible

lokbuscas
8 years ago
#

is it possible to make a screener with this conditions??? thank you

Nicolas
8 years ago
#

Please open a new topic in the screeners forum

lokbuscas
8 years ago
#

one question this indicator repaint??? thanks

Nicolas
8 years ago
#

The signals are given on the exact bar when they occur. There is no repainting indicator with ProRealTime programming.

ProRealCode ProRealCode
Loading...