Here is the solution for Thinkorswim. I compared this using a daily chart of AAPL and this matches what is displayed on the TradingView chart:
input lookBack = 12;
input minLookBack = 7;
def highestHigh = Highest(high, lookBack);
def lowestLow = Lowest(low, lookBack);
def bullishBOS = close > highestHigh[1];
def bearishBOS = close < lowestLow[1];
rec bullishBosFirst = !bullishBOS[1] and bullishBOS;
rec bearishBosFirst = !bearishBOS[1] and bearishBOS;
AssignPriceColor(if bullishBOS or bearishBOS then Color.YELLOW else Color.CURRENT);
In case that link to the original source code on TradingView gets removed in the future, I have attached a plain text file containing the original PineScript source code from TradingView. Link to that file is listed below with the name of "TV_BoS Yellow Candle.txt".