thinkScript painting strategy
PaintingStrategy.HORIZONTAL
PaintingStrategy.HORIZONTAL draws a plot as long horizontal segments instead of a connected line. Use it with SetPaintingStrategy to display fixed price levels, Point of Control, or Value Area boundaries on a thinkorswim chart.
plot Level = levelPrice;
Level.SetPaintingStrategy(
PaintingStrategy.HORIZONTAL);
Level.SetDefaultColor(Color.CYAN);- Constant
- PaintingStrategy.HORIZONTAL
- Applied with
- SetPaintingStrategy function
- Draws
- Horizontal segments at plot value
Direct answer
What PaintingStrategy.HORIZONTAL does
By default, a plot draws as a connected line between bars. PaintingStrategy.HORIZONTAL changes that to long horizontal segments. Adjacent bars with equal values form a continuous horizontal line; changing levels need not form a connected staircase.
The thinkorswim Learning Center notes that this painting strategy is used by profile studies to draw Point of Control, Value Area High, Value Area Low, Profile High, and Profile Low. You can also use it in custom studies to mark fixed price levels or session reference prices.
Complete source
Horizontal level study code
This study plots a configurable price level as horizontal segments. The label shows the level value and turns green when close is at or above it.
input levelPrice = 100;
plot Level = if IsNaN(close) then Double.NaN else levelPrice;
Level.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
Level.SetDefaultColor(Color.CYAN);
Level.SetLineWeight(2);
AddLabel(yes, "Level: " + AsText(levelPrice),
if close >= levelPrice then Color.GREEN else Color.RED);Double.NaN for bars where the level should not appear. The painting strategy draws no segment when the plot value is NaN.Choosing a painting strategy
HORIZONTAL vs. default line
The default painting strategy connects plot values with a broken line. HORIZONTAL replaces that with flat segments. Pick the one that matches the data: continuous series use lines, fixed or step-wise values use horizontal segments.
| Dimension | PaintingStrategy.HORIZONTAL | Default line |
|---|---|---|
| Visual shape | Long horizontal segments at a fixed value | Connected points forming a broken line |
| Best for | Fixed price levels, POC, Value Area High and Low | Continuous data series like moving averages |
| When value is NaN | No segment is drawn for that bar | The line breaks at the gap |
| Profile studies | Used by TPOProfile, VolumeProfile, MonkeyBars | Choose according to the intended plot; not a profile calculation |
Platform steps
Add the study to thinkorswim
- 1
Open the thinkorswim desktop Charts tab, then choose Studies and Edit Studies.
- 2
Click Create, remove the default plot, and paste the complete source from this page.
- 3
Let the thinkScript Editor parse the source. Review any messages before saving the study.
- 4
Add the study to a chart and adjust the levelPrice input to match the price level you want to mark.
Primary sources
Official thinkScript references used here
- PaintingStrategy.HORIZONTALOfficial constant reference for the horizontal painting strategy.
- SetPaintingStrategyFunction that applies a painting strategy to a plot.
- PaintingStrategy constantsFull list of available painting strategy constants.
- Formatting Output: Part ITutorial chapter on SetPaintingStrategy and visual output.
Frequently asked questions
What does PaintingStrategy.HORIZONTAL do in thinkScript?
It tells thinkorswim to draw a plot as long horizontal segments rather than a connected line. Adjacent bars with the same value form a continuous horizontal line. A changing value does not promise a vertically connected staircase.
How do I apply PaintingStrategy.HORIZONTAL to a plot?
Call SetPaintingStrategy on the plot name and pass PaintingStrategy.HORIZONTAL as the argument. For example, Level.SetPaintingStrategy(PaintingStrategy.HORIZONTAL) changes the Level plot to horizontal segments.
Which thinkorswim studies use PaintingStrategy.HORIZONTAL?
Profile studies such as TPOProfile, VolumeProfile, and MonkeyBars use it to draw Point of Control, Value Area High, Value Area Low, Profile High, and Profile Low plots as horizontal lines.
Can I use PaintingStrategy.HORIZONTAL with a dynamic value?
Yes, but the visual changes whenever the plot value changes. It works best for values that stay constant for stretches of bars, such as fixed price levels or session-based reference prices.
What happens when the plot value is Double.NaN?
No horizontal segment is drawn for bars where the plot returns Double.NaN. This lets you conditionally show or hide the level by returning NaN for bars where it should not appear.
Can Pineify generate a study with PaintingStrategy.HORIZONTAL?
Yes. Describe the level, condition, and visual style in plain English. The Pineify thinkorswim AI Coding Agent can draft the source. Check the chosen constant and review it in the thinkScript Editor; Pineify does not execute the script to verify chart appearance.
Build custom painting strategies with AI
Describe the level, condition, and visual style you need. The Pineify thinkorswim AI Coding Agent can draft the source. Review the painting constant and test its appearance in thinkorswim; generation does not verify the chart output.
This page is for educational and informational purposes. It does not provide investment advice, predict future prices, or guarantee trading results.