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.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
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 |
Share this
No information on this site is investment advice or a solicitation to buy or sell any financial instrument. Past performance is not indicative of future results. Trading may expose you to risk of loss greater than your deposits and is only suitable for experienced investors who have sufficient financial means to bear such risk.
ProRealTime ITF files and other attachments :PRC is also on YouTube, subscribe to our channel for exclusive content and tutorials
one question
this indicator repaint???
thanks
The signals are given on the exact bar when they occur. There is no repainting indicator with ProRealTime programming.
is it possible to make a screener with this conditions??? thank you
Please open a new topic in the screeners forum
I believe so but I leave it to Nicolas to decide if it is possible