This is a modification of an earlier post here on usethinkscript modified to show only Buy/Sell Bubbles. I don't like a lot of clouds as it interferes with my ORB's. Here is the modified code which is to my liking and helpful to my trading (I use it on a 1 min and 5 min chart for entries/exits):
# High_Low_range_carter_00e
#
https://usethinkscript.com/threads/looking-to-setup-a-high-low-range.13750/
#Looking to Setup A High-Low Range
#OGOptionSlayer 12/19
#Modified by C. Ricks 1/10/23 to show only Buy/Sell Bubbles
input show_stop = no;
input buffer = 10;
input show_min = yes;
input show_five_min = yes;
input show_15min = yes;
input show_30min = yes;
input show_hour = yes;
def bn = BarNumber();
def na = Double.NaN;
input buy_bubbles_on = yes;
input buy_type = { default completed_bar , active_bar };
def buyoff;
switch (buy_type) {
case completed_bar:
buyoff = 1;
case active_bar:
buyoff = 0;
}
input bars = 20;
def period = (!IsNaN(close) and IsNaN(close[-bars]));
# define group of x bars
def first = (!IsNaN(close[-(bars - 1)]) and IsNaN(close[-bars]));
# price level of the highest high
def hihi = if bn == 1 or IsNaN(close) then 0
# else if first then Highest(high[-(bars - 1)], (bars - 1))
else if first then Highest(high[-(bars - 1)], (bars - 0))
else hihi[1];
# find bn of just the first occurance of hihi
def hihifirstbn =
if hihi == 0 then 0
else if hihifirstbn[1] > 0 then hihifirstbn[1]
else if (hihi == high) then bn
else hihifirstbn[1];
# bars after the hihi
def hi_bars = (hihifirstbn > 0 and bn >= hihifirstbn);
# hihi price level from 1st highest bar
def hihi_level = if bn == 1 or IsNaN(close) then na
# else if hihifirstbn > 0 and bn >= hihifirstbn then hihi
else if hi_bars then hihi
else na;
# true on the hihi bar
def ishi = if bn == 1 then 0
else if hihifirstbn == bn then 1
else 0;
# find lowest low
# price level of the lowest low
def lolo = if bn == 1 or IsNaN(close) then 0
# else if first then lowest(low[-(bars - 1)], (bars - 1))
else if first then Lowest(low[-(bars - 1)], (bars - 0))
else lolo[1];
# find bn of the first occurance of lolo
def lolofirstbn =
if lolo == 0 then 0
else if lolofirstbn[1] > 0 then lolofirstbn[1]
else if (lolo == low) then bn
else lolofirstbn[1];
# bars on and after the lolo
def lo_bars = (lolofirstbn > 0 and bn >= lolofirstbn);
# lolo price level from 1st lowest bar
def lolo_level = if bn == 1 or IsNaN(close) then na
# else if lolofirstbn > 0 and bn >= lolofirstbn then lolo
else if lo_bars then lolo
else na;
# true on the lolo bar
def islo = if bn == 1 then 0
else if lolofirstbn == bn then 1
else 0;
input hilo_arrows = no;
# buy put
def put_buy_hilo = if bn == 1 or IsNaN(close) then 0 else if ishi then low else put_buy_hilo[1];
# bp = buyput
def bp1 = if period and (!first) then (close[buyoff] crosses below put_buy_hilo) else 0;
def bp2 =
if bn == 1 then 0
else if bp2[1] then bp2[1]
else if bp1 then 1
else bp2[1];
def bp3 = if !bp2[1] and bp2 then 1 else 0;
# buy call
def call_buy_lohi = if bn == 1 or IsNaN(close) then 0 else if islo then high else call_buy_lohi[1];
def bc1 = if period and !first then (close[buyoff] crosses above call_buy_lohi) else 0;
def bc2 =
if bn == 1 then 0
else if bc2[1] then bc2[1]
else if bc1 then 1
else bc2[1];
def bc3 = if !bc2[1] and bc2 then 1 else 0;
input gain_stop_percent = 20;
def offx = 2;
def ref_bubble_x = (!IsNaN(close[offx]) and IsNaN(close[(offx - 1)]));
# puts
def putreflevel = put_buy_hilo - (put_buy_hilo * (gain_stop_percent / 100));
# calls
def callreflevel = call_buy_lohi + (call_buy_lohi * (gain_stop_percent / 100));
def h = hihi;
def l = lolo;
def range = h - l;
input show_labels = yes;
input show1HOUR = yes;
input avg_type = AverageType.Exponential;
input fastlen = 10;
input slowlen = 50;
input htf_lookback = 2;
input src = close;
def currentTimeFrame = GetAggregationPeriod();
## One Hour
def aH1 = if currentTimeFrame <= AggregationPeriod.HOUR then AggregationPeriod.HOUR else currentTimeFrame;
def availableH1 = currentTimeFrame <= AggregationPeriod.HOUR;
def fast1hr = MovingAverage(avg_type, close(period = aH1), fastlen);
def slow1hr = MovingAverage(avg_type, close(period = aH1), slowlen);
def crossup = fast1hr crosses above slow1hr;
def crossdn = fast1hr crosses below slow1hr;
## Signals
input show_arrows = yes;
AddChartBubble(buy_bubbles_on and bc3 and Sum(bp3, buffer) == 0, low * 0.9995, "Buy Call", if Sum(crossup, htf_lookback) > 0 then Color.GREEN else Color.GREEN, no);
AddChartBubble(buy_bubbles_on and bp3 and Sum(bc3, buffer) == 0, high * 1.0005, "Buy Put", if Sum(crossdn, htf_lookback) > 0 then Color.RED else Color.RED, yes);