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

Was this helpful?

  1. HaasScript
  2. Commands

Array Helpers

ArrayAdd

Adds an element to an existing array.

  • ArrayAdd(input, element)

Returns the input array.

Return Type: Dynamic

Parameter Name

Parameter Type

Required

Suggested

input

Dynamic

True

-

element

Dynamic

True

-

ArrayAny

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

  • ArrayAny(input, [ value ])

Returns true if.

Return Type: Boolean

Parameter Name

Parameter Type

Required

Suggested

input

Dynamic

True

-

value

Dynamic

False

-

ArrayConcat

Concatenates two arrays.

  • ArrayConcat(array1, array2)

Returns the concatenated array.

Return Type: Dynamic

Parameter Name

Parameter Type

Required

Suggested

array1

Dynamic

True

-

array2

Dynamic

True

-

ArrayContains

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

  • ArrayContains(input, [ value ])

Returns true if.

Return Type: Boolean

Parameter Name

Parameter Type

Required

Suggested

input

Dynamic

True

-

value

Dynamic

False

-

ArrayFilter

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

  • ArrayFilter(input, value, [ filterType ])

Returns true if.

Return Type: Dynamic

Parameter Name

Parameter Type

Required

Suggested

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.

  • ArrayFind(input, value, [ filterType ])

Returns the list.

Return Type: Dynamic

Parameter Name

Parameter Type

Required

Suggested

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.

  • ArrayGet(input, index)

Return the value on that index.

Return Type: Dynamic

Parameter Name

Parameter Type

Required

Suggested

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.

  • ArrayIndex(input, index)

Return the value on that index.

Return Type: Dynamic

Parameter Name

Parameter Type

Required

Suggested

input

Dynamic

True

-

index

Number

True

Input, Number, SessionGet

ArrayLast

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

  • ArrayLast(input, [ offset ])

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

Return Type: Dynamic

Parameter Name

Parameter Type

Required

Suggested

input

Dynamic

True

-

offset

Number

False

Input, Number, SessionGet

ArrayPop

Remove an item from the end of an array.

  • ArrayPop(input)

Returns the input array.

Return Type: Dynamic

Parameter Name

Parameter Type

Required

Suggested

input

Dynamic

True

-

ArrayRemove

Removes an element from a specified index.

  • ArrayRemove(input, index)

Returns the input array.

Return Type: Dynamic

Parameter Name

Parameter Type

Required

Suggested

input

Dynamic

True

-

index

Number

True

Input, Number, SessionGet

ArrayReplace

Replaces a specific value with another value.

  • ArrayReplace(input, oldValue, newValue)

Returns true if.

Return Type: Dynamic

Parameter Name

Parameter Type

Required

Suggested

input

Dynamic

True

-

oldValue

Dynamic

True

-

newValue

Dynamic

True

-

ArrayShift

Remove an item from the beginning of an array.

  • ArrayShift(input)

Returns the input array.

Return Type: Dynamic

Parameter Name

Parameter Type

Required

Suggested

input

Dynamic

True

-

ArraySort

Sorts the array values in ascending or descending order.

  • ArraySort(input, [ descending ])

Returns the sorted array.

Return Type: Dynamic

Parameter Name

Parameter Type

Required

Suggested

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().

  • ArraySum(input, [ key ])

Returns the sum of the array.

Return Type: Number

Parameter Name

Parameter Type

Required

Suggested

input

Dynamic

True

-

key

String

False

-

ArrayUnshift

Adds an element to the beginning of an array.

  • ArrayUnshift(input, element)

Returns the input array.

Return Type: Dynamic

Parameter Name

Parameter Type

Required

Suggested

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.

  • 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

Suggested

input

Dynamic

True

-

value

Dynamic

False

-

Grab

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

  • Grab(input, offset, [ count ])

Specified range from the array.

Return Type: Dynamic

Parameter Name

Parameter Type

Required

Suggested

input

Dynamic

True

-

offset

Number

True

Input, Number, SessionGet

count

Number

False

Input, Number, SessionGet

Offset

Gets an offset amount of the given array.

  • Offset(input, offset)

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

Return Type: Dynamic

Parameter Name

Parameter Type

Required

Suggested

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.

  • Range(input, offset, [ count ])

Specified range from the array.

Return Type: Dynamic

Parameter Name

Parameter Type

Required

Suggested

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.

  • SourceManager(newValue, [ interval ], [ cap ])

Returns the numeric collection.

Return Type: ListNumbers

Parameter Name

Parameter Type

Required

Suggested

newValue

Number

True

-

interval

Number

False

InputInterval, Number, CurrentInterval

cap

Number

False

-

PreviousCommandsNextCharting

Last updated 4 years ago

Was this helpful?