Repaints The PAM High Low Chart Setup For ThinkOrSwim

Repaints
Status
Not open for further replies.
@OGOptionSlayer, just found the thread and it's almost what I was looking for. Just need a more clear picture of how do you use the indicator to trade.

as I understood, it seems to me you buy single legs puts or calls. if that is the case:
1 - how do you define the strike and DTE?
2 - also, can you explain how do you exit based in the indicator, for gain or loss cases?

personally I am more used to sell OTM credit spreads and was looking for some timing method for entry and exit and this indicator looks very promising, but I don't mind to buy single legs as long as I can have a good managing system, considering that generally it has less probability of success compared to OTM credit spreads

my applauses to you and @halcyonguy for your sharing

in the spirit of sharing, this is my experimental chart to help me define which way to go and timings for entry and closing independent of gain/loss http://tos.mx/aaJhwgv

as I understood, it seems to me you buy single legs puts or calls. if that is the case:
1 - how do you define the strike and DTE?
2 - also, can you explain how do you exit based in the indicator, for gain or loss cases?

I am definitely a single-leg puts and calls player. But this can be easily used for spreads.


Answer to Question 1: I only do 70% delta puts or calls and never 0 dte unless I am willing to just gamble.

Answer to Question 2: I used SATY ATR Levels. It's a free indicator and he has several Youtube tutorials on it. Typically my indicator compliments his extremely well and there is a whole half ATR above or below the solid line for my entry candle. I usually take profit at the next level on his indicator but keep runners until I get the reverse signal. So if I in puts, I wait until I get the "Buy Call" signal to completely exit.

Also, as I mentioned above, I highly recommend using John Carter's trend reversal strategy where he specifically says he does not get out of a trend until Squeeze Pro or TTM Squeeze makes two consecutive bars that show weakness. (ex: two yellow candles after all red for puts, or two dark blue bars after all cyan for calls). This means the trend is most likely going to reverse. It keeps me from getting shaken out by institutionals and it's where many big gainers (300% to 1000%) trades come from.

Typically though, the most solid exit signal is when you get the inverse signal of what you are in. But sometimes these candles are in a strong momentum squeeze and can easily take half your profit or more. So you have to manage your trade or you can do a trailing stop loss.

The indicator really allows you to manage how you want. The dotted line is always your stop loss and you should always keep that no matter what.

Answer to Question 2:
 
I modified the Entry candle painted. It will paint magenta and cyan for put and calls.


Code:
# 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
##1
#So I use a very specific setup. It's kind of a mashup between what John Carter teaches with one of his in Mastering the Trade and TradingWarz Golden Indicator. I've used it for about 2 years now and it's extremely profitable. Honestly, I haven't backtested it but I would love to but I'm just not as technical as most in here. I know it brings me immense profit and on Friday, my port grew 11% using it. It's not a small port either. It's a reversal setup and it's solid with tight stop losses. I use it with a Darvas Box but TOS has a great Darvas Box study.


#I'm looking to see if someone can create an indicator for it. To keep this post as short as possible, here is the setup:


#1) Only using the last 20 candles on any timeframe.
#2) Find the high and low of last 20 candles. As a new candle is created, it disregards anything not in the 20 candles.
#3) On the high candle, place a "Priceline" that is the low of that candle (wicks included).
#4) Once a candle closes a LL below that "Priceline", place a bubble called "Buy Puts" on that candle. It has to close below the low of the highest candle. It would be great if the candle could be painted a custom color. I use black in keeping with John Carter's concept.
#5) A stop loss "Priceline" is drawn on the "High" of the highest candle. This is a great stop loss and keeps risk at a low with confirmation that the trend is not reversing but also keeps you from getting shaken out by MM's.
#6) On the low candle, place a "Priceline" that is the high of that candle (wicks included).
#7) Once a candle closes a HH above that "Priceline", place a bubble called "Buy Calls" on that candle. It has to close above the high of the lowest candle. It would be great to have this candle also painted a customer color. Again, default should be black.
#8) A stop loss "Priceline" is drawn on the "Low" of the lowest candle. Again, another great stop loss to keep your risk at a minimum but also confirms that the trend reversal is not manifesting.




# 9  Also, I would like the indicator to have a trailing stop loss. I forgot to include this important point.


# 10  Once it has moved 50% from current entry,
#   for puts, put a stop loss at the HH of the last two candles
#   for calls, put a stop loss at the LL of the last two candles
#     to lock in profits




#=======================================




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;
}
# used in #4  buy puts , #7 calls




#---------------------------
# choose_wick_body01
#input plot_type = {default SMA, "Red EMA", "Green EMA", WMA};
input candle_levels = {default "wick" , "body" };
def highx;
def lowx;
switch (candle_levels) {
case "wick":
    highx = high;
    lowx = low;
case "body":
    highx = Max( open, close);
    lowx = Min( open, close);
}


#addlabel(yes, "choose=" + candle_levels + "..high=" + highx + "..low=" + lowx);
#-----------------------------






#1) Only using the last 20 candles on any timeframe.
input bars = 20;
def period = (!IsNaN(close) and IsNaN(close[-bars]));
#addverticalline(x,"-");






#2) Find the high and low of last 20 candles. As a new candle is created, it disregards anything not in the 20 candles.


# define group of x bars
def first = (!IsNaN(close[-(bars - 1)]) and IsNaN(close[-bars]));
AddVerticalLine(first, "-", Color.WHITE);






#----------------------------


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








addchartbubble(0, low,
bn + "\n" +
hihifirstbn
, color.yellow, no);








#-------------------------------------


#def lolo = 0;




# find lowest low
#def lo = if bn == 1 then 0
#  else if first then Lowest(low[-(bars - 1)], (bars - 1))
#  else lo[1];


##def lo2 = (lo == low);
#def islo = (lo == 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 test1 = no;
AddChartBubble(test1, 38,
hihi + "\n" +
#hi2 + "\n" +
ishi + "\n" +
lolo + "\n" +
#lo2
islo
, Color.YELLOW, yes);








input hilo_arrows = yes;


plot z1 = if hilo_arrows and ishi then high else na;
z1.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);
z1.SetDefaultColor(Color.CYAN);
z1.SetLineWeight(3);
z1.HideBubble();


plot z2 = if hilo_arrows and islo then low else na;
z2.SetPaintingStrategy(PaintingStrategy.ARROW_UP);
z2.SetDefaultColor(Color.CYAN);
z2.SetLineWeight(3);
z2.HideBubble();




#3) On the high candle, place a "Priceline" that is the low of that candle (wicks included).


# buy put
def put_buy_hilo = if bn == 1 or isnan(close) then 0 else if ishi then low else put_buy_hilo[1];
plot z3 = if put_buy_hilo > 0 then put_buy_hilo else na;
z3.SetDefaultColor(Color.RED);




#4) Once a candle closes a LL below that "Priceline", place a bubble called "Buy Puts" on that candle. It has to close below the low of the highest candle. It would be great if the candle could be painted a custom color. I use black in keeping with John Carter's concept.








# replace , draws many bubbles
#def buyput = if close[1] crosses below hilo then 1 else 0;
#def buyput = if close[buyoff] crosses below put_buy_hilo then 1 else 0;
#AddChartBubble(buy_bubbles_on and buyput, high * 1.0005, "Buy Put", Color.RED, yes);










# chg signal, remove dup signals
#  when triggered on first time, keep signal at 1.
#  then check for transition 0 to 1


# chg words ?   option ., stock oriented , or options
#  long-open , short-open
#  buy call , buy put


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


assignPriceColor(if bp3 then color.cyan else color.CURRENT);




addchartbubble(0,low*.997,
 close[buyoff] + "\n" +
 put_buy_hilo + "\n" +
 bp1 + "\n" +
 bp2 + "\n" +
 bp3
, color.yellow, no);










# buy only on first signal
#def buyput = if !period then 0
#  else if buyput[1] then buyput[1]
#  else if close[buyoff] crosses below hilo then 1
#  else buyput[1];


#def bp =  !buyput[1] and buyput;
#addchartbubble(bubbles_on and bp, high*1.001, "Buy Put", color.red, yes);




AddChartBubble(0, low * 0.997,
period + " p\n" +
#buyput + " bp\n" +
close[buyoff] + " cls\n" +
put_buy_hilo + " hl"
, Color.YELLOW, no);
















#5) A stop loss "Priceline" is drawn on the "High" of the highest candle. This is a great stop loss and keeps risk at a low with confirmation that the trend is not reversing but also keeps you from getting shaken out by MM's.




# hihi_level


#def hilo = if bn == 1 then 0 else if hi2 then low else hilo[1];
#plot z3 = if hilo > 0 then hilo else na;


# put stop , short stop
#def put_sell_hihi = if bn == 1 then 0 else if ishi then high else put_sell_hihi[1];
#plot z4 = if put_sell_hihi > 0 then put_buy_hilo else na;


plot z4 = hihi_level;
z4.SetDefaultColor(Color.RED);
z4.SetStyle(Curve.MEDIUM_DASH);




#6) On the low candle, place a "Priceline" that is the high of that candle (wicks included).


# buy call
#def call_buy_lohi = if bn == 1 or isnan(close) then na else if islo then high else call_buy_lohi[1];
# chg to 0 , simpler
def call_buy_lohi = if bn == 1 or isnan(close) then 0 else if islo then high else call_buy_lohi[1];
plot z5 = if  call_buy_lohi > 0 then call_buy_lohi else na;
z5.SetDefaultColor(Color.GREEN);






#7) Once a candle closes a HH above that "Priceline", place a bubble called "Buy Calls" on that candle. It has to close above the high of the lowest candle. It would be great to have this candle also painted a customer color. Again, default should be black.










# may bubbles
#def buycall = if close[1] crosses above lohi then 1 else 0;
#def buycall = if close[buyoff] crosses above call_buy_lohi then 1 else 0;
#AddChartBubble(buy_bubbles_on and buycall, low * 0.9995, "Buy Call", Color.GREEN, no);






# just first bubble
# bc = buycall
#def bc1 = if period and !first then (close[buyoff] crosses above call_buy_lohi) else 0;


# use offset so first bar of call_buy_lohi  checked is after the buy signal. so its not trying to cross above a na
#def bc1 = if period and !isnan(call_buy_lohi[1]) then (close[buyoff] crosses above call_buy_lohi) else 0;
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;


assignPriceColor(if bc3 then color.magenta else color.CURRENT);




addchartbubble(0,low*.997,
 close[buyoff] + "\n" +
 call_buy_lohi + "\n" +
 bc1 + "\n" +
 bc2 + "\n" +
 bc3
, color.yellow, no);
#, (if bc3 then color.yellow else color.gray), no);








#8) A stop loss "Priceline" is drawn on the "Low" of the lowest candle. Again, another great stop loss to keep your risk at a minimum but also confirms that the trend reversal is not manifesting.


#  call stop , long stop
#def call_sell_lolo = if bn == 1 then na else if islo then low else call_sell_lolo[1];
#plot z6 = call_sell_lolo;
plot z6 = lolo_level;
z6.SetDefaultColor(Color.GREEN);
z6.SetStyle(Curve.MEDIUM_DASH);






#9) Also, I would like the indicator to have a trailing stop loss. I forgot to include this important point.
# 10  Once it has moved 50% from current entry,
#   for puts, put a stop loss at the HH of the last two candles
#   for calls, put a stop loss at the LL of the last two candles


#input gain_stop_percent = 50;
input gain_stop_percent = 20;
def offx = 2;
def ref_bubble_x = (!IsNaN(close[offx]) and IsNaN(close[(offx-1)]));




# puts
#  draw stop ref line at (buy put $$) - 50%
# putreflevel = hilo - ( hilo * x%)




# puts
def putreflevel = put_buy_hilo - (put_buy_hilo * (gain_stop_percent/100));
# dashed line for stop , gray/red. draw dash line first
plot z23 = if put_buy_hilo > 0 then  putreflevel else na;
# this color will appear as longer dashes than next color
z23.SetDefaultColor(Color.light_red);
#z23.SetDefaultColor(Color.light_gray);
z23.SetStyle(Curve.medium_DASH);
plot z24 = z23;
z24.SetDefaultColor(Color.light_gray);
#z24.SetDefaultColor(Color.light_red);




addchartbubble(ref_bubble_x, z23[offx],
gain_stop_percent + "%  put stop ref"
, color.yellow, yes);






addchartbubble(0, low,
  put_buy_hilo + "\n" +
 putreflevel + "\n" +
 z23
, color.yellow, no);






# calls
def callreflevel = call_buy_lohi + (call_buy_lohi * (gain_stop_percent/100));
# dashed line for stop , gray/red. draw dash line first
plot z25 = if call_buy_lohi > 0 then callreflevel else na;
# this color will appear as longer dashes than next color
z25.SetDefaultColor(Color.green);
#z25.SetDefaultColor(Color.light_gray);
z25.SetStyle(Curve.medium_DASH);
plot z26 = z25;
z26.SetDefaultColor(Color.blue);
#z26.SetDefaultColor(Color.gray);
#z26.SetDefaultColor(Color.light_red);




addchartbubble(ref_bubble_x, z25[offx],
gain_stop_percent + "%  call stop ref"
, color.yellow, no);


#
@halcyonguy Can you review this and okay it to publish? It's kind of our creation and I do want to add it if it's legit and satisfies your coding tastebuds lol.

@tradelex20 Thanks for this brother!
 
Pretty cool indicator here, I like it a lot honestly -- I've tried it a few time for pullbacks within a large trend and it works great. One of the things I dislike in indicators is mixed signals though, so I made my own edit on the code. My version suppresses signals of the opposite direction when a signal has already been fired within a "buffer" lookback period, i.e. if a put signal has fired then no call signals will fire within that timeframe.

I also added the option for clouds, which will disappear once the opposite signal has fired(good for exits if you haven't taken them already, shown below) and also added arrows as signals instead of labels by selecting "no" for the buy bubbles option:

Dg1y1HV.png


I can also look at adding fibs on the high-low range as well if Halcyon doesn't get it to it first. Here's the study link: http://tos.mx/2YOjikZ

edit on this: I added a quick fib retracement fix to set on the high-low range. Nothing crazy, just set colors for the low, high, and 50% retracement:
5Tpvyen.png


If that makes sense, y'all are welcome to use the fib portion of the code how you will: http://tos.mx/nCu3vBj
Ruby:
# High_Low_range_carter_00e
# Version 1.5 added fibs and clouds @Chemmy 12/29/22
#https://usethinkscript.com/threads/looking-to-setup-a-high-low-range.13750/
#Looking to Setup A High-Low Range
#OGOptionSlayer  12/19
#So I use a very specific setup. It's kind of a mashup between what John Carter teaches with one of his in Mastering the Trade and TradingWarz Golden Indicator. I've used it for about 2 years now and it's extremely profitable. Honestly, I haven't backtested it but I would love to but I'm just not as technical as most in here. I know it brings me immense profit and on Friday, my port grew 11% using it. It's not a small port either. It's a reversal setup and it's solid with tight stop losses. I use it with a Darvas Box but TOS has a great Darvas Box study.

#I'm looking to see if someone can create an indicator for it. To keep this post as short as possible, here is the setup:

#1) Only using the last 20 candles on any timeframe.
#2) Find the high and low of last 20 candles. As a new candle is created, it disregards anything not in the 20 candles.
#3) On the high candle, place a "Priceline" that is the low of that candle (wicks included).
#4) Once a candle closes a LL below that "Priceline", place a bubble called "Buy Puts" on that candle. It has to close below the low of the highest candle. It would be great if the candle could be painted a custom color. I use black in keeping with John Carter's concept.
#5) A stop loss "Priceline" is drawn on the "High" of the highest candle. This is a great stop loss and keeps risk at a low with confirmation that the trend is not reversing but also keeps you from getting shaken out by MM's.
#6) On the low candle, place a "Priceline" that is the high of that candle (wicks included).
#7) Once a candle closes a HH above that "Priceline", place a bubble called "Buy Calls" on that candle. It has to close above the high of the lowest candle. It would be great to have this candle also painted a customer color. Again, default should be black.
#8) A stop loss "Priceline" is drawn on the "Low" of the lowest candle. Again, another great stop loss to keep your risk at a minimum but also confirms that the trend reversal is not manifesting.


# 9  Also, I would like the indicator to have a trailing stop loss. I forgot to include this important point.

# 10  Once it has moved 50% from current entry,
#   for puts, put a stop loss at the HH of the last two candles
#   for calls, put a stop loss at the LL of the last two candles
#     to lock in profits


#=======================================

input add_cloud = yes;
input show_stop = no;
input buffer = 10;

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;
}
# used in #4  buy puts , #7 calls


#---------------------------
# choose_wick_body01
#input plot_type = {default SMA, "Red EMA", "Green EMA", WMA};
input candle_levels = {default "wick" , "body" };
def highx;
def lowx;
switch (candle_levels) {
case "wick":
    highx = high;
    lowx = low;
case "body":
    highx = Max( open, close);
    lowx = Min( open, close);
}



#1) Only using the last 20 candles on any timeframe.
input bars = 20;
def period = (!IsNaN(close) and IsNaN(close[-bars]));
#addverticalline(x,"-");



#2) Find the high and low of last 20 candles. As a new candle is created, it disregards anything not in the 20 candles.

# define group of x bars
def first = (!IsNaN(close[-(bars - 1)]) and IsNaN(close[-bars]));
AddVerticalLine(first, "-", Color.WHITE);

#----------------------------

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


addchartbubble(0, low,
bn + "\n" +
hihifirstbn
, color.yellow, no);

#-------------------------------------

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

plot z1 = if hilo_arrows and ishi then high else na;
z1.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);
z1.SetDefaultColor(Color.CYAN);
z1.SetLineWeight(3);
z1.HideBubble();

plot z2 = if hilo_arrows and islo then low else na;
z2.SetPaintingStrategy(PaintingStrategy.ARROW_UP);
z2.SetDefaultColor(Color.CYAN);
z2.SetLineWeight(3);
z2.HideBubble();


#3) On the high candle, place a "Priceline" that is the low of that candle (wicks included).

# buy put
def put_buy_hilo = if bn == 1 or isnan(close) then 0 else if ishi then low else put_buy_hilo[1];
plot z3 = if put_buy_hilo > 0 then put_buy_hilo else na;
z3.SetDefaultColor(Color.RED);


#4) Once a candle closes a LL below that "Priceline", place a bubble called "Buy Puts" on that candle. It has to close below the low of the highest candle. It would be great if the candle could be painted a custom color. I use black in keeping with John Carter's concept.

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

AddChartBubble(buy_bubbles_on and bp3, high * 1.0005, "Buy Put", Color.RED, yes);

addchartbubble(0,low*.997,
 close[buyoff] + "\n" +
 put_buy_hilo + "\n" +
 bp1 + "\n" +
 bp2 + "\n" +
 bp3
, color.yellow, no);


AddChartBubble(0, low * 0.997,
period + " p\n" +
#buyput + " bp\n" +
close[buyoff] + " cls\n" +
put_buy_hilo + " hl"
, Color.YELLOW, no);


#5) A stop loss "Priceline" is drawn on the "High" of the highest candle. This is a great stop loss and keeps risk at a low with confirmation that the trend is not reversing but also keeps you from getting shaken out by MM's.

plot z4 = hihi_level;
z4.SetDefaultColor(Color.RED);
z4.SetStyle(Curve.MEDIUM_DASH);



#6) On the low candle, place a "Priceline" that is the high of that candle (wicks included).

# buy call
def call_buy_lohi = if bn == 1 or isnan(close) then 0 else if islo then high else call_buy_lohi[1];
plot z5 = if  call_buy_lohi > 0 then call_buy_lohi else na;
z5.SetDefaultColor(Color.GREEN);

#7) Once a candle closes a HH above that "Priceline", place a bubble called "Buy Calls" on that candle. It has to close above the high of the lowest candle. It would be great to have this candle also painted a customer color. Again, default should be black.

# use offset so first bar of call_buy_lohi  checked is after the buy signal. so its not trying to cross above a na
#def bc1 = if period and !isnan(call_buy_lohi[1]) then (close[buyoff] crosses above call_buy_lohi) else 0;

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;

AddChartBubble(buy_bubbles_on and bc3, low * 0.9995, "Buy Call", Color.GREEN, no);

addchartbubble(0,low*.997,
 close[buyoff] + "\n" +
 call_buy_lohi + "\n" +
 bc1 + "\n" +
 bc2 + "\n" +
 bc3
, color.yellow, no);


#8) A stop loss "Priceline" is drawn on the "Low" of the lowest candle. Again, another great stop loss to keep your risk at a minimum but also confirms that the trend reversal is not manifesting.

#  call stop , long stop
#def call_sell_lolo = if bn == 1 then na else if islo then low else call_sell_lolo[1];
#plot z6 = call_sell_lolo;
plot z6 = lolo_level;
z6.SetDefaultColor(Color.GREEN);
z6.SetStyle(Curve.MEDIUM_DASH);



#9) Also, I would like the indicator to have a trailing stop loss. I forgot to include this important point.


# 10  Once it has moved 50% from current entry,
#   for puts, put a stop loss at the HH of the last two candles
#   for calls, put a stop loss at the LL of the last two candles

#input gain_stop_percent = 50;
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));

plot z23 = if put_buy_hilo > 0 then  putreflevel else na;
z23.SetDefaultColor(Color.light_red);
z23.SetStyle(Curve.medium_DASH);

plot z24 = z23;
z24.SetDefaultColor(Color.light_gray);


addchartbubble(ref_bubble_x and show_stop, z23[offx],
gain_stop_percent + "%  put stop ref"
, color.yellow, yes);

addchartbubble(0, low,
  put_buy_hilo + "\n" +
 putreflevel + "\n" +
 z23
, color.yellow, no);


# calls
def callreflevel = call_buy_lohi + (call_buy_lohi * (gain_stop_percent/100));
# dashed line for stop , gray/red. draw dash line first
plot z25 = if call_buy_lohi > 0 then callreflevel else na;
z25.SetDefaultColor(Color.green);
z25.SetStyle(Curve.medium_DASH);

plot z26 = z25;
z26.SetDefaultColor(Color.blue);

z23.sethiding(!show_stop);
z24.sethiding(!show_stop);
z25.sethiding(!show_stop);
z26.sethiding(!show_stop);


addchartbubble(ref_bubble_x and show_stop, z25[offx],
gain_stop_percent + "%  call stop ref"
, color.yellow, no);


## Signals
addcloud(if add_cloud and (sum(bc3, buffer)==0) then z3 else na, z4, color.red, color.red);
addcloud(if add_cloud and (sum(bp3, buffer)==0) then z5 else na, z6, color.green, color.green);

plot down = !buy_bubbles_on and bp3 and ( sum(bc3, buffer)==0);
down.setpaintingstrategy(paintingstrategy.boolean_arrow_down);
down.setdefaultcolor(color.red);
down.setlineweight(3);

plot up = !buy_bubbles_on and bc3 and (sum(bp3, buffer)==0 );
up.setpaintingstrategy(paintingstrategy.boolean_arrow_up);
up.setdefaultcolor(color.green);
up.setlineweight(3);


## Fibs
input showfibs = yes;

def h = hihi;
def l = lolo;
def range = h - l;

plot high = if showfibs then h else double.nan;
plot fib113 = if showfibs then h-(range*.113) else double.nan;
plot fib236 = if showfibs then h-(range*.236) else double.nan;
plot fib382 = if showfibs then h-(range*.382) else double.nan;
plot fib50 = if showfibs then h-(range*.5) else double.nan;
plot fib618 = if showfibs then h-(range*.618) else double.nan;
plot fib764 = if showfibs then h-(range*.764) else double.nan;
plot fib887 = if showfibs then h-(range*.887) else double.nan;
plot low = if showfibs then l else double.nan;


high.setdefaultcolor(color.red);
fib113.setdefaultcolor(color.yellow);
fib236.setdefaultcolor(color.yellow);
fib382.setdefaultcolor(color.yellow);
fib50.setdefaultcolor(color.white);
fib618.setdefaultcolor(color.yellow);
fib764.setdefaultcolor(color.yellow);
fib887.setdefaultcolor(color.yellow);
low.setdefaultcolor(color.green);


high.setPaintingStrategy(paintingStrategy.HORIZONTAL);
fib113.setPaintingStrategy(paintingStrategy.HORIZONTAL);
fib236.setPaintingStrategy(paintingStrategy.HORIZONTAL);
fib382.setPaintingStrategy(paintingStrategy.HORIZONTAL);
fib50.setPaintingStrategy(paintingStrategy.HORIZONTAL);
fib618.setPaintingStrategy(paintingStrategy.HORIZONTAL);
fib764.setPaintingStrategy(paintingStrategy.HORIZONTAL);
fib887.setPaintingStrategy(paintingStrategy.HORIZONTAL);
low.setPaintingStrategy(paintingStrategy.HORIZONTAL);

#
 
Last edited by a moderator:
If that makes sense, y'all are welcome to use the fib portion of the code how you will: http://tos.mx/nCu3vBj

Thank you for posting the fib code. I didn't know how to do that. I just draw 'em by hand.


@OGOptionSlayer, Lather. Rinse. Repeat. The exact same fib play hit targets this morning. Never been a fan of trading reversals but you are changing my perspective :)
 
Pretty cool indicator here, I like it a lot honestly -- I've tried it a few time for pullbacks within a large trend and it works great. One of the things I dislike in indicators is mixed signals though, so I made my own edit on the code. My version suppresses signals of the opposite direction when a signal has already been fired within a "buffer" lookback period, i.e. if a put signal has fired then no call signals will fire within that timeframe.

I also added the option for clouds, which will disappear once the opposite signal has fired(good for exits if you haven't taken them already, shown below) and also added arrows as signals instead of labels by selecting "no" for the buy bubbles option:

Dg1y1HV.png


I can also look at adding fibs on the high-low range as well if Halcyon doesn't get it to it first. Here's the study link: http://tos.mx/2YOjikZ

edit on this: I added a quick fib retracement fix to set on the high-low range. Nothing crazy, just set colors for the low, high, and 50% retracement:
5Tpvyen.png


If that makes sense, y'all are welcome to use the fib portion of the code how you will: http://tos.mx/nCu3vBj
This is an amazing adaptation. I do want to get this into @halcyonguy's hands and have one place for the indicator to be used by all of us so we are modifying the same code and collectively as a community making it better.
 
Able to get in early on pm today on spy with 2+. Job report data help lol. Trying to capture trend with 1-2 min reversal as long as 15 mins still in green cloud, hist- cyan and 10> 50 ema
 
I did notice a bug this morning on $SPY. The "Buy Put" signal appeared on the first candle and it wasn't even close yet and lines were not drawn at all. I didn't capture it prior to the lines not being drawn but we need to take a look and fix it.


SyQkXVW.png


Okay, just did it on my 65m candle. Here is it.

uds4DZG.png


Definitely not how it's designed to work so please be wary of this signal. I don't like the bubbles but understand their usefulness. Would rather just paint the entry signal candle instead of having the bubble. John Carter paints them black on his HOLP and LOLP plays. That's where I came up with this strategy and just adapted it to match my style, which apparently speaks to many of you as well.
 
Pretty cool indicator here, I like it a lot honestly -- I've tried it a few time for pullbacks within a large trend and it works great. One of the things I dislike in indicators is mixed signals though, so I made my own edit on the code. My version suppresses signals of the opposite direction when a signal has already been fired within a "buffer" lookback period, i.e. if a put signal has fired then no call signals will fire within that timeframe.

I also added the option for clouds, which will disappear once the opposite signal has fired(good for exits if you haven't taken them already, shown below) and also added arrows as signals instead of labels by selecting "no" for the buy bubbles option:

Dg1y1HV.png


I can also look at adding fibs on the high-low range as well if Halcyon doesn't get it to it first. Here's the study link: http://tos.mx/2YOjikZ

edit on this: I added a quick fib retracement fix to set on the high-low range. Nothing crazy, just set colors for the low, high, and 50% retracement:
5Tpvyen.png


If that makes sense, y'all are welcome to use the fib portion of the code how you will: http://tos.mx/nCu3vBj
@Chemmy I'm getting two Buy Call bubbles or Buy Put bubbles on my chart. I can disable them but I think there is some issue in your code. Can you take a look? Also, same issue I reported above with it giving a "Buy Put" signal before HH candle closes and solid and dashed line are formed.
 
@Chemmy I'm getting two Buy Call bubbles or Buy Put bubbles on my chart. I can disable them but I think there is some issue in your code. Can you take a look? Also, same issue I reported above with it giving a "Buy Put" signal before HH candle closes and solid and dashed line are formed.
Sure, I can take a look -- the actual signal code I haven't modified at all yet, the only "modification" I did to the signals was to add the option for arrows instead of bubbles. But I can definitely try to spot where any duplicate signals are coming from -- @halcyonguy is a much more advanced thinkscript coder than me but I may be able to at least debug it, will let you know.

@OGOptionSlayer can you show me/tell me what ticker/timeframe you got the duplicate signals on? I haven't seen that in my trading just yet but I'd like to try and replicate your error.
 
Last edited:
Sure, I can take a look -- the actual signal code I haven't modified at all yet, the only "modification" I did to the signals was to add the option for arrows instead of bubbles. But I can definitely try to spot where any duplicate signals are coming from -- @halcyonguy is a much more advanced thinkscript coder than me but I may be able to at least debug it, will let you know.

@OGOptionSlayer can you show me/tell me what ticker/timeframe you got the duplicate signals on? I haven't seen that in my trading just yet but I'd like to try and replicate your error.
Here is the example:

atP3ton.png
 
Here is the example:

atP3ton.png
Okay gotcha, yes I'll take a look at that then. To be honest I haven't been using the labels at all, only the arrows (or if you want, I could paint the bars) so I haven't noticed that type of duplicate signal. I'm currently working on the issue where the signal fires immediately, which actually only fires when the study is set to "completed bar".

I think I've solved it though, I think it's a bug in the code where that setting references close[1] data so there are times where the highest high was also being referenced as a signal. I'm trying to find active examples of this happening so I can be sure it's fixed though.
 
Last edited:
Okay gotcha, yes I'll take a look at that then. To be honest I haven't been using the labels at all, only the arrows (or if you want, I could paint the bars) so I haven't noticed that type of duplicate signal. I'm currently working on the issue where the signal fires immediately, which actually only fires when the study is set to "completed bar".

I think I've solved it though, I think it's a bug in the code where that setting references close[1] data so there are times where the highest high was also being referenced as a signal. I'm trying to find active examples of this happening so I can be sure it's fixed though.
If you could make it where the bars paint and users can modify the color to anything they want, that would be great. I think an entry signal bar is the most effective means of providing the signal. And honestly, I try to stay true as much to what John Carter suggests, as I think he's the best living options trader on the planet so mimicking his style is not a bad thing in my book.
 
If you could make it where the bars paint and users can modify the color to anything they want, that would be great. I think an entry signal bar is the most effective means of providing the signal. And honestly, I try to stay true as much to what John Carter suggests, as I think he's the best living options trader on the planet so mimicking his style is not a bad thing in my book.
Sure thing! I've got to head out for a bit but I'll continue working on this later this evening as I have time. If anyone else wants to take up the code before I can get back to it they're welcome to.
 
Hey OG you mention for reversal you also wanna see LL or HH get crosses for confluence on 65 min right?
That's the way I identify the trend to be honest. If I'm not getting the signal on the 65m then I'm hesitant doing anything that any indicator is telling me because long term, it hasn't even signaled the reversal. And I prefer the 65m because it divides the trading day into 6 even trading periods. This allows you to see if a LL or HH was made in one of those candles usually indicating a significant break in a critical support/resistance level.
 
@OGOptionSlayer ... How can I custom my thinkorswim time frame to 65m? I tried doing that but it won't work. Also, I noticed that the “buy Call/buy Put” bubble repaints. Today, a Buy-Call bubble appeared in premarket, however, the bubble disappeared and then appeared on a candle at the market open. The candle it appeared on was one of the previous candles at the open on the 15m chart.
 
@OGOptionSlayer ... How can I custom my thinkorswim time frame to 65m? I tried doing that but it won't work. Also, I noticed that the “buy Call/buy Put” bubble repaints. Today, a Buy-Call bubble appeared in premarket, however, the bubble disappeared and then appeared on a candle at the market open. The candle it appeared on was one of the previous candles at the open on the 15m chart.
in tos platform charts => chart settings => time axis => aggregation period => 00:65
 
Status
Not open for further replies.

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

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
383 Online
Create Post

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