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);