B3 Consolidation Box: Breakout / Breakdown Indicator for ThinkorSwim

Mark-RO

New member
I did a search, it shows things in consolidation but not the ones that break out into the long or short. Should I add more bars?
@Sellitmarin, Although I'm not the creator of the original B3 Consolidation Box Indicator, here are some things that I found while using it. Depending on the type of stocks that are being traded, it might take some fine-tuning in order to determine the actual optimum values for "BarsUsedForRange" and "BarsRequiredToRemainInRange".

Here are some steps that I would recommend:

1. Without (no) Trade_By_ColorTrend_scan filter, first use the ToS scan to pull a list of stocks that are matching the basic type of stocks you would be interested to trade. Price range, volume, financial stuff, etc.

2. Save that scan, give it an easy name such as "Preferred Stocks".

3. In ToS go to Watchlist. Click on the top (right hand side) of the Watchlist gadget. Click on "Detach gadget".

4. Once you have the Watchlist detached, click on it's top bar (where it says "Current". Navigate to the "Personal" folder. Find your (previously) saved scan "Preferred Stocks" from step nr. 2. Shortly, a list of matching stocks should be displayed to you.

5. Click on a couple of the results. The B3 Consolidation Box study, (not the scan filter) will analyze those stocks. Some stocks will have Long or Short signal. Some won't.

6. While you're analyzing the interesting stocks, try to adjust the B3 Consolidation Box Indicator for those 2 values ("BarsUsedForRange" and "BarsRequiredToRemainInRange") until you'll get a Long (or Short) signal for most interesting stocks. My advice is, don't go for extreme values. Yes, on "green days" the scanner will return many long results. And on "red days" it will return many shorts. However, on "sideways days" the scan will return too few results.
Ok, now make sure you'll write down those values - you will need them in the next step.

7. Go back to the ToS scanner, open the Trade_By_ColorTrend_scan filter's editing option ("Custom") and introduce the values that you found on step nr. 6.

Now the scanner should pull the type of stocks that will match your B3 Consolidation Box Indicator.
It is important that your calibration will be applied to both your B3 Consolidation Box Indicator and scan filter. In order to avoid an eventual miss-match, both chart's indicator and scan filter should operate using the same value settings.

I know all this stuff might sounds a bit difficult at first - but in reality it's not. All it takes is to get both tools to match (the B3 Consolidation Box indicator and the scan filter). That way, what the scanner finds will also match what you'll see on your charts.

Hint: at step nr. 6, firstly leave the "BarsUsedForRange" at it's default value of [2] and only play with the "BarsRequiredToRemainInRange". Lower numbers will pull more results, but higher numbers are stricter. Remember, you'll want some average value settings that will also pull results on average days - not only on perfect days.

Hope this helps.
 
Last edited:

Mark-RO

New member
I use this box all the time. Finally someone came up with a scanner for it. I tried to make it work but dont understand the “comment out #” commands for instances. could you please give me the instructions on how to install it in baby steps? (Think of me as a 5 year old) i would greatly appreciate it. Thank you!!!
@amao11, from any ToS chart, click on Studies.
At the bottom left hand side click on "Create..."
At the top enter the new study name: "Trade_By_ColorTrend_scan".

In the edit box:

1. Remove (the default) line that reads "plot Data = close;"

2. Copy and paste the scan code.

3. Click on [OK].

4. In ToS, go to the Scan -> Stock Hacker.

5. Select "Add filter".

6. Choose "Study". Click. This will add the default filter named "ADXCrossover". Have a look at the bottom, you will find it.

7. Click on the ADXCrossover, select "Custom..."

8. An editing screen opens. Click on "Delete" and remove the default ADXCrossover.

9. Click on Condition Wizard. Add condition. Select "Study".

10. On the top bar search for the study "Trade_By_ColorTrend_scan" that you saved on step 3. Click on it.

11. When it opens, on the right hand side there is a pull down menu with many options. Click on "is true" and select it. Click on Save.

Also, subscribe to the YouTube channel called "useThinkScript".
Search for "how to install a script in ThinkorSwim", there are many good video tutorials.

Hope this helps.
 
Last edited:

sellitmarin

New member
VIP
Just simply having the bar in the middle to tell you when its probably gonna be over sold and when to "sell the high" or "buy the dip" along with these clearly defined ranges is ridiculously simply for finding entry in both forex and stocks. I'm setting up a Heiken ashi with auto stop loss and ... hell it will run it self for a positive cash flow even if its not 100%... its damn close.
 

Mark-RO

New member
Just simply having the bar in the middle to tell you when its probably gonna be over sold and when to "sell the high" or "buy the dip" along with these clearly defined ranges is ridiculously simply for finding entry in both forex and stocks. I'm setting up a Heiken ashi with auto stop loss and ... hell it will run it self for a positive cash flow even if its not 100%... its damn close.

@Sellitmarin, you're welcome. Glad you found some use of that scanner.

Some additional tips...here's how I use that scanner ;
In the ToS Scan Hacker (where you add the scan filters), I plan my scan criteria in two parts (as opposed to one single part).

Ok. The first part (nr. 1, on the top) is where I put basic stuff such as Price range, minimum volume, financial stuff, etc.
That's where I also include the Trade_By_ColorTrend_scan filter but I set it on a higher time-frame such as "Week". Why on a "Week" time-frame? because the higher time-frame is always giving the general trend of the kind of stocks scanner will find. As a rule of thumb, the higher the time-frame it will always indicate the general trend of a stock.

Now - on the second part of the filters (the one on the bottom), that's where I add a second condition group called "Any of the following". Those are the so-called "Triggers". What are triggers? anything that will indicate to the scanner that it's okay to include that particular stock in the final results.
Over there, on the bottom part, (the one containing the "Any of the following" filters), you can add any other filters that are able to return a Buy Signal -- filters such as RSI in Laguerre Time buy signal, TTM_ScalperAlert."PivotLow", PPS.buysignal, and so on...

Here comes a little secret: over there, on the second part of the filters, (the one on the bottom), you can add ADDITIONAL copies of the Trade_By_ColorTrend_scan filter, but set each of the copies on lower and lower time-frames.
I have mines on "Day", the next one on 4 hours, and the last one on 1 hour.

Try and play with these things until your scan results are getting from few to very few. When you'll only get 3-10 results you're on the way for perfect entries.

Hope this helps.
 
Last edited:

tjlizwelicha

Active member
VIP
Found this really interesting indicator for ThinkorSwim called B3 Consolidation Box that I wanted to share with everyone here.

Want to know if a stock is under consolidation? Well, this indicator is perfect for that. It basically highlights when a stock is consolidating and at which level it will be breaking down or breaking out. In addition, a stop loss level will be provided in case it's a false breakout/breakdown and target levels so you can know where to take profit.

Here are a few examples:

eMdcH7K.png


5t51NRr.png


voXgIWa.png


Notes:
  • Grey shadow box is your Consolidation box.
  • The white dotted line is Stop loss
  • Red lines are Profit Target Levels for Breakdown
  • Green lines are Profit Target Levels for Breakout
  • Use this indicator on the 5, 10, or 15 mins timeframe with Pre-market on.


thinkScript Code

Rich (BB code):
# B3 Consolidation Box   v1

# -- Automates a box and shows the breakouts via price color with targets based on the box's range.

# -- In a system the gray balance line would be your stop, or you may exit on any trip back within the old box range.

# -- The color of the candles does not tell you when to be long or short, it simply tells you the last signal given.

# -- You must manage your trade targets via your own profit protection tactics.

# Intended only for the use of the person(s) to who(m) this script was originally distributed.

# User of the script assumes all risk;

# The coder and the distributers are not responsible for any loss of capital incurred upon usage of this script.

# amalia added commentary after chatting more with B3 about the study:

# The first 2 inputs will need to be set for the chart you are looking at. What you want to find is the consolidation box settings that give you actionable targeting. If the price is shooting way past the tgt6 point, you need to lower the second input. The first input should likely be either 1, 2 or 3 only. Script is based on a strategy I learned from Ben's webcasts on TOS. He was doing some futurescast thing on consolidation boxes, and I had to see if I could make it work too. My Hypothesis is it is a great little scalper... you have to be willing to take singles and doubles and forget homers. He was trading ES

declare upper;

input BarsUsedForRange = 2;

input BarsRequiredToRemainInRange = 7;

input TargetMultiple = 0.5;

input ColorPrice = yes;

input HideTargets = no;

input HideBalance = no;

input HideBoxLines = no;

input HideCloud = no;

input HideLabels = no;

# Identify Consolidation

def HH = highest(high[1], BarsUsedForRange);

def LL = lowest(low[1], BarsUsedForRange);

def maxH = highest(hh, BarsRequiredToRemainInRange);

def maxL = lowest(ll, BarsRequiredToRemainInRange);

def HHn = if maxH == maxH[1] or maxL == maxL then maxH else HHn[1];

def LLn = if maxH == maxH[1] or maxL == maxL then maxL else LLn[1];

def Bh = if high <= HHn and HHn == HHn[1] then HHn else double.nan;

def Bl = if low >= LLn and LLn == LLn[1] then LLn else double.nan;

def CountH = if isnan(Bh) or isnan(Bl) then 2 else CountH[1] + 1;

def CountL = if isnan(Bh) or isnan(Bl) then 2 else CountL[1] + 1;

def ExpH = if barnumber() == 1 then double.nan else

            if CountH[-BarsRequiredToRemainInRange] >= BarsRequiredToRemainInRange then HHn[-BarsRequiredToRemainInRange] else

            if High <= ExpH[1] then ExpH[1] else double.nan;

def ExpL = if barnumber() == 1 then double.nan else

            if Countl[-BarsRequiredToRemainInRange] >= BarsRequiredToRemainInRange then LLn[-BarsRequiredToRemainInRange] else

            if Low >= ExpL[1] then ExpL[1] else double.nan;

# Plot the High and Low of the Box; Paint Cloud

plot BoxHigh = if !isnan(expL) and !isnan(ExpH) then ExpH else double.nan;

plot BoxLow = if !isnan(expL) and !isnan(ExpH) then ExpL else double.nan;

boxhigh.setdefaultColor(color.dark_green);

BoxHigh.setpaintingStrategy(paintingStrategy.HORIZONTAL);

BoxLow.setpaintingStrategy(paintingStrategy.HORIZONTAL);

BoxLow.setdefaultColor(color.dark_red);

BoxHigh.SETHIDING(HideBoxLines);

BoxLow.SETHIDING(HideBoxLines);

addcloud(if !HideCloud then BoxHigh else double.nan, BoxLow, color.gray, color.gray);

# Things to the Right of a Finished Box

def eH = if barnumber() == 1 then double.nan else if !isnan(BoxHigh[1]) and isnan(BoxHigh) then BoxHigh[1] else eh[1];

def eL = if barnumber() == 1 then double.nan else if !isnan(BoxLow[1]) and isnan(BoxLow) then BoxLow[1] else el[1];

def diff = (eh - el) * TargetMultiple;

plot Balance = if isnan(boxhigh) and isnan(boxlow) then (eh+el)/2 else double.nan;

plot Htgt_1 = if isnan(Boxhigh) and high >= eh then eh + diff else double.nan;

plot Htgt_2 = if isnan(Boxhigh) and high >= eh then eh + diff*2 else double.nan;

plot Htgt_3 = if isnan(Boxhigh) and high >= eh then eh + diff*3 else double.nan;

plot Htgt_4 = if isnan(Boxhigh) and high >= eh then eh + diff*4 else double.nan;

plot Htgt_5 = if isnan(Boxhigh) and high >= eh then eh + diff*5 else double.nan;

plot Htgt_6 = if isnan(Boxhigh) and high >= eh then eh + diff*6 else double.nan;

plot Ltgt_1 = if isnan(BoxLow) and Low <= eL then eL - diff else double.nan;

plot Ltgt_2 = if isnan(BoxLow) and Low <= eL then eL - diff*2 else double.nan;

plot Ltgt_3 = if isnan(BoxLow) and Low <= eL then eL - diff*3 else double.nan;

plot Ltgt_4 = if isnan(BoxLow) and Low <= eL then eL - diff*4 else double.nan;

plot Ltgt_5 = if isnan(BoxLow) and Low <= eL then eL - diff*5 else double.nan;

plot Ltgt_6 = if isnan(BoxLow) and Low <= eL then eL - diff*6 else double.nan;

Balance.SETHIDING(HideBalance);

Balance.setdefaultColor(CREATECOLOR(255,255,255));

Balance.setpaintingStrategy(PAIntingStrategy.SQUARES);

Htgt_2.setlineWeight(2);

Htgt_4.setlineWeight(2);

Htgt_6.setlineWeight(2);

Htgt_1.setdefaultColor(CREATECOLOR( 50, 100 , 75));

Htgt_1.setpaintingStrategy(PAIntingStrategy.DASHES);

Htgt_2.setdefaultColor(CREATECOLOR( 50, 100 , 75));

Htgt_2.setpaintingStrategy(paintingStrategy.HORIZONTAL);

Htgt_3.setdefaultColor(CREATECOLOR( 50, 100 , 75));

Htgt_3.setpaintingStrategy(PAIntingStrategy.DASHES);

Htgt_4.setdefaultColor(CREATECOLOR( 50, 100 , 75));

Htgt_4.setpaintingStrategy(paintingStrategy.HORIZONTAL);

Htgt_5.setdefaultColor(CREATECOLOR( 50, 100 , 75));

Htgt_5.setpaintingStrategy(PAIntingStrategy.DASHES);

Htgt_6.setdefaultColor(CREATECOLOR( 50, 100 , 75));

Htgt_6.setpaintingStrategy(paintingStrategy.HORIZONTAL);

Ltgt_2.setlineWeight(2);

Ltgt_4.setlineWeight(2);

Ltgt_6.setlineWeight(2);

Ltgt_1.setdefaultColor(CREATECOLOR( 100, 50 , 75));

Ltgt_1.setpaintingStrategy(PAIntingStrategy.DASHES);

Ltgt_2.setdefaultColor(CREATECOLOR( 100, 50 , 75));

Ltgt_2.setpaintingStrategy(paintingStrategy.HORIZONTAL);

Ltgt_3.setdefaultColor(CREATECOLOR( 100, 50 , 75));

Ltgt_3.setpaintingStrategy(PAIntingStrategy.DASHES);

Ltgt_4.setdefaultColor(CREATECOLOR( 100, 50 , 75));

Ltgt_4.setpaintingStrategy(paintingStrategy.HORIZONTAL);

Ltgt_5.setdefaultColor(CREATECOLOR( 100, 50 , 75));

Ltgt_5.setpaintingStrategy(PAIntingStrategy.DASHES);

Ltgt_6.setdefaultColor(CREATECOLOR( 100, 50 , 75));

Ltgt_6.setpaintingStrategy(paintingStrategy.HORIZONTAL);

Htgt_1.SETHIDING(HIDETARGETS);

Htgt_2.SETHIDING(HIDETARGETS);

Htgt_3.SETHIDING(HIDETARGETS);

Htgt_4.SETHIDING(HIDETARGETS);

Htgt_5.SETHIDING(HIDETARGETS);

Htgt_6.SETHIDING(HIDETARGETS);

Ltgt_1.SETHIDING(HIDETARGETS);

Ltgt_2.SETHIDING(HIDETARGETS);

Ltgt_3.SETHIDING(HIDETARGETS);

Ltgt_4.SETHIDING(HIDETARGETS);

Ltgt_5.SETHIDING(HIDETARGETS);

Ltgt_6.SETHIDING(HIDETARGETS);

# Labels

addlabel(!HideLabels, "TgtLvls = " + diff + "pts each | Bal = " + balance, if high > eh  and low < el then color.yellow else if high > eh then color.green else if low < el then color.red else color.gray);

addlabel(!HideLabels && high > eh && low < el, "OUTSIDE BAR!!", color.yellow);

addlabel(!HideLabels && high > eh && low >= el, "Long", color.green);

addlabel(!HideLabels && high <= eh && low < el, "Short", color.red);

#Price Color

assignPriceColor(if !ColorPrice then color.current else if !isnan(BoxHigh) then color.gray else

                    if high > eh  and low < el then color.yellow else

                    if high > eh then color.green else if low < el then color.red else color.gray);

Shareable Link

https://tos.mx/oPI7Kp

Video Tutorial

Is there anyway this could be use on 30M, 1H, 4Hr timeframe?
 

amao11

New member
@amao11, from any ToS chart, click on Studies.
At the bottom left hand side click on "Create..."
At the top enter the new study name: "Trade_By_ColorTrend_scan".

In the edit box:

1. Remove (the default) line that reads "plot Data = close;"

2. Copy and paste the scan code.

3. Click on [OK].

4. In ToS, go to the Scan -> Stock Hacker.

5. Select "Add filter".

6. Choose "Study". Click. This will add the default filter named "ADXCrossover". Have a look at the bottom, you will find it.

7. Click on the ADXCrossover, select "Custom..."

8. An editing screen opens. Click on "Delete" and remove the default ADXCrossover.

9. Click on Condition Wizard. Add condition. Select "Study".

10. On the top bar search for the study "Trade_By_ColorTrend_scan" that you saved on step 3. Click on it.

11. When it opens, on the right hand side there is a pull down menu with many options. Click on "is true" and select it. Click on Save.

Also, subscribe to the YouTube channel called "useThinkScript".
Search for "how to install a script in ThinkorSwim", there are many good video tutorials.

Hope this helps.
Thank you guys so much!!!! Great team u r!
 

amao11

New member
@amao11 Below is a tutorial of one method to use the script in post #67 in the TOS scanner.
I provide these directions with several cautions:
  1. The original script was not written to work in the manner of this scan
  2. This script has been know to repaint. Read more: Everything You Wanted To Know About Repainting
With the above caveats, here is the step-by-step to use in a scan:
Create the Custom Study
  1. Copy the code
  2. In Studies, click Create
  3. Paste the above study
  4. Name as: B3_Consolidation_Box
  5. Save
Click on the scanner.
  1. Click on +Add filter
  2. Click on the pencil icon next to the filter you just added
  3. Click edit
  4. At the top of the box: click on the 1st pull-down window, click study
  5. Type in B3_Consolidation_Box
  6. Under Plot, click on the pull-down window, choose Long_Buys
  7. In the middle column, choose is true
  8. Save
I didn't write this script. Any questions should be referred to the original poster. HTH
Thank you!!! 😃 will try it and let you know.
 

sellitmarin

New member
VIP
When you use the naked B3 code below, what code could be used to identify the black box, then put a line outwards showing the average price, or the high / low average? I would love to read through the code and see how this is done. I'm getting amazing results using the 1 Day charts to decide the way of the worlds profit. I've started to only dig into companies that are easy to borrow and then follow the ATS trade idea of looking to short below the average, buy above the average, then wait for the reversals or like heiken ashi, the counter candle to close out my order.

That would be another thing that would be cool.... how could you set an alert each time a candle or X candles show a reverse direction? That would set you up pretty nicely with forex and other very high yielding growth curves which utilize the "average price = 0" type mentality...


Below is the B3 naked chart Benten was kind enough to alter.

# Consolidation Box Barebones - with Grey Consolidation Box
# tomsk
# 11.23.2019

# As requested by Playstation, this is B3 Consolidation Box with all lines removed
# Only the grey consolidation box remains

# B3 Consolidation Box
# Hammond B3
# 2.2.2019

input BarsUsedForRange = 2;
input BarsRequiredToRemainInRange = 7;
input ColorPrice = yes;
input HideBoxLines = no;
input HideLabels = no;

# Identify Consolidation
def HH = highest(high[1], BarsUsedForRange);
def LL = lowest(low[1], BarsUsedForRange);
def maxH = highest(hh, BarsRequiredToRemainInRange);
def maxL = lowest(ll, BarsRequiredToRemainInRange);
def HHn = if maxH == maxH[1] or maxL == maxL then maxH else HHn[1];
def LLn = if maxH == maxH[1] or maxL == maxL then maxL else LLn[1];
def Bh = if high <= HHn and HHn == HHn[1] then HHn else double.nan;
def Bl = if low >= LLn and LLn == LLn[1] then LLn else double.nan;
def CountH = if isnan(Bh) or isnan(Bl) then 2 else CountH[1] + 1;
def CountL = if isnan(Bh) or isnan(Bl) then 2 else CountL[1] + 1;

def ExpH = if barnumber() == 1 then double.nan
else if CountH[-BarsRequiredToRemainInRange] >= BarsRequiredToRemainInRange then HHn[-BarsRequiredToRemainInRange]
else if High <= ExpH[1] then ExpH[1]
else double.nan;

def ExpL = if barnumber() == 1 then double.nan
else if Countl[-BarsRequiredToRemainInRange] >= BarsRequiredToRemainInRange then LLn[-BarsRequiredToRemainInRange]
else if Low >= ExpL[1] then ExpL[1] else double.nan;

# Plot the High and Low of the Box; Paint Cloud
plot BoxHigh = if !isnan(expL) and !isnan(ExpH) then ExpH else double.nan;
boxhigh.setdefaultColor(color.dark_green);
BoxHigh.setpaintingStrategy(paintingStrategy.HORIZONTAL);
BoxHigh.SETHIDING(HideBoxLines);

plot BoxLow = if !isnan(expL) and !isnan(ExpH) then ExpL else double.nan;
BoxLow.setpaintingStrategy(paintingStrategy.HORIZONTAL);
BoxLow.setdefaultColor(color.dark_red);
BoxLow.SETHIDING(HideBoxLines);

addcloud(BoxHigh, BoxLow, color.gray, color.gray);

# Things to the Right of a Finished Box
def eH = if barnumber() == 1 then double.nan else if !isnan(BoxHigh[1]) and isnan(BoxHigh) then BoxHigh[1] else eh[1];
def eL = if barnumber() == 1 then double.nan else if !isnan(BoxLow[1]) and isnan(BoxLow) then BoxLow[1] else el[1];

assignPriceColor(if !ColorPrice then color.current else if !isnan(BoxHigh) then color.gray else
if high > eh and low < el then color.yellow else
if high > eh then color.green else if low < el then color.red else color.gray);
# Consolidation Box Barebones
 

sellitmarin

New member
VIP
When you use the naked B3 code below, what code could be used to identify the black box, then put a line outwards showing the average price, or the high / low average? I would love to read through the code and see how this is done. I'm getting amazing results using the 1 Day charts to decide the way of the worlds profit. I've started to only dig into companies that are easy to borrow and then follow the ATS trade idea of looking to short below the average, buy above the average, then wait for the reversals or like heiken ashi, the counter candle to close out my order.

That would be another thing that would be cool.... how could you set an alert each time a candle or X candles show a reverse direction? That would set you up pretty nicely with forex and other very high yielding growth curves which utilize the "average price = 0" type mentality...


Below is the B3 naked chart Benten was kind enough to alter.
I have another questions:

The Daily and weekly charts don't seem to show anything? Is it just me and my stocks or is there something else going on? I have it detached and stripped of all other indicators or anything else. Just the naked B3 consolidation code.
 

Mark-RO

New member
The Daily and weekly charts don't seem to show anything? Is it just me and my stocks or is there something else going on? I have it detached and stripped of all other indicators or anything else. Just the naked B3 consolidation code.

@sellitmarin, the B3 consolidation indicator shows Long or Short signals only for certain stocks if/when they'll match it's settings.
As explained in post #81 (at nr. 6): try to adjust the B3 Consolidation Box Indicator for values of "BarsUsedForRange" and "BarsRequiredToRemainInRange" until you'll get Long or Short signals.

You might also want to send an inquiry to the creator of the B3 consolidation indicator.

Hope this helps.
 

jaythedaytrader

New member
@Playstation As requested here is B3 Consolidation Box with all lines removed. Only the grey consolidation box remains
Load this study on a 5 minute chart of /ES and you 'll see all the consolidation boxes displayed

Code:
# Consolidation Box Barebones - with Grey Consolidation Box
# tomsk
# 11.23.2019

# As requested by Playstation, this is B3 Consolidation Box with all lines removed
# Only the grey consolidation box remains

# B3 Consolidation Box
# Hammond B3
# 2.2.2019

input BarsUsedForRange = 2;
input BarsRequiredToRemainInRange = 7;
input ColorPrice = yes;
input HideBoxLines = no;
input HideLabels = no;

# Identify Consolidation
def HH = highest(high[1], BarsUsedForRange);
def LL = lowest(low[1], BarsUsedForRange);
def maxH = highest(hh, BarsRequiredToRemainInRange);
def maxL = lowest(ll, BarsRequiredToRemainInRange);
def HHn = if maxH == maxH[1] or maxL == maxL then maxH else HHn[1];
def LLn = if maxH == maxH[1] or maxL == maxL then maxL else LLn[1];
def Bh = if high <= HHn and HHn == HHn[1] then HHn else double.nan;
def Bl = if low >= LLn and LLn == LLn[1] then LLn else double.nan;
def CountH = if isnan(Bh) or isnan(Bl) then 2 else CountH[1] + 1;
def CountL = if isnan(Bh) or isnan(Bl) then 2 else CountL[1] + 1;

def ExpH = if barnumber() == 1 then double.nan
           else if CountH[-BarsRequiredToRemainInRange] >= BarsRequiredToRemainInRange then HHn[-BarsRequiredToRemainInRange]
           else if High <= ExpH[1] then ExpH[1]
           else double.nan;

def ExpL = if barnumber() == 1 then double.nan
           else if Countl[-BarsRequiredToRemainInRange] >= BarsRequiredToRemainInRange then LLn[-BarsRequiredToRemainInRange]
           else if Low >= ExpL[1] then ExpL[1] else double.nan;

# Plot the High and Low of the Box; Paint Cloud
plot BoxHigh = if !isnan(expL) and !isnan(ExpH) then ExpH else double.nan;
     boxhigh.setdefaultColor(color.dark_green);
     BoxHigh.setpaintingStrategy(paintingStrategy.HORIZONTAL);
     BoxHigh.SETHIDING(HideBoxLines);

plot BoxLow = if !isnan(expL) and !isnan(ExpH) then ExpL else double.nan;
     BoxLow.setpaintingStrategy(paintingStrategy.HORIZONTAL);
     BoxLow.setdefaultColor(color.dark_red);
     BoxLow.SETHIDING(HideBoxLines);

addcloud(BoxHigh, BoxLow, color.gray, color.gray);

# Things to the Right of a Finished Box
def eH = if barnumber() == 1 then double.nan else if !isnan(BoxHigh[1]) and isnan(BoxHigh) then BoxHigh[1] else eh[1];
def eL = if barnumber() == 1 then double.nan else if !isnan(BoxLow[1]) and isnan(BoxLow) then BoxLow[1] else el[1];

assignPriceColor(if !ColorPrice then color.current else if !isnan(BoxHigh) then color.gray else
                    if high > eh  and low < el then color.yellow else
                    if high > eh then color.green else if low < el then color.red else color.gray);
# Consolidation Box Barebones
is there a way to get this to work to scan for stocks,i can get it in the indicator , but not where it will scan for stocks any help would be very much appreciated?
 

MerryDay

Administrative
Staff member
Staff
VIP
@jaythedaytrader The script in post#1 is too complex for TOS scan. Somebody wrote a scan for a study that is NOT the same as post#1
the directions are in the posts below. You can play with it and see if it is helpful to you.
https://usethinkscript.com/threads/...dicator-for-thinkorswim.103/page-4#post-63502
https://usethinkscript.com/threads/...dicator-for-thinkorswim.103/page-4#post-63512

You don't have to spend 16hours looking for the other dozen posters who discussed scanning this study in this thread. Here is a quickie shortcut:
https://usethinkscript.com/threads/answers-to-commonly-asked-questions.6006/#post-58238
 

rad14733

Well-known member
VIP
@jaythedaytrader Don't take this the wrong way but perhaps trading isn't the thing for you... You say you need migraine pills and have no patience so that leads me to believe you can't handle the stress that comes with managing your own trades... You expect trading platforms and others to smooth things out for you rather than investing the time and effort, without getting all worked up, rather than considering that maybe its you that is the problem in the equation... I am a realist and honest beyond all else... I say all of this as a service to you, not as an insult... Not everyone is suited for trading, no matter how badly they might want to, just as with other things in life... Think on that and take a long look in the mirror... Are you really willing and able to put in the time and effort or is it not worth the aggravation that comes along with it...??? Only you can answer that...
 

Similar threads

Top