TradingWarz Holy Grail / Nirvana For ThinkOrSwim

Gymini

Member
An updated TradingWarz Holy Grail / Nirvana script contributed by @DjEskimo007 can be found:
https://usethinkscript.com/threads/tradingwarz-holy-grail-nirvana-for-thinkorswim.9642/#post-102991

My first request for an indicator from Trading Warz- just recently started following him and really like his simplified strategy.
His indies-
IB-inside bar(yellow)
OB-outside bar(white)
Holy Grail-OB+IB (a vertical colored line that shades these 2 candles from top of chart to bottom plots also) Yellow in vid
Nirvana-IB+OB (a vertical colored line that shades these 2 candles from top of chart to bottom plots also) Blue in vid

*also can candles be labeled like the video?
*someone posted these for tos on his twitter but only plots a small dot on the candle
*will not be asking 35 follow up ??? for a scanner, watchlist, a color coded rainbow that points to a pot of gold in my backyard when the 9ema points so high it blocks the camera on my laptop
The link to discord is on the front page of his website: https://tradingwarz.com/
 
Last edited by a moderator:
Code:
#def lastbar = !isnan(close[0]) and isnan(close[-1]);
#def src = close;
#input length = 20;
#input mult = 2.0;
#def mult2 = if mult > 50 then 50 else if mult < 0.001 then 0.001 else mult;


# inside and outside bars
def inBar = low > low[1] and high < high[1];
def outBar = low < low[1] and high > high[1];
def holyGrail = low[1] < low[2] and high[1] > high[2] and low > low[1] and high < high[1];
#def nirvana = low[1] > low[2] and high[1] < high[2] and low < low[1] and high > high[1];


input bubble_ht_offset = 0.0006;
DefineGlobalColor("IB", Color.yellow);
DefineGlobalColor("OB", Color.blue);
addchartbubble(inbar, (high * (1 + bubble_ht_offset)), "IB", GlobalColor("IB"));
addchartbubble(outbar, (high * (1 + bubble_ht_offset)), "OB", GlobalColor("OB"));
def off = 1;

#AssignPriceColor(if (inbar and !holygrail) then Color.YELLOW else Color.CURRENT);
#AssignPriceColor(if (outbar and !holygrail) then Color.Blue else Color.CURRENT);

#AddVerticalLine(holygrail, "InBar", Color.ORANGE, Curve.FIRM);

#AddVerticalLine(holygrail[-1], "OUTBar", Color.WHITE, Curve.FIRM);

#AddVerticalLine(holygrail[+1], "HolyGrail", Color.RED, Curve.FIRM);

#########################
#Workaround Cloud between vertical lines using addchart()

def h = Double.POSITIVE_INFINITY;
def l = Double.NEGATIVE_INFINITY;

def xoutbar = if holygrail[-1] and outbar then 1 else 0;
def xinbar = if holygrail and inbar then 1 else 0;
def xboth = if xoutbar == 1
then 1 else
if xboth[1] == 1 and xinbar == 1
then 1 else 0;

input cloud = {default out_holygrail, in_holygrail, out_in, NONE};

def xH = if cloud == cloud.NONE
then Double.NaN else
if cloud == cloud.out_in and xoutbar == 1 or
cloud == cloud.out_holygrail and xboth or
cloud == cloud.in_holygrail and xinbar == 1
then h else Double.NaN;
def xL = if cloud == cloud.NONE
then Double.NaN else
if cloud == cloud.out_in and xoutbar == 1 or
cloud == cloud.out_holygrail and xboth or
cloud == cloud.in_holygrail and xinbar == 1
then l else Double.NaN;

defineGlobalColor("Cloud", color.gray);
AddChart(high = xH, low = xL, open = xH, close = xL, type = ChartType.CANDLE, growColor = globalcolor("Cloud"));

##########################
#Display candles hidden by above workaround
def rh = if cloud == cloud.NONE
then Double.NaN else
if cloud == cloud.out_in and xoutbar == 1 or
cloud == cloud.out_holygrail and xboth or
cloud == cloud.in_holygrail and xinbar == 1
then high else Double.NaN;

def rl = if cloud == cloud.NONE
then Double.NaN else
if cloud == cloud.out_in and xoutbar == 1 or
cloud == cloud.out_holygrail and xboth or
cloud == cloud.in_holygrail and xinbar == 1
then low else Double.NaN;
def rhg = if close >= open then rh else Double.NaN;

#AddChart(high = rhg, low = rl, open = close, close = open, growColor = Color.GREEN, type = ChartType.CANDLE);

#def rhr = if close < open then rh else Double.NaN;
#AddChart(high = rhr, low = rl, open = open, close = close, growColor = Color.RED, type = ChartType.CANDLE);
#####################################################################################
def nirvana = low[1] > low[2] and low < low[1] and high[1] < high[2] and high > high[1];

def xoutbar1 = if Nirvana[-1] and inbar then 1 else 0;
def xinbar1 = if Nirvana and outbar then 1 else 0;
def xboth1 = if xoutbar1 == 1
then 1 else
if xboth1[1] == 1 and xinbar1 == 1
then 1 else 0;

input cloud1 = {default out_Nirvana, in_nirvana, out_in, NONE};

def xHH = if cloud1 == cloud1.NONE
then Double.NaN else
if cloud1 == cloud1.out_in and xinbar1 == 1 or
cloud1 == cloud1.out_Nirvana and xboth1 or
cloud1 == cloud1.in_Nirvana and xoutbar1 == 1
then h else Double.NaN;
def xLL = if cloud == cloud.NONE
then Double.NaN else
if cloud1 == cloud1.out_in and xinbar1 == 1 or
cloud1 == cloud1.out_Nirvana and xboth1 or
cloud1 == cloud1.in_Nirvana and xoutbar1 == 1
then l else Double.NaN;

defineGlobalColor("Cloud1", color.blue);
AddChart(high = xHH, low = xLL, open = xHH, close = xLL, type = ChartType.CANDLE, growColor = globalcolor("Cloud1"));
 
TradingWarz Inside Bar Trading For ThinkOrSwim
Maybe someone can look at it and fix code. It works but not the same as TradingWarz.
Ruby:
#def lastbar = !isnan(close[0]) and isnan(close[-1]);
#def src = close;
#input length = 20;
#input mult = 2.0;
#def mult2 = if mult > 50 then 50 else if mult < 0.001 then 0.001 else mult;


# inside and outside bars
def inBar = low > low[1] and high < high[1];
def outBar = low < low[1] and high > high[1];
def holyGrail = low[1] < low[2] and high[1] > high[2] and low > low[1] and high < high[1];
#def nirvana = low[1] > low[2] and high[1] < high[2] and low < low[1] and high > high[1];


input bubble_ht_offset = 0.0006;
DefineGlobalColor("IB", Color.yellow);
DefineGlobalColor("OB", Color.blue);
addchartbubble(inbar, (high * (1 + bubble_ht_offset)), "IB", GlobalColor("IB"));
addchartbubble(outbar, (high * (1 + bubble_ht_offset)), "OB", GlobalColor("OB"));
def off = 1;

#AssignPriceColor(if (inbar and !holygrail) then Color.YELLOW else Color.CURRENT);
#AssignPriceColor(if (outbar and !holygrail) then Color.Blue else Color.CURRENT);

#AddVerticalLine(holygrail, "InBar", Color.ORANGE, Curve.FIRM);

#AddVerticalLine(holygrail[-1], "OUTBar", Color.WHITE, Curve.FIRM);

#AddVerticalLine(holygrail[+1], "HolyGrail", Color.RED, Curve.FIRM);

#########################
#Workaround Cloud between vertical lines using addchart()

def h = Double.POSITIVE_INFINITY;
def l = Double.NEGATIVE_INFINITY;

def xoutbar = if holygrail[-1] and outbar then 1 else 0;
def xinbar = if holygrail and inbar then 1 else 0;
def xboth = if xoutbar == 1
then 1 else
if xboth[1] == 1 and xinbar == 1
then 1 else 0;

input cloud = {default out_holygrail, in_holygrail, out_in, NONE};

def xH = if cloud == cloud.NONE
then Double.NaN else
if cloud == cloud.out_in and xoutbar == 1 or
cloud == cloud.out_holygrail and xboth or
cloud == cloud.in_holygrail and xinbar == 1
then h else Double.NaN;
def xL = if cloud == cloud.NONE
then Double.NaN else
if cloud == cloud.out_in and xoutbar == 1 or
cloud == cloud.out_holygrail and xboth or
cloud == cloud.in_holygrail and xinbar == 1
then l else Double.NaN;

defineGlobalColor("Cloud", color.gray);
AddChart(high = xH, low = xL, open = xH, close = xL, type = ChartType.CANDLE, growColor = globalcolor("Cloud"));

##########################
#Display candles hidden by above workaround
def rh = if cloud == cloud.NONE
then Double.NaN else
if cloud == cloud.out_in and xoutbar == 1 or
cloud == cloud.out_holygrail and xboth or
cloud == cloud.in_holygrail and xinbar == 1
then high else Double.NaN;

def rl = if cloud == cloud.NONE
then Double.NaN else
if cloud == cloud.out_in and xoutbar == 1 or
cloud == cloud.out_holygrail and xboth or
cloud == cloud.in_holygrail and xinbar == 1
then low else Double.NaN;
def rhg = if close >= open then rh else Double.NaN;

AddChart(high = rhg, low = rl, open = close, close = open, growColor = Color.GREEN, type = ChartType.CANDLE);

def rhr = if close < open then rh else Double.NaN;
AddChart(high = rhr, low = rl, open = open, close = close, growColor = Color.RED, type = ChartType.CANDLE);



This is not my code.
https://usethinkscript.com/threads/add-vertical-cloud.7208/#post-82267
I tweaked it to make the bubbles' opacity adjustable plus the cloud adjustable. I masked some lines that aren't really necessary. Can't figure out how to make the space between bars disappear. Also nirvana is masked since I can't figure out a way to make the cloud a different color. Maybe someone can look at it and fix code. It works but not the same as TradingWarz.
 
Last edited by a moderator:
Why not just join his discord where the indicator I wrote for him is posted for free
Hi, I was wondering if I could turn off/hide the IB and OB bubbles in the script? I really only want the grey verticle lines. sorry for such a fundamental Q but I am not a coder. Thanks.
 
Is there a ThinkScrit indicator for his Nirvana 1-3 candles??? Isn't his link on discord only for Trading View? Thanks.
 
^^^ fixed. Exactly like TradingWarz now

Hi, I had a hard time getting the AddChart function for creating the bars to not cause problems. I changed it to just paint a vertical cloud instead. But I see that you had some selector functions that aren't preserved when I did that. I'm OK with using it as is, but the issue I had is that the gray vertical color stripes were not allowing any candles to show in front of them. Also, the AddChart candles that did appear over the blue stripes didn't allow the upcandle to be an outline instead of filled in (as is default for the candle style in TOS).
 
Last edited:
Hi, I had a hard time getting the AddChart function for creating the bars to not cause problems. I changed it to just paint a vertical cloud instead. But I see that you had some selector functions that aren't preserved when I did that. I'm OK with using it as is, but the issue I had is that the gray vertical color stripes were not allowing any candles to show in front of them. Also, the AddChart candles that did appear over the blue stripes didn't allow the upcandle to be an outline instead of filled in (as is default for the candle style in TOS).
You have to tweak some of the settings. Both of the inputs should say "Out_Nirvana" and "Out_Holygrail." Then change the colors to the ones you want but make sure the transparency is set to 70 or above.

https%3A//i.imgur.com/t4W3NCM.png[/img]']
t4W3NCM.png
 
I still get the empty space between candles in the vertical cloud...can you specify what you fixed please?
Thanks
I noticed the vertical space as well and I don't know if thats fixable. Someone who is good a coding please take a look. I fixed the previous script by adding the nirvana pattern and allowing the user to change the cloud colors for both the Holygrail and Nirvana.
 
I have a script that prints Vertical Lines for the Outside Bar, then the Inside Bar, and then one when it confirms with them Being side by Side. I'm having trouble with the Coding for an Alert, when the Final side-by-side Vertical Line Confirms and Prints. Can someone take a look at it? Thank you
Ruby:
#This is a Free Indicator Created for the @TradingWarz (Twitter) and at TradingWars (on Youtube) Community

#plot Data = close;

input DoPlots = yes;#hint DoPlots: Yes shows MA plots to define crosses. Default is 'YES'

plot inbar = low > low[1] and high < high[1];
plot outbar = low < low[1] and high > high[1];
plot holygrail = outbar[1] and inbar;

#AssignPriceColor(if (inbar and !holygrail) then Color.white else Color.CURRENT);
#AssignPriceColor(if (outbar and !holygrail) then Color.yellow else Color.CURRENT);

AddVerticalLine(holygrail, "InBar", Color.white, Curve.FIRM);
AddVerticalLine(holygrail[-1], "OUTBar", Color.yellow, Curve.FIRM);
AddVerticalLine(holygrail[+1], "HolyGrail", Color.RED, Curve.FIRM);

#plot PriceClose = close;
def PriceHigh = high;
def PriceLow = low;

AddLabel(yes, "HolyGrail Low:" + PriceLow, if holygrail then Color.GREEN else Color.GRAY);
AddLabel(yes, "HolyGrail High:" + PriceHigh, if holygrail then Color.GREEN else Color.GRAY);

def x = (holygrail[1] or holygrail[0] or holygrail[-1] );

def cloudtop = if x then close + 1 else Double.NaN;
def cloudbot = if x then close - 1 else Double.NaN;

AddCloud( cloudtop , cloudbot, Color.WHITE, Color.WHITE);
 
Last edited by a moderator:
I have a script that prints Vertical Lines for the Outside Bar, then the Inside Bar, and then one when it confirms with them Being side by Side. I'm having trouble with the Coding for an Alert, when the Final side-by-side Vertical Line Confirms and Prints. Can someone take a look at it? Thank you
Ruby:
#This is a Free Indicator Created for the @TradingWarz (Twitter) and at TradingWars (on Youtube) Community

#plot Data = close;

input DoPlots = yes;#hint DoPlots: Yes shows MA plots to define crosses. Default is 'YES'

plot inbar = low > low[1] and high < high[1];
plot outbar = low < low[1] and high > high[1];
plot holygrail = outbar[1] and inbar;

#AssignPriceColor(if (inbar and !holygrail) then Color.white else Color.CURRENT);
#AssignPriceColor(if (outbar and !holygrail) then Color.yellow else Color.CURRENT);

AddVerticalLine(holygrail, "InBar", Color.white, Curve.FIRM);
AddVerticalLine(holygrail[-1], "OUTBar", Color.yellow, Curve.FIRM);
AddVerticalLine(holygrail[+1], "HolyGrail", Color.RED, Curve.FIRM);

#plot PriceClose = close;
def PriceHigh = high;
def PriceLow = low;

AddLabel(yes, "HolyGrail Low:" + PriceLow, if holygrail then Color.GREEN else Color.GRAY);
AddLabel(yes, "HolyGrail High:" + PriceHigh, if holygrail then Color.GREEN else Color.GRAY);

def x = (holygrail[1] or holygrail[0] or holygrail[-1] );

def cloudtop = if x then close + 1 else Double.NaN;
def cloudbot = if x then close - 1 else Double.NaN;

AddCloud( cloudtop , cloudbot, Color.WHITE, Color.WHITE);
Your script looks at future bars. This is when a script waits for the future to happen and then goes back in time and paints the vertical line.
As the condition is not happening in real time, you can't get alerts in real time.
Some members have had luck with looking back over the last x bars for the condition.
Read these caveats:
https://usethinkscript.com/threads/answers-to-commonly-asked-questions.6006/#post-78106

Here is the code:
Ruby:
Alert(holygrail[+1] within 2 bars, "Holy Grail", Alert.Bar, Sound.Bell);
 
I have a script that prints Vertical Lines for the Outside Bar, then the Inside Bar, and then one when it confirms with them Being side by Side. I'm having trouble with the Coding for an Alert, when the Final side-by-side Vertical Line Confirms and Prints. Can someone take a look at it? Thank you
Ruby:
#This is a Free Indicator Created for the @TradingWarz (Twitter) and at TradingWars (on Youtube) Community

#plot Data = close;

input DoPlots = yes;#hint DoPlots: Yes shows MA plots to define crosses. Default is 'YES'

plot inbar = low > low[1] and high < high[1];
plot outbar = low < low[1] and high > high[1];
plot holygrail = outbar[1] and inbar;

#AssignPriceColor(if (inbar and !holygrail) then Color.white else Color.CURRENT);
#AssignPriceColor(if (outbar and !holygrail) then Color.yellow else Color.CURRENT);

AddVerticalLine(holygrail, "InBar", Color.white, Curve.FIRM);
AddVerticalLine(holygrail[-1], "OUTBar", Color.yellow, Curve.FIRM);
AddVerticalLine(holygrail[+1], "HolyGrail", Color.RED, Curve.FIRM);

#plot PriceClose = close;
def PriceHigh = high;
def PriceLow = low;

AddLabel(yes, "HolyGrail Low:" + PriceLow, if holygrail then Color.GREEN else Color.GRAY);
AddLabel(yes, "HolyGrail High:" + PriceHigh, if holygrail then Color.GREEN else Color.GRAY);

def x = (holygrail[1] or holygrail[0] or holygrail[-1] );

def cloudtop = if x then close + 1 else Double.NaN;
def cloudbot = if x then close - 1 else Double.NaN;

AddCloud( cloudtop , cloudbot, Color.WHITE, Color.WHITE);

in the future, include a link where the original code came from
https://usethinkscript.com/threads/tradingwarz-holy-grail-nirvana-for-thinkorswim.9642/#post-89470

sometimes it helps to debug , to look at the original
 
I used to follow TW on twitter. The problem is, many influencers who say "buy puts under and calls over..." are sketch.
 
Your script looks at future bars. This is when a script waits for the future to happen and then goes back in time and paints the vertical line.
As the condition is not happening in real time, you can't get alerts in real time.
Some members have had luck with looking back over the last x bars for the condition.
Read these caveats:
https://usethinkscript.com/threads/answers-to-commonly-asked-questions.6006/#post-78106

Here is the code:
Ruby:
Alert(holygrail[+1] within 2 bars, "Holy Grail", Alert.Bar, Sound.Bell);
Thank You!
 

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

Thread starter Similar threads Forum Replies Date
H Chasing The Holy Grail Indicators 57
BenTen Holy Grail ADX Trading Setup for ThinkorSwim Indicators 60

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
358 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