Help drawing straight lines automatically For ThinkOrSwim

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

So are you using the new 3/15/1HR script to draw your zones? And leaving the new general script on all the time on your timeframe ?
I would love to code the bounce because that is exactly what i m having difficulty figuring out lol I am in process of figuring out how to spot a "real" bounce vs fake outs but no luck so far. @Kaydee can educate us as to what he/she considers a potential bounce move.


To answer your second question, i have made little changes to my process. Now i use 15min, 1hour and 4hour codes and use the time frame of 5 day 1 min because that shows some zones that otherwise would not have been plotted in 2day 1 min or 1 day 1min.

TSLA today:

AU5mBxa.png



NVDA Today:

i2Hcu1d.png
 
Just incase if you want to use the 4 Hour aggregation just change the 15 min code to
Code:
aggregationPeriod.Four_hours;
or whatever time frame you want just change that in the code and rest will update automatically.

change this line:

Code:
def agg = aggregationPeriod.FIFTEEN_MIN;
 
I would love to code the bounce because that is exactly what i m having difficulty figuring out lol I am in process of figuring out how to spot a "real" bounce vs fake outs but no luck so far. @Kaydee can educate us as to what he/she considers a potential bounce move.


To answer your second question, i have made little changes to my process. Now i use 15min, 1hour and 4hour codes and use the time frame of 5 day 1 min because that shows some zones that otherwise would not have been plotted in 2day 1 min or 1 day 1min.

TSLA today:

AU5mBxa.png



NVDA Today:

i2Hcu1d.png
Mind posting the code for 4 hour?
I have the code for 15/1HR.

There is a study for Vwap bounce, not sure if that can help in anyways

https://usethinkscript.com/threads/vwap-retest-indicator-for-thinkorswim.5214/post-51451

Possible other suggestions:

To save you from drawing zone manually, may you could color the cloud as follows:
15 mins zone=grey
1hour zone = green
4hour zone = red

Or whatever color combo might be visible on the eyes and chart.
 
Mind posting the code for 4 hour?
I have the code for 15/1HR.

There is a study for Vwap bounce, not sure if that can help in anyways

https://usethinkscript.com/threads/vwap-retest-indicator-for-thinkorswim.5214/post-51451

Possible other suggestions:

To save you from drawing zone manually, may you could color the cloud as follows:
15 mins zone=grey
1hour zone = green
4hour zone = red

Or whatever color combo might be visible on the eyes and chart.

We think alike, i changed the colors a couple of days ago lol Just change "addcloud" to change colors of your liking.

15 Min: Cyan and Pink:
Code:
#Engulfing Sup/Dem 15 min
#
# TD Ameritrade IP Company, Inc. (c) 2011-2020
#
#wizard plots
#wizard text: Inputs: length:
#wizard input: length
#wizard text: trend setup:
#wizard input: trendSetup

input length = 20;
input trendSetup = 3;

def agg = aggregationPeriod.FIFTEEN_MIN;

def open = open(period = agg);
def high = high(period = agg);
def low = low(period = agg);
def close = close(period = agg);

def nan = Double.NaN;
def BodyMax = Max(open, close);
def BodyMin = Min(open, close);
def IsEngulfing = BodyMax > BodyMax[1] and
    BodyMin < BodyMin[1];
def IsWhite = open < close;
def IsBlack = open > close;
def IsPrevDoji = IsDoji(length)[1];

plot Bearish = IsAscending(close, trendSetup)[1] and
    (IsWhite[1] or IsPrevDoji) and
    IsBlack and
    IsEngulfing;

plot Bullish = IsDescending(close, trendSetup)[1] and
    (IsBlack[1] or IsPrevDoji) and
    IsWhite and
    IsEngulfing;

Bearish.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);
Bearish.SetDefaultColor(GetColor(1));
Bearish.SetLineWeight(2);
Bullish.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
Bullish.SetDefaultColor(GetColor(2));
Bullish.SetLineWeight(2);

def bu_high = if bullish then high[1] else bu_high[1];
def bu_low = if bullish then close[1] else bu_low[1];
def be_high = if bearish then high[1] else be_high[1];
def be_low = if bearish then open[1] else be_low[1];

def buhh = if IsNaN(close()) then buhh[1] else bu_high;
def bull = if IsNaN(close()) then bull[1] else bu_low;
def behh = if IsNaN(close()) then behh[1] else be_high;
def bell = if IsNaN(close()) then bell[1] else be_low;

plot bu_hh = buhh;
plot bu_ll = bull;
plot be_hh = behh;
plot be_ll = bell;

bu_hh.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
bu_ll.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
bu_hh.SetDefaultColor(Color.cyan);
bu_ll.SetDefaultColor(Color.cyan);
be_hh.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
be_ll.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
be_hh.SetDefaultColor(Color.pink);
be_ll.SetDefaultColor(Color.pink);


AddCloud(bu_hh, bu_ll, Color.cyan, Color.cyan);
AddCloud(be_hh,Be_ll, Color.pink, Color.PINK);

1HR: Yellow and Red

Code:
#Engulfing Sup/Dem 1hr
#
# TD Ameritrade IP Company, Inc. (c) 2011-2020
#
#wizard plots
#wizard text: Inputs: length:
#wizard input: length
#wizard text: trend setup:
#wizard input: trendSetup

input length = 20;
input trendSetup = 3;

def agg = aggregationPeriod.hour;

def open = open(period = agg);
def high = high(period = agg);
def low = low(period = agg);
def close = close(period = agg);

def nan = Double.NaN;
def BodyMax = Max(open, close);
def BodyMin = Min(open, close);
def IsEngulfing = BodyMax > BodyMax[1] and
    BodyMin < BodyMin[1];
def IsWhite = open < close;
def IsBlack = open > close;
def IsPrevDoji = IsDoji(length)[1];

plot Bearish = IsAscending(close, trendSetup)[1] and
    (IsWhite[1] or IsPrevDoji) and
    IsBlack and
    IsEngulfing;

plot Bullish = IsDescending(close, trendSetup)[1] and
    (IsBlack[1] or IsPrevDoji) and
    IsWhite and
    IsEngulfing;

Bearish.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);
Bearish.SetDefaultColor(GetColor(1));
Bearish.SetLineWeight(2);
Bullish.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
Bullish.SetDefaultColor(GetColor(2));
Bullish.SetLineWeight(2);

def bu_high = if bullish then high[1] else bu_high[1];
def bu_low = if bullish then close[1] else bu_low[1];
def be_high = if bearish then high[1] else be_high[1];
def be_low = if bearish then open[1] else be_low[1];

def buhh = if IsNaN(close()) then buhh[1] else bu_high;
def bull = if IsNaN(close()) then bull[1] else bu_low;
def behh = if IsNaN(close()) then behh[1] else be_high;
def bell = if IsNaN(close()) then bell[1] else be_low;

plot bu_hh = buhh;
plot bu_ll = bull;
plot be_hh = behh;
plot be_ll = bell;

bu_hh.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
bu_ll.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
bu_hh.SetDefaultColor(Color.yellow);
bu_ll.SetDefaultColor(Color.yellow);
be_hh.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
be_ll.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
be_hh.SetDefaultColor(Color.red);
be_ll.SetDefaultColor(Color.red);


AddCloud(bu_hh, bu_ll, Color.yellow, Color.yellow);
AddCloud(be_hh,Be_ll, Color.red, Color.red);

4HR: Orange and Blue

Code:
#Engulfing Sup/Dem 4hr
#
# TD Ameritrade IP Company, Inc. (c) 2011-2020
#
#wizard plots
#wizard text: Inputs: length:
#wizard input: length
#wizard text: trend setup:
#wizard input: trendSetup

input length = 20;
input trendSetup = 3;

def agg = aggregationPeriod.Four_hours;

def open = open(period = agg);
def high = high(period = agg);
def low = low(period = agg);
def close = close(period = agg);

def nan = Double.NaN;
def BodyMax = Max(open, close);
def BodyMin = Min(open, close);
def IsEngulfing = BodyMax > BodyMax[1] and
    BodyMin < BodyMin[1];
def IsWhite = open < close;
def IsBlack = open > close;
def IsPrevDoji = IsDoji(length)[1];

plot Bearish = IsAscending(close, trendSetup)[1] and
    (IsWhite[1] or IsPrevDoji) and
    IsBlack and
    IsEngulfing;

plot Bullish = IsDescending(close, trendSetup)[1] and
    (IsBlack[1] or IsPrevDoji) and
    IsWhite and
    IsEngulfing;

Bearish.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);
Bearish.SetDefaultColor(GetColor(1));
Bearish.SetLineWeight(2);
Bullish.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
Bullish.SetDefaultColor(GetColor(2));
Bullish.SetLineWeight(2);

def bu_high = if bullish then high[1] else bu_high[1];
def bu_low = if bullish then close[1] else bu_low[1];
def be_high = if bearish then high[1] else be_high[1];
def be_low = if bearish then open[1] else be_low[1];

def buhh = if IsNaN(close()) then buhh[1] else bu_high;
def bull = if IsNaN(close()) then bull[1] else bu_low;
def behh = if IsNaN(close()) then behh[1] else be_high;
def bell = if IsNaN(close()) then bell[1] else be_low;

plot bu_hh = buhh;
plot bu_ll = bull;
plot be_hh = behh;
plot be_ll = bell;

bu_hh.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
bu_ll.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
bu_hh.SetDefaultColor(Color.orange);
bu_ll.SetDefaultColor(Color.orange);
be_hh.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
be_ll.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
be_hh.SetDefaultColor(Color.blue);
be_ll.SetDefaultColor(Color.blue);


AddCloud(bu_hh, bu_ll, Color.orange, Color.orange);
AddCloud(be_hh,Be_ll, Color.blue, Color.blue);
 
Hello, is there a final version of "Demand Supply Zone" Indicator that plots relatively accurate? Please can you post here with a picture?
Thanks
So the post #87 above is the most recent code I have and as far as pictures goes I don’t have access to my computer till this coming weekend so once I’m back I can share pictures.
 
I would love to code the bounce because that is exactly what i m having difficulty figuring out lol I am in process of figuring out how to spot a "real" bounce vs fake outs but no luck so far. @Kaydee can educate us as to what he/she considers a potential bounce move.


To answer your second question, i have made little changes to my process. Now i use 15min, 1hour and 4hour codes and use the time frame of 5 day 1 min because that shows some zones that otherwise would not have been plotted in 2day 1 min or 1 day 1min.

TSLA today:

AU5mBxa.png



NVDA Today:

i2Hcu1d.png
sorry been busy guys trying to catch up on this tread. I haven't tried the new script you updated will do shortly. One thing I want to remind you of is don't use any supply & Demand zones lower than 30 mins. The higher the time frame the better the move. Always start on a weekly chart down to 30 min. I would say the only time you can draw a supply & Demand zone on a 15 min chart when trading intraday for quick scalps. I never enter a trade until it hits one of my zones and with better confirmation does the bounce see highlighted oval with arrow. look how it entered the 4 hour zone I had drawn on /ES today 7/16 look at it on a 1 & 5 min you can see consolidation move to a 1 minute for entry only. You can see tons of fake outs on 1 min my solid confirmation to go long after the touch of the zone back test is the candle closing above the 9 ema. But volume means a lot with this setup too

http://tos.mx/bufwEcl
 
sorry been busy guys trying to catch up on this tread. I haven't tried the new script you updated will do shortly. One thing I want to remind you of is don't use any supply & Demand zones lower than 30 mins. The higher the time frame the better the move. Always start on a weekly chart down to 30 min. I would say the only time you can draw a supply & Demand zone on a 15 min chart when trading intraday for quick scalps. I never enter a trade until it hits one of my zones and with better confirmation does the bounce see highlighted oval with arrow. look how it entered the 4 hour zone I had drawn on /ES today 7/16 look at it on a 1 & 5 min you can see consolidation move to a 1 minute for entry only. You can see tons of fake outs on 1 min my solid confirmation to go long after the touch of the zone back test is the candle closing above the 9 ema. But volume means a lot with this setup too

http://tos.mx/bufwEcl
This is very very helpful thank you! I have noticed the larger time frame do give me good strong zones however, do u trade equities mainly large cap stocks or do you mainly trade futures? I m trying to see which one this indicator/style of trading works the best for
 
I think we may need like steps on what time frames to draw supply/demand zones...

Like start from 4 hrs, then 1hr, then 30 mins, then 15 mins..

After we draw the zone, how do we look for entries if we are scalping etc.
 
I think we may need like steps on what time frames to draw supply/demand zones...

Like start from 4 hrs, then 1hr, then 30 mins, then 15 mins..

After we draw the zone, how do we look for entries if we are scalping etc.
start from weekly, daily, 4 hour, 3 hour, 2hour , 90 min, 1 hour, 45 min 30, min. if your trading a certain stock you don't have to keep checking the weekly every day
 

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

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