Inventory Retracement Bar (IRB) Indicator for ThinkorSwim

I modified it further as I mentioned above.

Ruby:
# Inventory Retracement Bar
# Originally Assembled by BenTen at useThinkScript.com
# Converted from https://www.tradingview.com/script/VNByUGpE-Rob-Hoffman-s-Inventory-Retracement-Bar-by-UCSgears/
# Inventory Retracement Bar and inverse IRB as modified by the_yeti
# Modified further to show only buy/sell signals by theLEMband


input z = 45;

def r = AbsValue(high - low);
def b = AbsValue(close - open);
def c = z / 100;

def IRB = Min(close, open) > ((r * c) + low);
def revIRB = Max(close, open) < high - ((r * c));

plot IRBUpTrend = if IRB[1] and high > close[1] and close[1] > open[1] then low - TickSize() * 2 else Double.NaN;
IRBUpTrend.SetPaintingStrategy(PaintingStrategy.TRIANGLES);
IRBUpTrend.SetDefaultColor(Color.GREEN);
IRBUpTrend.SetLineWeight(3);

plot InvIRBUpTrend = if revIRB[1] and high > close[1] and close[1] > open[1] then low - TickSize() * 2 else Double.NaN;
InvIRBUpTrend.SetPaintingStrategy(PaintingStrategy.SQUARES);
InvIRBUpTrend.SetDefaultColor(Color.GREEN);
InvIRBUpTrend.setLineWeight(3);

plot IRBDownTrend = if IRB[1] and low < close[1] and close[1] < open[1] then high + TickSize() * 2 else Double.NaN;
#plot IRBDownTrend = if IRB and close < regime then high + TickSize() * 2 else Double.NaN;
IRBDownTrend.SetPaintingStrategy(PaintingStrategy.TRIANGLES);
IRBDownTrend.SetDefaultColor(Color.MAGENTA);
IRBDownTrend.SetLineWeight(3);

plot InvIRBDownTrend = if revIRB[1] and low < close[1] and close[1] < open[1] then high + TickSize() * 2 else Double.NaN;
InvIRBDownTrend.SetPaintingStrategy(PaintingStrategy.SQUARES);
InvIRBDownTrend.SetDefaultColor(Color.MAGENTA);
InvIRBDownTrend.SetLineWeight(3);

Here is the MTF Version
Code:
# Inventory Retracement Bar
# Originally Assembled by BenTen at useThinkScript.com
# Converted from https://www.tradingview.com/script/VNByUGpE-Rob-Hoffman-s-Inventory-Retracement-Bar-by-UCSgears/
# Inventory Retracement Bar and inverse IRB as modified by the_yeti
# Modified further to show only buy/sell signals by theLEMband

input agg1 = AggregationPeriod.FIVE_MIN;
input z = 45;
def O = Open(Period = AGG1);
def C = Close(Period =AGG1);
def H = High(Period = AGG1);
def L = Low(Period =AGG1);

def r = AbsValue(H-L);
def b = AbsValue(C-O);
def d = z / 100;

def IRB = Min(C, O) > ((r * d) + L);
def revIRB = Max(C, O) < H - ((r * d));

plot IRBUpTrend = if IRB[1] and H > C[1] and C[1] > O[1] then L - TickSize() * 2 else Double.NaN;
IRBUpTrend.SetPaintingStrategy(PaintingStrategy.TRIANGLES);
IRBUpTrend.SetDefaultColor(Color.GREEN);
IRBUpTrend.SetLineWeight(3);

plot InvIRBUpTrend = if revIRB[1] and H > C[1] and C[1] > O[1] then L - TickSize() * 2 else Double.NaN;
InvIRBUpTrend.SetPaintingStrategy(PaintingStrategy.SQUARES);
InvIRBUpTrend.SetDefaultColor(Color.GREEN);
InvIRBUpTrend.setLineWeight(3);

plot IRBDownTrend = if IRB[1] and L < C[1] and C[1] < O[1] then H + TickSize() * 2 else Double.NaN;
IRBDownTrend.SetPaintingStrategy(PaintingStrategy.TRIANGLES);
IRBDownTrend.SetDefaultColor(Color.MAGENTA);
IRBDownTrend.SetLineWeight(3);

plot InvIRBDownTrend = if revIRB[1] and L < C[1] and C[1] < O[1] then H + TickSize() * 2 else Double.NaN;
InvIRBDownTrend.SetPaintingStrategy(PaintingStrategy.SQUARES);
InvIRBDownTrend.SetDefaultColor(Color.MAGENTA);
InvIRBDownTrend.SetLineWeight(3);
 

Join useThinkScript to post your question to a community of 21,000+ developers and traders.

Check your math on the indicators... something isnt right. I loaded both versions I have and they do not match Hoffmans chart in his vid. I used OnDemand went back to June 3 2021 as dated on the SPY Daily chart he uses and the alerts over the bars(that do match so chart is the same on that front) do not match... and I also checked tradingview one by UCGears, that doesnt match either

 

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
368 Online
Create Post

Similar threads

Similar threads

The Market Trading Game Changer

Join 2,500+ subscribers inside the useThinkScript VIP Membership Club
  • Exclusive indicators
  • Proven strategies & setups
  • Private Discord community
  • ‘Buy The Dip’ signal alerts
  • Exclusive members-only content
  • Add-ons and resources
  • 1 full year of unlimited support

Frequently Asked Questions

What is useThinkScript?

useThinkScript is the #1 community of stock market investors using indicators and other tools to power their trading strategies. Traders of all skill levels use our forums to learn about scripting and indicators, help each other, and discover new ways to gain an edge in the markets.

How do I get started?

We get it. Our forum can be intimidating, if not overwhelming. With thousands of topics, tens of thousands of posts, our community has created an incredibly deep knowledge base for stock traders. No one can ever exhaust every resource provided on our site.

If you are new, or just looking for guidance, here are some helpful links to get you started.

What are the benefits of VIP Membership?
VIP members get exclusive access to these proven and tested premium indicators: Buy the Dip, Advanced Market Moves 2.0, Take Profit, and Volatility Trading Range. In addition, VIP members get access to over 50 VIP-only custom indicators, add-ons, and strategies, private VIP-only forums, private Discord channel to discuss trades and strategies in real-time, customer support, trade alerts, and much more. Learn all about VIP membership here.
How can I access the premium indicators?
To access the premium indicators, which are plug and play ready, sign up for VIP membership here.
Back
Top