Three Bar Reversal Pattern and Indicator for ThinkorSwim

BenTen

BenTen

Administrative
Staff
VIP
Three-bar reversal is a powerful pattern for day trading. The setup looks for a few consecutive red candlesticks and the final bar being a green candle closing higher than previous bars.

Here is an example:



Below is the code to identify bullish trigger bar in the Three Bar Reversal pattern. It also comes with an alert system.

thinkScript Code

Rich (BB code):
# Three-Bar Reversal Indicator
# Found in the thinkScript Archive
# Alert added by WalkingBallista
# https://usethinkscript.com/d/187-three-bar-reversal-pattern-and-indicator-for-thinkorswim

def TBRup = close > open[1] and close[1] < close[2]  and close[2] < close[3] and close[3] < close[4];
plot bullish = if TBRup then high else Double.NaN;
bullish.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
alert(bullish,"TBR Up", alert.Bar,sound.ding);

Shareable Link

https://tos.mx/pLfTyM

If you would like to look for bearish trigger bar in this pattern, you can insert the following code into that indicator.

Rich (BB code):
def TBRdown = close < open[1] and close[1] > close[2] and close[2] > close[3] and close[3] > close[4];
plot bearish = if TBRdown then low else Double.NaN;
bearish.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);
alert(bearish,"TBR Down", alert.Bar, sound.ding);

The script was posted on the thinkScript Lounge Archive. It did not mention who created the indicator.
 
Last edited:
M

mohitdas

New member
VIP
@BenTen I would like to add a label to top left corner side of the chart, how should i write the AddLabel command for above charts to show if currently in TBRUP or TBRDown status.Thank You
 
lukeskywalker

lukeskywalker

New member
This indicator indicates the place of three bar reversal with arrows on the chart📈. The formation is quite specific. Not many people know about it.

⚙Let's place the indicator according to the "three bar reversal" pattern. We'll choose a 5-minute timeframe for that. Import indicator by using <Edit Studies> menu. It will appear on the list. You need to enter Studies – User Defined. Click on the necessary indicator and add - "Add Study".
________________
Code:
#thinkscript indicator: Three_Bar_Reversal.
#Shows the pattern "Three Bar Reversal"
#by thetrader.top

def bSignalDown = open[2]<close[2] and low[1]>low[2] and low[1]<high[2] and high[1]>high[2] and high<high[1] and close[1]<low[1];
def bSignalUp = open[2]>close[2] and low[1]<low[2] and low[2]<high[1] and low[1]<low[2] and low>low[1] and low<high[1] and close>high[1];
plot down = if bSignalDown then high else double.NaN;
plot up = if bSignalUp then high else double.NaN;
up.SetPaintingStrategy(paintingStrategy.BOOLEAN_ARROW_up);
down.SetPaintingStrategy(paintingStrategy.BOOLEAN_ARROW_down);
up.setDefaultColor(color.LIGHT_green);
down.setDefaultColor(color.LIGHT_red);

 
Last edited by a moderator:
A

asragov

New member
2019 Donor
VIP
@lukeskywalker Apologies if I'm doing something wrong - I get a lot of hits with the scan for the down arrow, but it seems to find nothing for the up arrow - could you please take a look? It is a very interesting approach - thanks
 
L

LynnChen

New member
VIP
Hi Ben, The three bars reversal indicator is excellent! but can you change the last green candle must higher then the previous candle's wick not the close. Thank you so much!
 
RushPro808

RushPro808

New member
VIP
BenTen is big pimpin! Appreciate all the hard work you put into this. I will be referencing this site and yourself on anything I use or modify. Cheers!
 
BenTen

BenTen

Administrative
Staff
VIP
@LynnChen So the last green candle closing higher than the high of the previous candle?
 
L

LynnChen

New member
VIP
Yes BenTen the last green candle should close one penny higher than the high of the previous candle. I have been using the TBR conjunction with other indicator from this Forums, they work so well and less emotion to trade. Thank you so much!
 
BenTen

BenTen

Administrative
Staff
VIP
@LynnChen Try this:

Code:
# Generation time: 2020-08-05T22:36:03.729Z

def IsUp = close > open;
def IsDown = close < open;
def IsDoji = IsDoji();
def avgRange = 0.05 * Average(high - low, 20);
plot PatternPlot =
    IsDown[3] and
    IsDown[2] and
    IsDown[1] and
    IsUp[0] and
    high[1] < close[0];

PatternPlot.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
PatternPlot.SetDefaultColor(GetColor(0));
 
RushPro808

RushPro808

New member
VIP
@BenTen I am about to donate... you have a link to send me?
 
C

cay7man

New member
VIP
This is a great study! @lukeskywalker what is the difference between your version and BenTen's?
 
C

cay7man

New member
VIP
@BenTen I like this simple indicator! How are IsDoji and avgRange used? I don't see any references to them.
 
BenTen

BenTen

Administrative
Staff
VIP
@cay7man They were included by default when generating the candlestick pattern in ThinkorSwim.
 

Similar threads

Top