Bollinger reversal robot
Forums › ProRealTime English forum › ProOrder support › Bollinger reversal robot
- This topic has 5 replies, 2 voices, and was last updated 7 years ago by StantonR.
Tagged: bollinger bands, mean reversion, reversal
-
-
04/05/2017 at 9:29 AM #31080
Hey guys,
So I came across a screener for bollinger reversal.
I like the idea and would try to make an automated system for it.1h and daily would be the timeframe.
How do we make it automatic?
Originalcode from https://www.youtube.com/watch?v=kSBxmx5KUPg
1234567891011121314151617181920212223242526272829Boll = 20flag = 0BolDown = BollingerDown[Boll](close)BolUp = BollingerUp[Boll](close)BearishEngulfing = CLOSE[1] > OPEN[1] AND OPEN > CLOSE[1] AND CLOSE < OPEN[1]BullishEngulfing = CLOSE[1] < OPEN[1] AND OPEN < CLOSE[1] AND CLOSE > OPEN[1]BearishHarami = CLOSE[1] > OPEN[1] and OPEN > CLOSE and OPEN <= CLOSE[1] and OPEN[1] <= CLOSE and OPEN - CLOSE < CLOSE[1] - OPEN[1]BullishHarami = OPEN[1] > CLOSE[1] and CLOSE > OPEN and CLOSE <= OPEN[1] and CLOSE[1] <= OPEN and CLOSE - OPEN < OPEN[1] - CLOSE[1]TweezerTop = ABS(HIGH -(HIGH[1]))<= HIGH * 0.0025TweezerBottom = ABS(LOW -(LOW[1]))<= LOW * 0.0025AboveUpperBand=close[1] > BolUp and open > BolUpBelowLowerBand=close[1] < BolDown and open < BolDownGoShort =((BearishEngulfing or BearishHarami or TweezerTop ) and AboveUpperBand)GoLong = ((BullishEngulfing or BullishHarami or TweezerBottom) and BelowLowerBand)if GoLong thenflag = 1Endifif GoShort thenflag =-1endifscreener[GoLong or GoShort](flag as "1 long / -1 short")04/05/2017 at 9:46 AM #31084Hi CN
I believe that that is my code from youtube but that is why we do this to share knowledge.
I started working on the robot for this. But we need to define a good exit strategy and money management.
The current exit is when the price closes above or below the ema 20 which is basically the midlle bollinger line.
This system works well in trending markets as it is a mean reversion strategy, so money management will be key.
12345678910111213141516171819202122232425262728293031323334353637383940414243444546DEFPARAM CUMULATEORDERS = falseBoll = 20n = 1BolDown = BollingerDown[Boll](close)BolUp = BollingerUp[Boll](close)ema20 = ExponentialAverage[20](close)BearishEngulfing = CLOSE[1] > OPEN[1] AND OPEN > CLOSE[1] AND CLOSE < OPEN[1]BullishEngulfing = CLOSE[1] < OPEN[1] AND OPEN < CLOSE[1] AND CLOSE > OPEN[1]BearishHarami = CLOSE[1] > OPEN[1] and OPEN > CLOSE and OPEN <= CLOSE[1] and OPEN[1] <= CLOSE and OPEN - CLOSE < CLOSE[1] - OPEN[1]BullishHarami = OPEN[1] > CLOSE[1] and CLOSE > OPEN and CLOSE <= OPEN[1] and CLOSE[1] <= OPEN and CLOSE - OPEN < OPEN[1] - CLOSE[1]TweezerTop = ABS(HIGH -(HIGH[1]))<= HIGH * 0.0025TweezerBottom = ABS(LOW -(LOW[1]))<= LOW * 0.0025AboveUpperBand=close[1] > BolUp and open > BolUpBelowLowerBand=close[1] < BolDown and open < BolDownGoShort =((BearishEngulfing or BearishHarami or TweezerTop ) and AboveUpperBand)GoLong = ((BullishEngulfing or BullishHarami or TweezerBottom) and BelowLowerBand)if not longonmarket and GoLong thenBuy n Contract at MarketEndifc1 = (close > ema20)IF c4 THENSELL AT MARKETENDIFif not shortonmarket and GoShort thenSell n Contract at MarketEndifc2 = (close < ema20)IF c2 THENEXITSHORT AT MARKETENDIFSet Stop Ploss 2004/05/2017 at 10:00 AM #3108604/05/2017 at 10:24 AM #3108904/05/2017 at 10:24 AM #31090Sorry Error in code
12345678910111213141516171819202122232425262728293031323334353637383940414243444546DEFPARAM CUMULATEORDERS = falseBoll = 20n = 1BolDown = BollingerDown[Boll](close)BolUp = BollingerUp[Boll](close)ema20 = ExponentialAverage[20](close)BearishEngulfing = CLOSE[1] > OPEN[1] AND OPEN > CLOSE[1] AND CLOSE < OPEN[1]BullishEngulfing = CLOSE[1] < OPEN[1] AND OPEN < CLOSE[1] AND CLOSE > OPEN[1]BearishHarami = CLOSE[1] > OPEN[1] and OPEN > CLOSE and OPEN <= CLOSE[1] and OPEN[1] <= CLOSE and OPEN - CLOSE < CLOSE[1] - OPEN[1]BullishHarami = OPEN[1] > CLOSE[1] and CLOSE > OPEN and CLOSE <= OPEN[1] and CLOSE[1] <= OPEN and CLOSE - OPEN < OPEN[1] - CLOSE[1]TweezerTop = ABS(HIGH -(HIGH[1]))<= HIGH * 0.0025TweezerBottom = ABS(LOW -(LOW[1]))<= LOW * 0.0025AboveUpperBand=close[1] > BolUp and open > BolUpBelowLowerBand=close[1] < BolDown and open < BolDownGoShort =((BearishEngulfing or BearishHarami or TweezerTop ) and AboveUpperBand)GoLong = ((BullishEngulfing or BullishHarami or TweezerBottom) and BelowLowerBand)if not longonmarket and GoLong thenBuy n Contract at MarketEndifc1 = (close > ema20)IF c1 THENSELL AT MARKETENDIFif not shortonmarket and GoShort thenSell n Contract at MarketEndifc2 = (close < ema20)IF c2 THENEXITSHORT AT MARKETENDIFSet Stop Ploss 2004/05/2017 at 10:29 AM #31092 -
AuthorPosts
Find exclusive trading pro-tools on