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.

HorizontalLevelStudyexcerpt
plot Level = levelPrice;
Level.SetPaintingStrategy(
    PaintingStrategy.HORIZONTAL);
Level.SetDefaultColor(Color.CYAN);
fixed level
horizontal segments
cyan line
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. Each segment sits at the plot value for its bar, producing a stepped visual when the value changes between bars.

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.

HorizontalLevelStudy
Review in the thinkScript Editor
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);
Return 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.

DimensionPaintingStrategy.HORIZONTALDefault line
Visual shapeLong horizontal segments at a fixed valueConnected points forming a broken line
Best forFixed price levels, POC, Value Area High and LowContinuous data series like moving averages
When value is NaNNo segment is drawn for that barThe line breaks at the gap
Profile studiesUsed by TPOProfile, VolumeProfile, MonkeyBarsNot used by profile studies

Platform steps

Add the study to thinkorswim

  1. 1

    Open the thinkorswim desktop Charts tab, then choose Studies and Edit Studies.

  2. 2

    Click Create, remove the default plot, and paste the complete source from this page.

  3. 3

    Let the thinkScript Editor parse the source. Review any messages before saving the study.

  4. 4

    Add the study to a chart and adjust the levelPrice input to match the price level you want to mark.

Frequently asked questions

Build custom painting strategies with AI

Describe the level, condition, and visual style you need. The Pineify thinkorswim AI Coding Agent generates a complete thinkScript file with the correct PaintingStrategy constant. Review the source, then test it in the thinkScript Editor.

Open the thinkScript AI agent

This page is for educational and informational purposes. It does not provide investment advice, predict future prices, or guarantee trading results.