Bot Settings
DeactivateBot
Deactivates the bot. Once the bot is deactivated, it can only manually activate again.
Syntax: DeactivateBot([ reason ], [ cancelOpenOrders ])
Return type: Void
Parameter Name | Parameter Type | Required | Suggestions |
---|---|---|---|
reason | String | False | Text,Input,SessionGet,Load |
cancelOpenOrders | Boolean | False | True,IsTrue,False,IsFalse,Or,Branch,Equals,IsBiggerThan,IsSmallerThan,IsBiggerOrSmallerThan,IsAnyOrderOpen,IsOrderFilled,IsOrderOpen,IsTradeAmountEnough |
DisableIndicatorContainerLogs
Disables IndicatorContainer log messages.
Syntax: DisableIndicatorContainerLogs()
Return type: Void
EnableHighSpeedUpdates
Enables high-speed script execution.
Syntax: EnableHighSpeedUpdates([ updateOnFilledOrders ])
Return type: Void
Parameter Name | Parameter Type | Required | Suggestions |
---|---|---|---|
updateOnFilledOrders | Boolean | False | True,False |
EnableOrderPersistence
Enables order persistence for managed trading.
Syntax: EnableOrderPersistence()
Return type: Void
Finalize
Only executes on the last update cycle of a backtest. Saving time in the overall backtest length. Can be used in combination with plot manipulation (eg. PlotDoubleColor()) or CustomReport()
Syntax: Finalize([ callback ])
Returns true when executed.
Return type: Boolean
Parameter Name | Parameter Type | Required | Suggestions |
---|---|---|---|
callback | Dynamic | False |
GetHaasScriptVersion
Gets the current HaasScript version as a number.
Syntax: GetHaasScriptVersion()
Returns the version number.
Return type: Number
GetLeverage
Gets the set leverage for current or specified market.
Syntax: GetLeverage([ market ], [ accountId ])
Returns the leverage value or -1 if request failed.
Return type: Number
Parameter Name | Parameter Type | Required | Suggestions |
---|---|---|---|
market | String | False | InputAccountMarket,InputMarket,InputPriceSourceMarket,PriceMarket |
accountId | String | False | InputAccount,InputAccountMarket,InputMarket,AccountGuid |
GetMarginMode
Gets the current margin mode for current or specified market.
Syntax: GetMarginMode([ market ], [ accountId ])
Returns the margin mode enum.
Return type: Enum
Parameter Name | Parameter Type | Required | Suggestions |
---|---|---|---|
market | String | False | InputAccountMarket,InputMarket,InputPriceSourceMarket,PriceMarket |
accountId | String | False | InputAccount,InputAccountMarket,InputMarket,AccountGuid |
GetMaxLeverage
Gets the maximum leverage for current or specified market.
Syntax: GetMaxLeverage([ market ])
Returns the maximum leverage value or -1 if request failed.
Return type: Number
Parameter Name | Parameter Type | Required | Suggestions |
---|---|---|---|
market | String | False | InputAccountMarket,InputMarket,InputPriceSourceMarket,PriceMarket |
GetOrderType
Returns the current main order type.
Syntax: GetOrderType()
Returns the order type enum.
Return type: Enum
GetPositionMode
Gets the current position mode for current or specified market.
Syntax: GetPositionMode([ accountId ], [ market ])
Returns the position mode enum.
Return type: Enum
Parameter Name | Parameter Type | Required | Suggestions |
---|---|---|---|
accountId | String | False | InputAccount,InputAccountMarket,InputMarket,AccountGuid |
market | String | False | InputAccountMarket,InputMarket,InputPriceSourceMarket,PriceMarket |
HideOrderSettings
Hides the 2 order settings fields.
Syntax: HideOrderSettings()
Return type: Void
HideTradeAmountSettings
Hides the 2 trade amount settings fields.
Syntax: HideTradeAmountSettings()
Return type: Void
IsBotPaused
Used in combination with Pause- & ResumeBot(). The value can also be updated manually though the UI.
Syntax: IsBotPaused()
Returns true if the pause flag is set.
Return type: Boolean
IsEnterpriseVersion
Returns true if running the enterprise version. Otherwise false.
Syntax: IsEnterpriseVersion()
Returns a boolean.
Return type: Boolean
IsMarginModeSupported
Checks if the specified margin mode is supported on current or specified market.
Syntax: IsMarginModeSupported(marginMode, [ accountId ])
Returns true if supported, otherwise false.
Return type: Boolean
Parameter Name | Parameter Type | Required | Suggestions |
---|---|---|---|
marginMode | Enum | True | CrossMarginMode,IsolatedMarginMode |
accountId | String | False | InputAccount,InputAccountMarket,InputMarket,AccountGuid |
IsPositionModeSupported
Checks if specified position mode is supported on current or specified market.
Syntax: IsPositionModeSupported(positionMode, [ accountId ])
Returns true if supported, otherwise false.
Return type: Boolean
Parameter Name | Parameter Type | Required | Suggestions |
---|---|---|---|
positionMode | Enum | True | OneWayPositionMode,HedgePositionMode |
accountId | String | False | InputAccount,InputAccountMarket,InputMarket,AccountGuid |
OptimizedForInterval
Executes and saves or loads a value depending on the timestamp and interval. This command can be used to speed up backtest calculations which are depending on interval based data. For examples indicator calculation with closed candles.
Syntax: OptimizedForInterval(interval, callback)
Returns the saved value or result of the callback.
Return type: Dynamic
Parameter Name | Parameter Type | Required | Suggestions |
---|---|---|---|
interval | Number | True | |
callback | Dynamic | True |
PauseBot
Enables the paused flag. Use in combination with IsBotPaused() to read the value. Can be used to temporary block certain actions like increasing position without stopping the whole bot. Bots will continue to update and are allowed to place/cancel orders.
Syntax: PauseBot()
Return type: Void
ResumeBot
Disables the pause flag. Use in combination with IsBotPaused() to read the value
Syntax: ResumeBot()
Return type: Void
SetLeverage
Sets the leverage ratio for current or specified market.
Syntax: SetLeverage(leverage, [ market ], [ accountId ])
Returns true if successfully set value, otherwise false.
Return type: Boolean
Parameter Name | Parameter Type | Required | Suggestions |
---|---|---|---|
leverage | Number | True | Input,Number,SessionGet |
market | String | False | InputAccountMarket,InputMarket,InputPriceSourceMarket,PriceMarket |
accountId | String | False | InputAccount,InputAccountMarket,InputMarket,AccountGuid |
SetMarginMode
Sets the margin mode for current or specific market. It is NOT possible to change margin mode while having an open position.
Syntax: SetMarginMode(marginMode, [ market ], [ accountId ])
Returns true if successfully set, otherwise false.
Return type: Boolean
Parameter Name | Parameter Type | Required | Suggestions |
---|---|---|---|
marginMode | Enum | True | IsolatedMarginMode,CrossMarginMode |
market | String | False | InputAccountMarket,InputMarket,InputPriceSourceMarket,PriceMarket |
accountId | String | False | InputAccount,InputAccountMarket,InputMarket,AccountGuid |
SetOrderType
Overwrites the order type with the given type. This can be used to execute different order types on managed trading.
Syntax: SetOrderType(type)
Return type: Void
Parameter Name | Parameter Type | Required | Suggestions |
---|---|---|---|
type | Enum | True | MarketOrderType,LimitOrderType,MakerOrCancelOrderType,NoTimeOutOrderType,StopLimitOrderType,StopMarketOrderType,TakeProfitLimitOrderType,TakeProfitMarketOrderType,TrailingStopMarketOrderType |
SetPositionMode
Sets the position mode for current or specified market. It is NOT possible to change position mode while having an open position.
Syntax: SetPositionMode(positionMode, [ accountId ], [ market ])
Returns true if successfully set, otherwise false.
Return type: Boolean
Parameter Name | Parameter Type | Required | Suggestions |
---|---|---|---|
positionMode | Enum | True | OneWayPositionMode,HedgePositionMode |
accountId | String | False | InputAccount,InputAccountMarket,InputMarket,AccountGuid |
market | String | False | InputAccountMarket,InputMarket,InputPriceSourceMarket,PriceMarket |
Last updated