Charting
Last updated
Last updated
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.
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.
Index -1 is reserved for the default signal bar. No lines can be created on this chart, no styling is allowed.
Every index can have 1 candlestick chart and unlimited data lines.
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.
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.
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.
If multiple lines are combined, other plot styles are possible. For example:
Bands (PlotBands)
Cloud (PlotCloud)
Stacked Area (PlotStackedArea)
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.
Besides plotting a line on the left axis, we could also create a second candlestick chart and divide the screen in half.