Would love this created for TOS. A very cool indicator from Blackcat.
https://www.tradingview.com/script/ta9Xp7Tg/
https://www.tradingview.com/script/ta9Xp7Tg/
Last edited by a moderator:
Join useThinkScript to post your question to a community of 21,000+ developers and traders.
Would love this created for TOS. A very cool indicator from Blackcat.
https://www.tradingview.com/script/ta9Xp7Tg/
# blackcat_buyback_00
# https://usethinkscript.com/threads/convert-tradingview-blackcat-buy-back.13219/
# Tradingview Convert Tradingview BlackCat Buy Back
# mtlyon23 11/2
#https://www.tradingview.com/script/ta9Xp7Tg/
# // ____ __ ___ ________ ___________ ___________ __ ____ ___
# // / __ )/ / / | / ____/ //_/ ____/ |/_ __< / // / / __ |__ \
# // / __ / / / /| |/ / / ,< / / / /| | / / / / // /_/ / / __/ /
# // / /_/ / /___/ ___ / /___/ /| / /___/ ___ |/ / / /__ __/ /_/ / __/
#// /_____/_____/_/ |_\____/_/ |_\____/_/ |_/_/ /_/ /_/ \____/____/
#
#// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
#// © blackcat1402
#//@version=4
#study("[blackcat] L1 Buy Back","Buy Back", overlay=true, max_bars_back=5000, max_labels_count=500)
#//functions
#xrf(values, length) =>
# r_val = float(na)
# if length >= 1
# for i = 0 to length by 1
# if na(r_val) or not na(values[i])
# r_val := values[i]
# r_val
# r_val
def na = double.nan;
def bn = barnumber();
# last bar ( most recent)
#def lastbar = !isnan(close[0]) and isnan(close[-1]);
# -------------------
script xrf {
input values = 0;
input length = 0;
def r_val =
if length >= 1 then
fold i = 0 to length+1
with p
do (if !isnan(getvalue(values,i)) then getvalue(values,i) else p)
else double.nan;
plot z = r_val;
}
input n = 24;
def price = close;
#fast = sma(close,n)
def fast_len = n;
input fast_type = AverageType.simple;
def fast = MovingAverage(fast_type, price, fast_len);
#slow = sma(fast,12)
input slow_len = 12;
input slow_type = AverageType.simple;
def slow = MovingAverage(slow_type, price, slow_len);
input v_len = 5;
input v_type = AverageType.simple;
def vavg = MovingAverage(v_type, volume, v_len);
def cond1 = low < fast;
def cond2 = close > fast;
def cond3 = (close / xrf(close,1)) < fast;
#cond4 = crossover(close,fast) and volume/xrf(sma(volume,5),1)>1.016
def cond4 = (close crosses above fast) and (volume / xrf( vavg, 1)) > 1.016;
def buy = cond1 and cond2 and cond3 and cond4;
#sell = crossunder(fast, slow)
def sell = (fast crosses below slow);
#Plot1 = plot( fast, "fast slope" ,color=color.yellow, linewidth=2)
#Plot2 = plot( slow, "slow slope",color=color.white, linewidth=2 )
plot zfast = fast;
plot zslow = slow;
zfast.SetDefaultColor(Color.yellow);
# x.setlineweight(1);
zfast.hidebubble();
zslow.SetDefaultColor(Color.white);
# x.setlineweight(1);
zslow.hidebubble();
#fill(Plot1, Plot2, color=fast>slow?color.new(color.yellow,60):color.new(color.fuchsia,60))
addcloud(fast, slow, color.yellow, color. magenta);
#bs_label = sell ?
# label.new (bar_index, high, "S", color=color.new(color.lime,20), textcolor=color.white, #style=label.style_label_down, yloc=yloc.price, size=size.small) : buy ?
# label.new (bar_index, low, "B", color=color.new(color.red, 20), textcolor=color.white, #style=label.style_label_up, yloc=yloc.price, size=size.small) : na
addchartbubble(sell, high , "S", color.red, yes);
addchartbubble(buy, low , "B", color.green, no);
#
check it outWould love this created for TOS. A very cool indicator from Blackcat.
https://www.tradingview.com/script/ta9Xp7Tg/
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © blackcat1402
//@version=4
study("[blackcat] L1 Buy Back","Buy Back", overlay=true, max_bars_back=5000, max_labels_count=500)
//functions
xrf(values, length) =>
r_val = float(na)
if length >= 1
for i = 0 to length by 1
if na(r_val) or not na(values)
r_val := values
r_val
r_val
n = input(24 , title = 'period n', minval = 1)
fast = sma(close,n)
slow = sma(fast,12)
cond1 = low<fast
cond2 = close>fast
cond3 = close/xrf(close,1)<fast
cond4 = crossover(close,fast) and volume/xrf(sma(volume,5),1)>1.016
buy = cond1 and cond2 and cond3 and cond4
sell = crossunder(fast, slow)
Plot1 = plot( fast, "fast slope" ,color=color.yellow, linewidth=2)
Plot2 = plot( slow, "slow slope",color=color.white, linewidth=2 )
fill(Plot1, Plot2, color=fast>slow?color.new(color.yellow,60):color.new(color.fuchsia,60))
bs_label = sell ?
label.new (bar_index, high, "S", color=color.new(color.lime,20), textcolor=color.white, style=label.style_label_down, yloc=yloc.price, size=size.small) :
buy ?
label.new (bar_index, low, "B", color=color.new(color.red, 20), textcolor=color.white, style=label.style_label_up, yloc=yloc.price, size=size.small) :
na
#// This source code is subject to the terms of the Mozilla Public License 2.0
#// © blackcat1402
#study("[blackcat] L1 Buy Back","Buy Back",
# Converted and mod by Sam4Cok@Samer800 - 11/2022
#//functions
#xrf(values, length) =>
script xrf {
input values = close;
input length = 12;
def r_val;
r_val = if length >= 1 then
fold i = 0 to length with p do
if isNaN(r_val[1]) or !isNaN(values[i]) then values[i] else r_val[1] else Double.NaN;
plot return = r_val;
}
script ma {
input src = close;
input len = 10;
input type = "SMA";
def ma = if type == "SMA" then SimpleMovingAvg(src, len) else
if type == "EMA" then ExpAverage(src, len) else WMA(src, len);
plot return = ma;
}
input ShowBubbles = yes;
input ShowCloud = yes;
input maType = {Default SMA, EMA, WMA};
input fastPeriod = 24;
input smoothing = 12;
def c = close; def h = high; def l = low; def v = volume;
def na = Double.NaN;
def fast = ma(c,fastPeriod,maType);
def slow = ma(fast,smoothing,maType);
def cond1 = l<fast;
def cond2 = c>fast;
def cond3 = c/xrf(c,1)<fast;
def cond4 = crosses(c,fast, CrossingDirection.ABOVE) and v/xrf(ma(v,5,maType),1)>1.016;
def buy = cond1 and cond2 and cond3 and cond4;
def sell = crosses(fast, slow, CrossingDirection.BELOW);
plot fastSlope = fast; # "fast slope"
fastSlope.SetDefaultColor(Color.DARK_GREEN);
plot slowSlope = slow; # "slow slope"
slowSlope.SetDefaultColor(Color.DARK_RED);
AddCloud(if ShowCloud then fast else na, slow, Color.DARK_GREEN, Color.DARK_RED);
AddChartBubble(ShowBubbles and sell, h, "S", Color.RED, yes);
AddChartBubble(ShowBubbles and buy, l, "B", Color.GREEN, no);
#--- End Code
sorry bro, I didn't noticed that you already converted iti think this is correct.
not sure about the xrf sub script
i changed the bubble colors to be,
. buy is green, sell is red
Code:# blackcat_buyback_00 # https://usethinkscript.com/threads/convert-tradingview-blackcat-buy-back.13219/ # Tradingview Convert Tradingview BlackCat Buy Back # mtlyon23 11/2 #https://www.tradingview.com/script/ta9Xp7Tg/ # // ____ __ ___ ________ ___________ ___________ __ ____ ___ # // / __ )/ / / | / ____/ //_/ ____/ |/_ __< / // / / __ |__ \ # // / __ / / / /| |/ / / ,< / / / /| | / / / / // /_/ / / __/ / # // / /_/ / /___/ ___ / /___/ /| / /___/ ___ |/ / / /__ __/ /_/ / __/ #// /_____/_____/_/ |_\____/_/ |_\____/_/ |_/_/ /_/ /_/ \____/____/ # #// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ #// © blackcat1402 #//@version=4 #study("[blackcat] L1 Buy Back","Buy Back", overlay=true, max_bars_back=5000, max_labels_count=500) #//functions #xrf(values, length) => # r_val = float(na) # if length >= 1 # for i = 0 to length by 1 # if na(r_val) or not na(values[i]) # r_val := values[i] # r_val # r_val def na = double.nan; def bn = barnumber(); # last bar ( most recent) #def lastbar = !isnan(close[0]) and isnan(close[-1]); # ------------------- script xrf { input values = 0; input length = 0; def r_val = if length >= 1 then fold i = 0 to length+1 with p do (if !isnan(getvalue(values,i)) then getvalue(values,i) else p) else double.nan; plot z = r_val; } input n = 24; def price = close; #fast = sma(close,n) def fast_len = n; input fast_type = AverageType.simple; def fast = MovingAverage(fast_type, price, fast_len); #slow = sma(fast,12) input slow_len = 12; input slow_type = AverageType.simple; def slow = MovingAverage(slow_type, price, slow_len); input v_len = 5; input v_type = AverageType.simple; def vavg = MovingAverage(v_type, volume, v_len); def cond1 = low < fast; def cond2 = close > fast; def cond3 = (close / xrf(close,1)) < fast; #cond4 = crossover(close,fast) and volume/xrf(sma(volume,5),1)>1.016 def cond4 = (close crosses above fast) and (volume / xrf( vavg, 1)) > 1.016; def buy = cond1 and cond2 and cond3 and cond4; #sell = crossunder(fast, slow) def sell = (fast crosses below slow); #Plot1 = plot( fast, "fast slope" ,color=color.yellow, linewidth=2) #Plot2 = plot( slow, "slow slope",color=color.white, linewidth=2 ) plot zfast = fast; plot zslow = slow; zfast.SetDefaultColor(Color.yellow); # x.setlineweight(1); zfast.hidebubble(); zslow.SetDefaultColor(Color.white); # x.setlineweight(1); zslow.hidebubble(); #fill(Plot1, Plot2, color=fast>slow?color.new(color.yellow,60):color.new(color.fuchsia,60)) addcloud(fast, slow, color.yellow, color. magenta); #bs_label = sell ? # label.new (bar_index, high, "S", color=color.new(color.lime,20), textcolor=color.white, #style=label.style_label_down, yloc=yloc.price, size=size.small) : buy ? # label.new (bar_index, low, "B", color=color.new(color.red, 20), textcolor=color.white, #style=label.style_label_up, yloc=yloc.price, size=size.small) : na addchartbubble(sell, high , "S", color.red, yes); addchartbubble(buy, low , "B", color.green, no); #
Z 15min
![]()
wow great job @samer800 like always, quick add on if is possible, do you think price color with signals? thanks in advancecheck it out
CSS:#// This source code is subject to the terms of the Mozilla Public License 2.0 #// © blackcat1402 #study("[blackcat] L1 Buy Back","Buy Back", # Converted and mod by Sam4Cok@Samer800 - 11/2022 #//functions #xrf(values, length) => script xrf { input values = close; input length = 12; def r_val; r_val = if length >= 1 then fold i = 0 to length with p do if isNaN(r_val[1]) or !isNaN(values[i]) then values[i] else r_val[1] else Double.NaN; plot return = r_val; } script ma { input src = close; input len = 10; input type = "SMA"; def ma = if type == "SMA" then SimpleMovingAvg(src, len) else if type == "EMA" then ExpAverage(src, len) else WMA(src, len); plot return = ma; } input ShowBubbles = yes; input ShowCloud = yes; input maType = {Default SMA, EMA, WMA}; input fastPeriod = 24; input smoothing = 12; def c = close; def h = high; def l = low; def v = volume; def na = Double.NaN; def fast = ma(c,fastPeriod,maType); def slow = ma(fast,smoothing,maType); def cond1 = l<fast; def cond2 = c>fast; def cond3 = c/xrf(c,1)<fast; def cond4 = crosses(c,fast, CrossingDirection.ABOVE) and v/xrf(ma(v,5,maType),1)>1.016; def buy = cond1 and cond2 and cond3 and cond4; def sell = crosses(fast, slow, CrossingDirection.BELOW); plot fastSlope = fast; # "fast slope" fastSlope.SetDefaultColor(Color.DARK_GREEN); plot slowSlope = slow; # "slow slope" slowSlope.SetDefaultColor(Color.DARK_RED); AddCloud(if ShowCloud then fast else na, slow, Color.DARK_GREEN, Color.DARK_RED); AddChartBubble(ShowBubbles and sell, h, "S", Color.RED, yes); AddChartBubble(ShowBubbles and buy, l, "B", Color.GREEN, no); #--- End Code
add the line at the end of the code.oh may not explain well. what i mean is, if is a buy signal paint the candles let say blue, if is a short signal paint the candles magenta.
Thread starter | Similar threads | Forum | Replies | Date |
---|---|---|---|---|
![]() |
[blackcat] L1 Volatility Quality Index (VQI) for ThinkOrSwim | Custom | 0 | |
![]() |
[blackcat] L2 Super Oscillator for ThinkOrSwim | Custom | 3 | |
![]() |
[blackcat] L1 Chop Zones for ThinkOrSwim | Custom | 7 | |
![]() |
[blackcat] L3 Jurik MACD for ThinkOrSwim | Custom | 3 | |
![]() |
L2 Bull-Bear Momentum [blackcat] for ThinkOrSwim | Custom | 6 |
Start a new thread and receive assistance from our community.
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.
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.