HaasScript gives you full control over the chart and what will be drawn on it. Anything from text color to candlestick style, from lines to histograms, and from chart annotations to axis labels. Everything is available.

HaasScript Charting Rules

  1. The charts work with an index. Index 0 is the main plot. A positive index will be positioned below the main plot and a negative index above.

  2. Index -1 is reserved for the default signal bar. No lines can be created on this chart, no styling is allowed.

  3. Every index can have 1 candlestick chart and unlimited data lines.

Plotting A Line

Creating a line on the chart requires 3 things. The chart index, line name and value. The 4th parameter is optional and can be a color or a options object.

Plot(1, 'BTCUSD', ClosePrices(), SkyBlue)


With the LineOptions command we have access to all the line properties. We can specify;

  • Line color

  • Line style

  • Line decoration

  • Line width

  • Line offset

  • Axis side

  • Line id

  • Behind or on top of the candles

The LineOptions() will returns the options object which can be used as the 4th parameter or you can define it manually.

Plot(1, 'BTCUSD', ClosePrices(), {style=Smooth, color=Yellow)
Plot(1, 'BTCUSD', ClosePrices(), LineOptions(Yellow, Smooth))

Manipulating Single Line

A single line can be changed to a variaty of different plot styles. This includes;

  • Circles (PlotCircle)

  • Bars (PlotBars)

  • Histogram (PlotHistogram)

  • Double color (PlotDoubleColor)

Changing a line to one of the plot styles requires the return value of Plot(). If this value is used for, for example, PlotCircle, the line will change to circles.

l = Plot(1, 'BTCUSD', ClosePrices())

Manipulating Multiple Lines

If multiple lines are combined, other plot styles are possible. For example:

  • Bands (PlotBands)

  • Cloud (PlotCloud)

  • Stacked Area (PlotStackedArea)

bbands = BBANDS(ClosePrices(), 12, 2.4, 2.4, SmaType)
l1 = Plot(0, 'Upper', bbands.upper)
l2 = Plot(0, 'Lower', bbands.lower)
PlotBands(l1, l2, SkyBlue(10))

Double Axis

HaasScript is not limited to a single axis. With the side options for the lines, you can control on which axis the line should snap. The left and right axis don't have to be in the same range. This is perfect, for example, to create a market compare chart with multiple markets.

eth = ClosePrices({market = 'BINANCE_ETH_USDT_'})
Plot(0, 'Binance ETHUSD', eth[1], {side=LeftAxis})

Double Price Plot

Besides plotting a line on the left axis, we could also create a second candlestick chart and divide the screen in half.

PlotPrice(1, 'BINANCE_ETH_USDT_')
ChartSetOptions(1, "Binance ETH/USD", 0.5)

Last updated