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
  • Abs
  • Acos
  • Add
  • AddPerc
  • AddPercentage
  • Asin
  • Atan
  • Atan2
  • Average
  • Average2
  • Ceil
  • Change
  • Clamp
  • Compress
  • Cos
  • Cosh
  • Delta
  • Div
  • Epsilon
  • Exp
  • FilterAbove
  • FilterBelow
  • Floor
  • GetHigh
  • GetHighs
  • GetLow
  • GetLows
  • Ln
  • Log10
  • Max
  • Min
  • Mul
  • Mult
  • NumberMax
  • NumberMin
  • PercentageChange
  • PI
  • Pow
  • Random
  • ReplaceAbove
  • ReplaceBelow
  • Round
  • Satoshi
  • Sd
  • Sign
  • Sin
  • Sinh
  • Sqrt
  • Sub
  • SubPerc
  • SubPercentage
  • Sum
  • Tan
  • Tanh
  • Truncate

Was this helpful?

  1. Haasscript
  2. Commands
  3. Helpers

Mathematical

Abs

Calculates an absolute/positive number.

Syntax: Abs(input)

Returns an absolute/positive number.

Return type: NumberOrTable

Parameter Name
Parameter Type
Required
Suggestions

input

NumberOrTable

True

Acos

Calculates the angle whose cosine is the specified number.

Syntax: Acos(input)

Returns the angle whose cosine is the specified number.

Return type: NumberOrTable

Parameter Name
Parameter Type
Required
Suggestions

input

NumberOrTable

True

Add

Adds numbers/tables and returns the result number/table.

Syntax: Add(input1, [ input2 ])

Returns the total sum of a single value is provide, adds the 2 values if there are 2 provided.

Return type: NumberOrTable

Parameter Name
Parameter Type
Required
Suggestions

input1

NumberOrTable

True

Input,Number

input2

NumberOrTable

False

Input,Number

AddPerc

Add a percentage to the value.

Syntax: AddPerc(value, percentage)

Returns the value with the added percentage.

Return type: ListNumbers

Parameter Name
Parameter Type
Required
Suggestions

value

NumberOrTable

True

percentage

Number

True

Input,Number,SessionGet

AddPercentage

Add a percentage to the value.

Syntax: AddPercentage(value, percentage)

Returns the value with the added percentage.

Return type: ListNumbers

Parameter Name
Parameter Type
Required
Suggestions

value

NumberOrTable

True

percentage

Number

True

Input,Number,SessionGet

Asin

Calculates the angle whose sine is the specified number.

Syntax: Asin(input)

Returns the angle whose sine is the specified number.

Return type: NumberOrTable

Parameter Name
Parameter Type
Required
Suggestions

input

NumberOrTable

True

Atan

Calculates the angle whose tangent is the specified number.

Syntax: Atan(input)

Returns the angle whose tangent is the specified number.

Return type: NumberOrTable

Parameter Name
Parameter Type
Required
Suggestions

input

NumberOrTable

True

Atan2

Calculates the angle whose tangent is the quotient of two specified numbers.

Syntax: Atan2(input1, input2)

Returns the angle whose tangent is the quotient of two specified numbers.

Return type: NumberOrTable

Parameter Name
Parameter Type
Required
Suggestions

input1

NumberOrTable

True

input2

NumberOrTable

True

Average

Calculates the average value of the array, two numbers or averages between 2 arrays.

Syntax: Average(input1, [ input2 ])

Returns the average value of the array, two numbers or averages between 2 arrays.

Return type: NumberOrTable

Parameter Name
Parameter Type
Required
Suggestions

input1

NumberOrTable

True

input2

NumberOrTable

False

Average2

Calculates the average value of the array for a certain period.

Syntax: Average2(input, [ period ])

Returns the average value of the array for a certain period.

Return type: NumberOrTable

Parameter Name
Parameter Type
Required
Suggestions

input

ListNumbers

True

period

Number

False

Ceil

Calculates the smallest integral value greater than or equal to the specified number.

Syntax: Ceil(input)

Returns the smallest integral value greater than or equal to the specified number.

Return type: NumberOrTable

Parameter Name
Parameter Type
Required
Suggestions

input

NumberOrTable

True

Change

Calculates the absolute price changes between the values.

Syntax: Change(prices)

Returns the new-old change of the values in an array.

Return type: ListNumbers

Parameter Name
Parameter Type
Required
Suggestions

prices

ListNumbers

True

GetBuyPrices,GetSellPrices,GetOpenPrices,GetHighPrices,GetLowPrices,GetClosePrices,GetHighLowPrices,GetHighLowClosePrices,GetOpenClosePrices,GetOpenHighLowClosePrices,GetBodyHighPrices,GetBodyLowPrices

Clamp

Calculates the number or table of numbers clamped between the specified minimum and maximum.

Syntax: Clamp(input, min, max)

Returns number or table of numbers clamped between the specified minimum and maximum.

Return type: NumberOrTable

Parameter Name
Parameter Type
Required
Suggestions

input

NumberOrTable

True

min

Number

True

max

Number

True

Compress

Calculates the average values of every 2 values in an array. When the input is [10, 20, 30, 40] the result will be [15, 35].

Syntax: Compress(input)

Returns the compressed array.

Return type: ListNumbers

Parameter Name
Parameter Type
Required
Suggestions

input

ListNumbers

True

Cos

Calculates the cosine of the specified angle.

Syntax: Cos(input)

Returns the cosine of the specified angle.

Return type: NumberOrTable

Parameter Name
Parameter Type
Required
Suggestions

input

NumberOrTable

True

Cosh

Calculates the hyperbolic cosine of the specified angle.

Syntax: Cosh(input)

Returns the hyperbolic cosine of the specified angle.

Return type: NumberOrTable

Parameter Name
Parameter Type
Required
Suggestions

input

NumberOrTable

True

Delta

Calculates the percentage between input1 and input2 or the percentage change between the values of input1.

Syntax: Delta(input1, [ input2 ])

Returns the percentage between input1 and input2. When for example input1 is 5 and input2 is 6, 20 is returned.

Return type: NumberOrTable

Parameter Name
Parameter Type
Required
Suggestions

input1

NumberOrTable

True

input2

NumberOrTable

False

Div

Divides input1 with input2. If one of the parameters is a single value, the other is divided by this.

Syntax: Div(input1, input2)

Returns the divided numbers/tables.

Return type: NumberOrTable

Parameter Name
Parameter Type
Required
Suggestions

input1

NumberOrTable

True

Input,Number

input2

NumberOrTable

True

Input,Number

Epsilon

Enumeration, returns 1 Satoshi (=Epsilon).

Syntax: Epsilon()

Returns 1 Satoshi (=Epsilon).

Return type: Number

Exp

Calculates 'e' raised to the specified power.

Syntax: Exp(input)

Returns 'e' raised to the specified power.

Return type: NumberOrTable

Parameter Name
Parameter Type
Required
Suggestions

input

NumberOrTable

True

FilterAbove

Filters out all values above a specific value.

Syntax: FilterAbove(input, threshold)

Returns the filtered input.

Return type: ListNumbers

Parameter Name
Parameter Type
Required
Suggestions

input

NumberOrTable

True

threshold

Number

True

FilterBelow

Filters out all values below a specific value.

Syntax: FilterBelow(input, threshold)

Returns the filtered input.

Return type: ListNumbers

Parameter Name
Parameter Type
Required
Suggestions

input

NumberOrTable

True

threshold

Number

True

Floor

Calculates the largest integral value less than or equal to the specified number.

Syntax: Floor(input)

Returns the largest integral value less than or equal to the specified number.

Return type: NumberOrTable

Parameter Name
Parameter Type
Required
Suggestions

input

NumberOrTable

True

GetHigh

Gets the highest value.

Syntax: GetHigh(prices, depth, [ offset ])

Returns the highest value.

Return type: Number

Parameter Name
Parameter Type
Required
Suggestions

prices

ListNumbers

True

GetBuyPrices,GetSellPrices,GetOpenPrices,GetHighPrices,GetLowPrices,GetClosePrices,GetHighLowPrices,GetHighLowClosePrices,GetOpenClosePrices,GetOpenHighLowClosePrices,GetBodyHighPrices,GetBodyLowPrices

depth

Number

True

Input,Number,SessionGet

offset

Number

False

Input,Number,SessionGet

GetHighs

Gets the highest values within lookback period.

Syntax: GetHighs(array, depth)

Returns the highest values within lookback period.

Return type: ListNumbers

Parameter Name
Parameter Type
Required
Suggestions

array

ListNumbers

True

GetBuyPrices,GetSellPrices,GetOpenPrices,GetHighPrices,GetLowPrices,GetClosePrices,GetHighLowPrices,GetHighLowClosePrices,GetOpenClosePrices,GetOpenHighLowClosePrices,GetBodyHighPrices,GetBodyLowPrices

depth

Number

True

Input,Number,SessionGet

GetLow

Gets the lowest value.

Syntax: GetLow(prices, depth, [ offset ])

Returns the lowest value.

Return type: Number

Parameter Name
Parameter Type
Required
Suggestions

prices

ListNumbers

True

GetBuyPrices,GetSellPrices,GetOpenPrices,GetHighPrices,GetLowPrices,GetClosePrices,GetHighLowPrices,GetHighLowClosePrices,GetOpenClosePrices,GetOpenHighLowClosePrices,GetBodyHighPrices,GetBodyLowPrices

depth

Number

True

Input,Number,SessionGet

offset

Number

False

Input,Number,SessionGet

GetLows

Gets the lowest values within lookback period.

Syntax: GetLows(array, depth)

Returns the lowest values within lookback period.

Return type: ListNumbers

Parameter Name
Parameter Type
Required
Suggestions

array

ListNumbers

True

GetBuyPrices,GetSellPrices,GetOpenPrices,GetHighPrices,GetLowPrices,GetClosePrices,GetHighLowPrices,GetHighLowClosePrices,GetOpenClosePrices,GetOpenHighLowClosePrices,GetBodyHighPrices,GetBodyLowPrices

depth

Number

True

Input,Number,SessionGet

Ln

Calculates the logarithm of a specified number.

Syntax: Ln(input1, [ input2 ])

Returns the logarithm of a specified number.

Return type: NumberOrTable

Parameter Name
Parameter Type
Required
Suggestions

input1

NumberOrTable

True

input2

NumberOrTable

False

Log10

Calculates the base 10 logarithm of a specified number.

Syntax: Log10(input)

Returns the base 10 logarithm of a specified number.

Return type: NumberOrTable

Parameter Name
Parameter Type
Required
Suggestions

input

NumberOrTable

True

Max

Returns the maximum value. If the input is a single array, it returns the biggest number in that array (single value). If inputs are both numbers, it returns the biggest number (single value). If inputs are array and number, it returns the biggest number (array[1] vs number, single value). If inputs are both arrays, it returns an array of the biggest numbers per cell (array, length determined by the shorter array).

Syntax: Max(values[])

Returns the biggest number or an array of biggest numbers per cell.

Return type: NumberOrTable

Parameter Name
Parameter Type
Required
Suggestions

values[]

NumberOrTableParams

True

Min

Returns the minimum value. If the input is a single array, it returns the minimum in that array (single value). If inputs are both numbers, it returns the smallest number (single value). If inputs are array and number, it returns the smallest number (single value). If inputs are both arrays, it returns an array of the smallest numbers per cell (array, length determined by shortest array)

Syntax: Min(values[])

Returns the smallest number or an array of smallest numbers per cell.

Return type: NumberOrTable

Parameter Name
Parameter Type
Required
Suggestions

values[]

NumberOrTableParams

True

Mul

Multiplies input1 with input2. If one of the parameters is a single value, the other is multiplied by this.

Syntax: Mul(input1, input2)

Returns the multiplied numbers/tables.

Return type: NumberOrTable

Parameter Name
Parameter Type
Required
Suggestions

input1

NumberOrTable

True

Input,Number

input2

NumberOrTable

True

Input,Number

Mult

Multiplies input1 with input2. If one of the parameters is a single value, the other is multiplied by this.

Syntax: Mult(input1, input2)

Returns the multiplied numbers/tables.

Return type: NumberOrTable

Parameter Name
Parameter Type
Required
Suggestions

input1

NumberOrTable

True

Input,Number

input2

NumberOrTable

True

Input,Number

NumberMax

Enumeration, returns the maximum number.

Syntax: NumberMax()

Returns a maximum value (2147483647).

Return type: Number

NumberMin

Enumeration, returns the minimum number.

Syntax: NumberMin()

Returns a minimum value (-2147483648).

Return type: Number

PercentageChange

Calculates the percentage between input1 and input2 or the percentage change between the values of input1.

Syntax: PercentageChange(input1, [ input2 ])

Returns the percentage between input1 and input2. When for example input1 is 5 and input2 is 6, 20 is returned.

Return type: NumberOrTable

Parameter Name
Parameter Type
Required
Suggestions

input1

NumberOrTable

True

input2

NumberOrTable

False

PI

Enumeration, returns the number of PI.

Syntax: PI()

Returns PI (3.14159265359).

Return type: Number

Pow

Calculates a specified number/table raised to the specified power number/table.

Syntax: Pow(input1, input2)

Returns a specified number/table raised to the specified power number/table.

Return type: NumberOrTable

Parameter Name
Parameter Type
Required
Suggestions

input1

NumberOrTable

True

Input,Number

input2

NumberOrTable

True

Input,Number

Random

Creates a random number.

Syntax: Random([ min ], [ max ])

Returns a random number.

Return type: Number

Parameter Name
Parameter Type
Required
Suggestions

min

Number

False

Input,Number

max

Number

False

Input,Number

ReplaceAbove

Replaces any value above a specific value with another value.

Syntax: ReplaceAbove(input, threshold, newValue)

Returns the input with replaced values.

Return type: ListNumbers

Parameter Name
Parameter Type
Required
Suggestions

input

NumberOrTable

True

threshold

Number

True

newValue

Number

True

ReplaceBelow

Replaces any value below a specific value with another value.

Syntax: ReplaceBelow(input, threshold, newValue)

Returns the input with replaced values.

Return type: ListNumbers

Parameter Name
Parameter Type
Required
Suggestions

input

NumberOrTable

True

threshold

Number

True

newValue

Number

True

Round

Rounds a value (or values if table) to the nearest integer or to the specified number of fractional digits.

Syntax: Round(input, digits)

Returns the rounded number.

Return type: NumberOrTable

Parameter Name
Parameter Type
Required
Suggestions

input

NumberOrTable

True

digits

Number

True

Input,Number

Satoshi

Enumeration, returns 1 Satoshi (=Epsilon).

Syntax: Satoshi()

Returns 1 Satoshi (=Epsilon).

Return type: Number

Sd

Calculates the Standard Deviation from the data series.

Syntax: Sd(input)

Returns the Standard Deviation.

Return type: Number

Parameter Name
Parameter Type
Required
Suggestions

input

ListNumbers

True

ArrayNew,GetClosePrices

Sign

Calculates an integer that indicates the sign of a number.

Syntax: Sign(input)

Returns an integer that indicates the sign of a number.

Return type: NumberOrTable

Parameter Name
Parameter Type
Required
Suggestions

input

NumberOrTable

True

Sin

Calculates the sine of the specified angle.

Syntax: Sin(input)

Returns the sine of the specified angle.

Return type: NumberOrTable

Parameter Name
Parameter Type
Required
Suggestions

input

NumberOrTable

True

Sinh

Calculates the hyperbolic sine of the specified angle.

Syntax: Sinh(input)

Returns the hyperbolic sine of the specified angle.

Return type: NumberOrTable

Parameter Name
Parameter Type
Required
Suggestions

input

NumberOrTable

True

Sqrt

Calculates the square root of a specified number.

Syntax: Sqrt(input)

Returns the square root of a specified number.

Return type: NumberOrTable

Parameter Name
Parameter Type
Required
Suggestions

input

NumberOrTable

True

Sub

Subtracts numbers/tables and returns the result number/table.

Syntax: Sub(input1, input2)

Calculates the subtracted numbers/tables.

Return type: NumberOrTable

Parameter Name
Parameter Type
Required
Suggestions

input1

NumberOrTable

True

Input,Number

input2

NumberOrTable

True

Input,Number

SubPerc

Subtracts a percentage to the value.

Syntax: SubPerc(value, percentage)

Returns the value with the subtracted percentage.

Return type: ListNumbers

Parameter Name
Parameter Type
Required
Suggestions

value

NumberOrTable

True

percentage

Number

True

Input,Number,SessionGet

SubPercentage

Subtracts a percentage to the value.

Syntax: SubPercentage(value, percentage)

Returns the value with the subtracted percentage.

Return type: ListNumbers

Parameter Name
Parameter Type
Required
Suggestions

value

NumberOrTable

True

percentage

Number

True

Input,Number,SessionGet

Sum

Adds numbers/tables and returns the result number/table.

Syntax: Sum(input1, [ input2 ])

Returns the total sum of a single value is provide, adds the 2 values if there are 2 provided.

Return type: NumberOrTable

Parameter Name
Parameter Type
Required
Suggestions

input1

NumberOrTable

True

Input,Number

input2

NumberOrTable

False

Input,Number

Tan

Calculates the tangent of the specified angle.

Syntax: Tan(input)

Returns the tangent of the specified angle.

Return type: NumberOrTable

Parameter Name
Parameter Type
Required
Suggestions

input

NumberOrTable

True

Tanh

Calculates the hyperbolic tangent of the specified angle.

Syntax: Tanh(input)

Returns the hyperbolic tangent of the specified angle.

Return type: NumberOrTable

Parameter Name
Parameter Type
Required
Suggestions

input

NumberOrTable

True

Truncate

Truncates a value (or values if table) to the nearest integer or to the specified number of fractional digits.

Syntax: Truncate(input, digits)

Returns the truncated number.

Return type: NumberOrTable

Parameter Name
Parameter Type
Required
Suggestions

input

NumberOrTable

True

digits

Number

True

Input,Number

PreviousEquationsNextMemory Helpers

Last updated 1 year ago

Was this helpful?