LogoLogo
Back to HaasOnline.comSwitch to Developer API
4.x
4.x
  • Welcome
  • TradeServer Cloud
    • Overview
    • Security
    • Troubleshooting
  • TradeServer Enterprise
    • Overview
    • Updates
    • Security
    • Installation
      • Windows
      • MacOS
      • Linux
    • Configuration
      • License Key
      • Login credentials
      • Hosting
        • Linux VPS Hosting
    • Special features
      • Price history
      • Backups
      • Machine Learning
        • Built-in Machine Learning
        • Custom Machine Learning
      • Scripted Exchange API (Coming Soon)
      • Local API (Coming Soon)
    • Troubleshooting
  • Interface
    • General Interface
      • Left Menu
      • Upper Right Items
        • Account data
        • Execute trade
        • AI Chatbots
          • Chatbot Julia
          • Chatbot David
          • Chatbot Thomas
        • Notifications
        • Menu
          • Exchange accounts
          • Settings
          • License information
          • Change Logs
          • Logout
      • Status bar
        • Price tickers
    • Dashboard
    • Bots
      • Bot management
      • Bot templates
    • HaasScript
      • Web Editor
      • Backtest Lab
        • Lab test setup
      • Backtest History
      • Manage Scripts
      • Manage Signals
    • Tools
      • Marketview
      • Market intelligence
      • Exchange profiler
      • Markets explorer
      • News
    • Finance
      • Portfolio
      • External Wallet
  • Haasscript
    • About
      • Change Log
    • Tutorials
      • Bot building
        • Trade-bot building
        • Visual bot building
        • Scripted bot building
      • Usage
        • HaasScript
          • Interval
          • Markets
          • Input Fields
          • Memory Management
          • Signal Handling
          • Position Information
          • Positions Handling
            • Fee correction
          • Order Handling
          • Trading
          • Charting
          • Optimizations
        • Visual Editor
          • Blocks
          • Parameters
          • Flow Control
          • Interaction
        • Script Editor
          • Classes
        • Managed Trading
        • Unmanaged Trading
    • Commands
      • Trade Bots
        • TradeBot Containers
        • Easy Indicators
        • Easy Safeties
        • Easy Insurances
      • Helpers
        • Array Helpers
        • Custom Command Helpers
        • Enumerations
        • Equations
        • Mathematical
        • Memory Helpers
        • Signal Helpers
        • String Helpers
        • Miscellaneous
        • Technical Analysis Helpers
      • Input data
        • Bot Settings
        • Input fields
        • Price Market Information
        • Script Settings
        • Time Information
        • Trade Market Information
      • Prices
      • Technical Analysis
      • Charting
      • Trading
        • Managed Trade Commands
        • Unmanaged Trade Commands
        • Order Information
        • Order Handeling
        • Position Information
        • Position Price Information
        • Profit Information
        • Wallet Information
      • Social Media
    • Built-in Bots
      • Version 3 bots
        • C# Scripted Bot
        • Email bot
        • Trendline Bot
        • Triangle Arbitrage Bot
      • Accumulation Bot
      • Enhanced RSI bot
      • FlashCrash (Grid) Bot
      • Crypto Index Bot
      • Intellibot Alice
      • Inter Exchange Arbitrage Bot
      • MadHatter Bot
      • Market Making Bot
      • Order Bot
      • PingPong Bot
      • Scalper bot
      • Zone-Recovery Bot
    • Community Bots
      • Simple Grid Bot (SPOT)
      • Simple Grid Bot (FUTURES)
      • Simple Market Maker (SPOT)
      • Simple Market Maker (FUTURES)
  • Usage
    • First Usage
    • Setup Exchange
      • Adding an API to the Platform
      • Binance
      • Binance US
      • Bit2me
      • Bitfinex
      • Bitget
      • BitMEX
      • ❌Bitpanda
      • Bitstamp
      • ❌Bittrex
      • Bybit
      • ❌Cex.IO (Legacy API)
      • ❌Coinbase
      • ❌Crypto.com
      • Deribit
      • Gemini
      • Gleec
      • ❌HitBTC
      • Huobi
      • ❌Ionomy
      • Kraken
      • Kraken Futures
      • KuCoin
      • KuCoin Futures
      • LBank
      • ❌OKCoin
      • OKX
      • OKX-Futures
      • OKX-Swap
      • Phemex
      • Poloniex
      • Poloniex Futures
      • WooX
    • Setup Telegram Notification Bot
    • Setup Discord Notification Bot
    • Use Signals
  • Other Resources
    • YouTube
    • Guides & Tutorials
    • Questions & Answers
    • Community Projects
  • Need Help?
    • Ask on Discord
    • Submit Support Ticket
Powered by GitBook
On this page
  • Charting
  • HaasScript Charting Rules
  • Plotting A Line
  • LineOptions
  • Manipulating Single Line
  • Manipulating Multiple Lines
  • Double Axis
  • Double Price Plot

Was this helpful?

  1. Haasscript
  2. Tutorials
  3. Usage
  4. HaasScript

Charting

Charting

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)
PreviousTradingNextOptimizations

Last updated 2 years ago

Was this helpful?