Larry William's 9.1 / 9.2 / 9.3 for ThinkOrSwim

jygoli

Member
Author states:
This indicator helps to map the first reference candles for the setups for Larry William's: 9.1 9.2 and 9.1.

mapping strategy:
1) At first, we test if the ema 9 is up or down
if it is Up the background is painted yellow and you can find the reference candles for the setups
if it is down the background is Gray and you can find the reference candles for the setups

2) Then we compare the close, highs and lows if the candle match some of the setup rules, and if match we plot a sign in the reference candle with the name of respective setup, now you can decide in the next candle if it is eligible for an entry SHORT/LONG position.

uudZwVR.png


Can someone please convert the Trading view script to TOS?
https://www.tradingview.com/v/smzGFJb7/
 
Last edited by a moderator:

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

Can someone please convert the Trading view script to TOS?
https://www.tradingview.com/v/smzGFJb7/
check the below:

CSS:
#https://www.tradingview.com/v/smzGFJb7/
#//@AlbertoDrunen
#study("Mapping 9.1 / 9.2 / 9.3 (v2.1)", overlay=true)
# Converted by Sam4Cok@Samer800    - 03/2024

def na = Double.NaN;
def pos = Double.POSITIVE_INFINITY;
def neg = Double.NEGATIVE_INFINITY;
#//Exponential average calc & plot:
def mm9exp = ExpAverage(close,9);
plot ema9 = (mm9exp);
ema9.SetDefaultColor(Color.WHITE);
#// seting the background to show the possible area of interest => growing ema9
def growing = mm9exp >= mm9exp[1];
AddCloud(if growing then pos else na, neg, CreateColor(52, 52,52));

#// now lets find 9.1
def changtogrow = growing and !growing[1];
def trig91Up = if changtogrow and (close >  mm9exp ) then 9.1 else 0;
def changtodown = !growing and growing[1];
def trig91Dn = if changtodown and (close <  mm9exp ) then 9.1 else 0;

plot trig91P = if trig91Up then trig91Up else na;
plot trig91N = if trig91Dn then trig91Dn else na;

trig91P.SetPaintingStrategy(PaintingStrategy.VALUES_ABOVE);
trig91P.SetDefaultColor(Color.DARK_GREEN);
trig91N.SetPaintingStrategy(PaintingStrategy.VALUES_BELOW);
trig91N.SetDefaultColor(Color.DARK_RED);

#// Find a 9.2 reference start candle
def trig92Up = if growing then (if close < low[1] then 9.2 else 0) else 0;
def trig92Dn = if !growing then (if close > high[1] then 9.2 else 0) else 0;

plot trg92P = if trig92Up then trig92Up else na;
plot trg92N = if trig92Dn then trig92Dn else na;

trg92P.SetPaintingStrategy(PaintingStrategy.VALUES_ABOVE);
trg92P.SetDefaultColor(Color.GREEN);
trg92N.SetPaintingStrategy(PaintingStrategy.VALUES_BELOW);
trg92N.SetDefaultColor(Color.RED);

#// find a 9.3 referenc candle
def c0 = close;
def c1 = close[1];
def cMax = close[2];
def cMin1 = low[2];
def cMinDown = close[2];
def cMaxDown = high[2];

def trig93Up = if growing then ( if (c1 > cMin1) and ( c1 < cMax) and ( c0 < cMax ) then 9.3 else 0) else 0;
def trig93Dn = if !growing then (if (c1 < cMaxDown) and ( c1 > cMinDown)  and ( c0 > cMinDown ) then 9.3 else 0) else 0;

plot trig93P = if trig93Up then trig93Up else na;
plot trig93N = if trig93Dn then trig93Dn else na;

trig93P.SetPaintingStrategy(PaintingStrategy.VALUES_ABOVE);
trig93P.SetDefaultColor(Color.CYAN);
trig93N.SetPaintingStrategy(PaintingStrategy.VALUES_BELOW);
trig93N.SetDefaultColor(Color.MAGENTA);



#-- END of CODE
 
Background is not painting yellow. My chart is Grey = up, White is down

Yes, that is correct.
In @samer800's ToS version of this indicator, the code:
def growing = mm9exp >= mm9exp[1];
AddCloud(if growing then pos else na, neg, CreateColor(52, 52,52)); #gray
will paint the background gray when the current bar 9ema is greater than the previous bar 9ema
 
Last edited:
check the below:

CSS:
#https://www.tradingview.com/v/smzGFJb7/
#//@AlbertoDrunen
#study("Mapping 9.1 / 9.2 / 9.3 (v2.1)", overlay=true)
# Converted by Sam4Cok@Samer800    - 03/2024

def na = Double.NaN;
def pos = Double.POSITIVE_INFINITY;
def neg = Double.NEGATIVE_INFINITY;
#//Exponential average calc & plot:
def mm9exp = ExpAverage(close,9);
plot ema9 = (mm9exp);
ema9.SetDefaultColor(Color.WHITE);
#// seting the background to show the possible area of interest => growing ema9
def growing = mm9exp >= mm9exp[1];
AddCloud(if growing then pos else na, neg, CreateColor(52, 52,52));

#// now lets find 9.1
def changtogrow = growing and !growing[1];
def trig91Up = if changtogrow and (close >  mm9exp ) then 9.1 else 0;
def changtodown = !growing and growing[1];
def trig91Dn = if changtodown and (close <  mm9exp ) then 9.1 else 0;

plot trig91P = if trig91Up then trig91Up else na;
plot trig91N = if trig91Dn then trig91Dn else na;

trig91P.SetPaintingStrategy(PaintingStrategy.VALUES_ABOVE);
trig91P.SetDefaultColor(Color.DARK_GREEN);
trig91N.SetPaintingStrategy(PaintingStrategy.VALUES_BELOW);
trig91N.SetDefaultColor(Color.DARK_RED);

#// Find a 9.2 reference start candle
def trig92Up = if growing then (if close < low[1] then 9.2 else 0) else 0;
def trig92Dn = if !growing then (if close > high[1] then 9.2 else 0) else 0;

plot trg92P = if trig92Up then trig92Up else na;
plot trg92N = if trig92Dn then trig92Dn else na;

trg92P.SetPaintingStrategy(PaintingStrategy.VALUES_ABOVE);
trg92P.SetDefaultColor(Color.GREEN);
trg92N.SetPaintingStrategy(PaintingStrategy.VALUES_BELOW);
trg92N.SetDefaultColor(Color.RED);

#// find a 9.3 referenc candle
def c0 = close;
def c1 = close[1];
def cMax = close[2];
def cMin1 = low[2];
def cMinDown = close[2];
def cMaxDown = high[2];

def trig93Up = if growing then ( if (c1 > cMin1) and ( c1 < cMax) and ( c0 < cMax ) then 9.3 else 0) else 0;
def trig93Dn = if !growing then (if (c1 < cMaxDown) and ( c1 > cMinDown)  and ( c0 > cMinDown ) then 9.3 else 0) else 0;

plot trig93P = if trig93Up then trig93Up else na;
plot trig93N = if trig93Dn then trig93Dn else na;

trig93P.SetPaintingStrategy(PaintingStrategy.VALUES_ABOVE);
trig93P.SetDefaultColor(Color.CYAN);
trig93N.SetPaintingStrategy(PaintingStrategy.VALUES_BELOW);
trig93N.SetDefaultColor(Color.MAGENTA);



#-- END of CODE
Hey @samer800, thanks for this script! I love it!
I was able to make the background green when EMA is going up. I was trying to make it plot a red background when EMA is going down, Flat Ema can you make it brackground white?, I couldn't do it. If it's not too much to ask, could you help me with that? Also, is it possible to make it MTF?


Thanks !!!
 
Last edited:

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

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