LogoLogo
Back to HaasOnline.comSwitch to Trade Platform
3.x
3.x
  • Welcome
  • Getting Started
    • Using Local API Server
    • Authentication
    • Response
      • Error Codes
  • HaasScript
    • Using HaasScript
      • HaasScript Facts
      • Charting
      • Order Handling
      • Interval
      • Input Fields
      • Positions Handling
        • Fee correction
      • Position Information
      • Memory Management
      • Optimizations
      • Signal Handling
      • Trading
    • Script Editor
      • Syntax
      • Parameters
      • Interaction
    • Visual Editor
      • Blocks
      • Parameters
      • Flow Control
      • Interaction
    • Custom Commands
    • Tutorials
      • Trade Bot Guide
        • Creating A Trade Bot
          • Visual Editor Guide
          • Script Editor Guide
          • Custom Containers
        • Customizing Indicators
        • Customizing Safeties
        • Customizing Insurances
        • Creating Easy Indicators
      • Unmanaged Trading Guide
        • Executing Orders
        • Managing Orders
        • Managing Positions
        • Managing Wallet
      • Script Editor
        • Classes
        • MadHatter BBands
        • Percentage Price Change
      • Visual Editor
        • Importing Scripts
        • SmoothRSI
        • Scalper Bot
    • Commands
      • Array Helpers
      • Charting
      • Constants
      • Custom Commands Helpers
      • Easy Indicators
      • Easy Insurances
      • Easy Safeties
      • Equations
      • Flow Control
      • Input Fields
      • Input Settings
      • Mathematical
      • Memory Helpers
      • Miscellaneous
      • Order Handling
      • Order Information
      • Position Information
      • Position Prices
      • Price Data
      • Price Market Information
      • Profit Information
      • Settings
      • Signal Helpers
      • String Helpers
      • Technical Analysis
      • Technical Analysis Helpers
      • Time Information
      • Trade Actions (Managed)
      • Trade Actions (Unmanaged)
      • Trade Bot
      • Trade Market Information
      • Wallet
  • API Endpoints
    • Software API
    • Market Data API
    • Account Data API
    • Trade Data API
    • Advanced Order API
    • Trade Bot API
    • Custom Trade Bot API
    • ENUMS
    • Data Objects
  • Examples
    • Script Bots (C#)
      • Scalper Trade Bot
      • Flash Crash Trade Bot
    • Script Indicators (C#)
      • Indicator Script
      • Technical Analysis Library
    • Pshai Scripts (C#)
      • BBands Ext
      • BBands Ext v2
      • Chaikin A/D Line
      • Calibrator
      • Pshai's RVI
    • Scripted Driver
  • Other Resources
    • YouTube
    • Guides & Tutorials
    • Questions & Answers
    • Community Projects
  • Need Help?
    • Ask on Discord
    • Submit Support Ticket
Powered by GitBook
On this page
  • HaasScript Charting Rules
  • Plotting A Line
  • LineOptions
  • Manipulating Single Line
  • Manipulating Multiple Lines
  • Double Axis
  • Double Price Plot

Was this helpful?

  1. HaasScript
  2. Using HaasScript

Charting

PreviousHaasScript FactsNextOrder Handling

Last updated 5 years ago

Was this helpful?

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)

LineOptions

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())
PlotCircle(l)

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)
Charting
Constants
Charting