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
  • ArrayAdd
  • ArrayAny
  • ArrayConcat
  • ArrayContains
  • ArrayDistinct
  • ArrayFilter
  • ArrayFind
  • ArrayGet
  • ArrayIndex
  • ArrayLast
  • ArrayPop
  • ArrayRemove
  • ArrayReplace
  • ArrayShift
  • ArraySort
  • ArraySum
  • ArrayUnshift
  • Count
  • Grab
  • Offset
  • Range
  • SourceManager

Was this helpful?

  1. Haasscript
  2. Commands
  3. Helpers

Array Helpers

ArrayAdd

Adds an element to an existing array.

Syntax: ArrayAdd(input, element)

Returns the input array.

Return type: Dynamic

Parameter Name
Parameter Type
Required
Suggestions

input

Dynamic

True

element

Dynamic

True

ArrayAny

Returns true if the array contains any element or an element matches a specific value.

Syntax: ArrayAny(input, [ value ])

Returns true if the input has any elements or if 'value' is defined when any of the elements matches the value.

Return type: Boolean

Parameter Name
Parameter Type
Required
Suggestions

input

Dynamic

True

value

Dynamic

False

ArrayConcat

Concatenates two arrays.

Syntax: ArrayConcat(array1, array2)

Returns the concatenated array.

Return type: Dynamic

Parameter Name
Parameter Type
Required
Suggestions

array1

Dynamic

True

array2

Dynamic

True

ArrayContains

Returns true if the array contains any element or an element matches a specific value.

Syntax: ArrayContains(input, [ value ])

Returns true if the input has any elements or if 'value' is defined when any of the elements matches the value.

Return type: Boolean

Parameter Name
Parameter Type
Required
Suggestions

input

Dynamic

True

value

Dynamic

False

ArrayDistinct

Returns a new list with only unique elements. In other words; removes all duplicates.

Syntax: ArrayDistinct(input)

Returns the unique values of the input.

Return type: Dynamic

Parameter Name
Parameter Type
Required
Suggestions

input

Dynamic

True

ArrayFilter

Returns a new list with elements that only matches the value. Matching-rules specified by filterType.

Syntax: ArrayFilter(input, value, [ filterType ])

Returns the list.

Return type: Dynamic

Parameter Name
Parameter Type
Required
Suggestions

input

Dynamic

True

value

Dynamic

True

filterType

Enum

False

ArrayFilterInclusiveType,ArrayFilterExclusiveType,ArrayFilterLessThanType,ArrayFilterGreaterThanType

ArrayFind

Returns a new list of indices of the matching values. Matching-rules specified by filterType.

Syntax: ArrayFind(input, value, [ filterType ])

Returns the list.

Return type: Dynamic

Parameter Name
Parameter Type
Required
Suggestions

input

Dynamic

True

value

Dynamic

True

filterType

Enum

False

ArrayFilterInclusiveType,ArrayFilterExclusiveType,ArrayFilterLessThanType,ArrayFilterGreaterThanType

ArrayGet

Gets the value on a specific index. A negative index will take from the end of the array.

Syntax: ArrayGet(input, index)

Return the value on that index.

Return type: Dynamic

Parameter Name
Parameter Type
Required
Suggestions

input

Dynamic

True

index

Number

True

Input,Number,SessionGet

ArrayIndex

Gets the value on a specific index. A negative index will take from the end of the array.

Syntax: ArrayIndex(input, index)

Return the value on that index.

Return type: Dynamic

Parameter Name
Parameter Type
Required
Suggestions

input

Dynamic

True

index

Number

True

Input,Number,SessionGet

ArrayLast

Gets the last value of the array with an optional offset.

Syntax: ArrayLast(input, [ offset ])

Return the last value of the array taking the offset into account.

Return type: Dynamic

Parameter Name
Parameter Type
Required
Suggestions

input

Dynamic

True

offset

Number

False

Input,Number,SessionGet

ArrayPop

Remove an item from the end of an array.

Syntax: ArrayPop(input)

Returns the input array.

Return type: Dynamic

Parameter Name
Parameter Type
Required
Suggestions

input

Dynamic

True

ArrayRemove

Removes an element from a specified index.

Syntax: ArrayRemove(input, index)

Returns the input array.

Return type: Dynamic

Parameter Name
Parameter Type
Required
Suggestions

input

Dynamic

True

index

Number

True

Input,Number,SessionGet

ArrayReplace

Replaces a specific value with another value.

Syntax: ArrayReplace(input, oldValue, newValue)

The input with replaced values.

Return type: Dynamic

Parameter Name
Parameter Type
Required
Suggestions

input

Dynamic

True

oldValue

Dynamic

True

newValue

Dynamic

True

ArrayShift

Remove an item from the beginning of an array.

Syntax: ArrayShift(input)

The input without the first value

Return type: Dynamic

Parameter Name
Parameter Type
Required
Suggestions

input

Dynamic

True

ArraySort

Sorts the array values in ascending or descending order.

Syntax: ArraySort(input, [ descending ])

Returns the sorted array.

Return type: Dynamic

Parameter Name
Parameter Type
Required
Suggestions

input

Dynamic

True

descending

Boolean

False

True,IsTrue,False,IsFalse,Or,Branch,Equals,IsBiggerThan,IsSmallerThan,IsBiggerOrSmallerThan,IsAnyOrderOpen,IsOrderFilled,IsOrderOpen,IsTradeAmountEnough

ArraySum

Computes the sum of the array. Can be used in combination with a list of numbers or container results like GetAllOpenOrders() or GetAllFinishedOrders().

Syntax: ArraySum(input, [ key ])

Returns the sum of the array.

Return type: Number

Parameter Name
Parameter Type
Required
Suggestions

input

Dynamic

True

key

String

False

ArrayUnshift

Adds an element to the beginning of an array.

Syntax: ArrayUnshift(input, element)

The input with the element added in front of the array

Return type: Dynamic

Parameter Name
Parameter Type
Required
Suggestions

input

Dynamic

True

element

Dynamic

True

Count

Gets the length of an array or the number of occurrences within the array of a specific value.

Syntax: Count(input, [ value ])

Returns the length of an array or the number of occurrences within the array of a specific value.

Return type: Number

Parameter Name
Parameter Type
Required
Suggestions

input

Dynamic

True

value

Dynamic

False

Grab

Grabs a range from the array. If count is not set, return all after the offset.

Syntax: Grab(input, offset, [ count ])

Specified range from the array.

Return type: Dynamic

Parameter Name
Parameter Type
Required
Suggestions

input

Dynamic

True

offset

Number

True

Input,Number,SessionGet

count

Number

False

Input,Number,SessionGet

Offset

Gets an offset amount of the given array.

Syntax: Offset(input, offset)

Returns the given array with the offset amount of data removed from it.

Return type: Dynamic

Parameter Name
Parameter Type
Required
Suggestions

input

Dynamic

True

offset

Number

True

Input,Number,SessionGet

Range

Grabs a range from the array. If count is not set, return all after the offset.

Syntax: Range(input, offset, [ count ])

Specified range from the array.

Return type: Dynamic

Parameter Name
Parameter Type
Required
Suggestions

input

Dynamic

True

offset

Number

True

Input,Number,SessionGet

count

Number

False

Input,Number,SessionGet

SourceManager

Stores numeric values in a collection. Only adds the new value when the candle on the specified interval closed. This results in interval based data.

Syntax: SourceManager(newValue, [ interval ], [ cap ], [ initialValues ])

Returns the numeric collection.

Return type: ListNumbers

Parameter Name
Parameter Type
Required
Suggestions

newValue

Number

True

interval

Number

False

InputInterval,Number,CurrentInterval

cap

Number

False

initialValues

ListNumbers

False

PreviousHelpersNextCustom Command Helpers

Last updated 1 year ago

Was this helpful?