# Limiting Plots In ThinkOrSwim

#### Pensar

##### Expert
VIP
Here are a few examples of how to show or hide sections of plots in ThinkScript, mainly using IsNaN(). There are other ways to limit plots, of course, but these are the basic methods I usually use. Anyone else, please feel free to post additional ways.

Plotting only on a single price bar -
Code:
``````plot a = !isnan(close[-5]) and isnan(close[-6]);
a.setpaintingstrategy(paintingstrategy.boolean_arrow_up);
a.setdefaultcolor(color.cyan);``````

Plotting only in a certain defined area -
Code:
``````plot b = !isnan(close[-11]) and isnan(close[-17]);
b.setpaintingstrategy(paintingstrategy.boolean_arrow_up);
b.setdefaultcolor(color.cyan);``````

Plotting from a defined point and continuing left -
Code:
``````plot c = !isnan(close[-20]);
c.setpaintingstrategy(paintingstrategy.boolean_arrow_up);
c.setdefaultcolor(color.cyan);``````

Plotting from a defined point and continuing right -
Code:
``````plot d = isnan(close[-50]);
d.setpaintingstrategy(paintingstrategy.boolean_arrow_up);
d.setdefaultcolor(color.cyan);``````

Plotting a certain distance into the expansion area -
Code:
``````input plot_line_here = 55;
input length_of_line = 5;
def x = !isnan(close) && isnan(close[-1]);
plot e = if isnan(close) and barnumber() <= HighestAll(if x then barnumber() + length_of_line else double.nan) then plot_line_here else double.nan;
e.setpaintingstrategy(paintingstrategy.horizontal);
e.setdefaultcolor(color.cyan);``````

Hope this helps!

Any chance you're able to do this with an entry price? currently it shows each plot the entire time i'm in the trade and it would be awesome if it would just plot it on the one candle where I entered.

Currently the code just looks like this, but i can't understand how to modify it with my lack of coding skills lol

plot openCost = GetAveragePrice();

Thank you so much!!

87k+ Posts
442 Online

## The Market Trading Game Changer

Join 2,500+ subscribers inside the useThinkScript VIP Membership Club
• Exclusive indicators
• Proven strategies & setups
• Private Discord community
• Exclusive members-only content
• 1 full year of unlimited support

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?