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
  • DeactivateAfterEnterOrder
  • DeactivateAfterExitOrder
  • DeactivateAfterXActiveMinutes
  • DeactivateAfterXIdleMinutes
  • DeactivateAfterXOrders
  • DeactivateAfterXPositions
  • DeactivateOnLoss
  • DeactivateOnProfit
  • DynamicStopLoss
  • DynamicTakeProfit
  • GrowingTrailingStopLoss
  • ShrinkingTrailingStopLoss
  • StopLoss
  • StopLossROI
  • TakeProfit
  • TakeProfitROI
  • TrailingArmStopLoss
  • TrailingStopLoss

Was this helpful?

  1. HaasScript
  2. Commands

Easy Safeties

DeactivateAfterEnterOrder

Deactivates the bot after an enter order has been completed.

  • DeactivateAfterEnterOrder([ positionCount ])

Returns true when the bot has been deactivated.

Return Type: Boolean

Parameter Name

Parameter Type

Required

Suggested

positionCount

Number

False

Input, Number, SessionGet

DeactivateAfterExitOrder

Deactivates the bot after an exit order has been completed.

  • DeactivateAfterExitOrder([ positionCount ])

Returns true when the bot has been deactivated.

Return Type: Boolean

Parameter Name

Parameter Type

Required

Suggested

positionCount

Number

False

Input, Number, SessionGet

DeactivateAfterXActiveMinutes

Deactivates the bot when the is active for a certain time.

  • DeactivateAfterXActiveMinutes(minutes)

Returns true when the bot has been deactivated.

Return Type: Boolean

Parameter Name

Parameter Type

Required

Suggested

minutes

Number

True

Input, Number, SessionGet

DeactivateAfterXIdleMinutes

Deactivates the bot if the last completed order is a number of minutes in the past. Timeout starts after the first completed order.

  • DeactivateAfterXIdleMinutes(minutes)

Returns true when the bot has been deactivated.

Return Type: Boolean

Parameter Name

Parameter Type

Required

Suggested

minutes

Number

True

Input, Number, SessionGet

DeactivateAfterXOrders

Deactivates the bot after a number of orders has been completed.

  • DeactivateAfterXOrders([ count ])

Returns true when the bot has been deactivated.

Return Type: Boolean

Parameter Name

Parameter Type

Required

Suggested

count

Number

False

Input, Number, SessionGet

DeactivateAfterXPositions

Deactivates the bot after a number of positions has been completed.

  • DeactivateAfterXPositions([ count ])

Returns true when the bot has been deactivated.

Return Type: Boolean

Parameter Name

Parameter Type

Required

Suggested

count

Number

False

Input, Number, SessionGet

DeactivateOnLoss

Deactivates the bot when there is no open position and the ROI based losses have reached a certain level.

  • DeactivateOnLoss(maxLoss)

Returns true when the bot has been deactivated.

Return Type: Boolean

Parameter Name

Parameter Type

Required

Suggested

maxLoss

Number

True

Input, Number, SessionGet

DeactivateOnProfit

Deactivates the bot when there is no open position and the ROI based profits have reached a certain level.

  • DeactivateOnProfit(minProfit)

Returns true when the bot has been deactivated.

Return Type: Boolean

Parameter Name

Parameter Type

Required

Suggested

minProfit

Number

True

Input, Number, SessionGet

DynamicStopLoss

Calculates the dynamic stop loss price and compares it with the current exit price.

  • DynamicStopLoss(percentage, [ depth ], [ positionId ], [ direction ])

Returns true is the stop loss price has been breached.

Return Type: Boolean

Parameter Name

Parameter Type

Required

Suggested

percentage

Number

True

Input, Number, SessionGet

depth

Number

False

Input, Number, SessionGet

positionId

String

False

Load

direction

Enum

False

PositionLong, PositionShort, NoPosition

DynamicTakeProfit

Calculates the dynamic take profit price and compares it with the current exit price.

  • DynamicTakeProfit(percentage, [ depth ], [ positionId ], [ direction ])

Returns true is the take profit price has been breached.

Return Type: Boolean

Parameter Name

Parameter Type

Required

Suggested

percentage

Number

True

Input, Number, SessionGet

depth

Number

False

Input, Number, SessionGet

positionId

String

False

Load

direction

Enum

False

PositionLong, PositionShort, NoPosition

GrowingTrailingStopLoss

Keeps track of the highest/lowest recorded price and adjust the stop loss accordingly. The higher the price change the more the trailing distances grows.

  • GrowingTrailingStopLoss(percentage, growPercentage, [ positionId ], [ direction ])

Returns true if the stop loss has been hit.

Return Type: Boolean

Parameter Name

Parameter Type

Required

Suggested

percentage

Number

True

Input, Number, SessionGet

growPercentage

Number

True

Input, Number, SessionGet

positionId

String

False

Load

direction

Enum

False

PositionLong, PositionShort, NoPosition

ShrinkingTrailingStopLoss

Keeps track of the highest/lowest recorded price and adjust the stop loss accordingly. The higher the price change the more the trailing distances shrinks.

  • ShrinkingTrailingStopLoss(percentage, shrinkPercentage, [ positionId ], [ direction ])

Returns true if the stop loss has been hit.

Return Type: Boolean

Parameter Name

Parameter Type

Required

Suggested

percentage

Number

True

Input, Number, SessionGet

shrinkPercentage

Number

True

Input, Number, SessionGet

positionId

String

False

Load

direction

Enum

False

PositionLong, PositionShort, NoPosition

StopLoss

Calculates the current percentage change from the average enter price and compares it with the stop loss value.

  • StopLoss(percentage, [ positionId ], [ direction ])

Returns true if the stop loss has been hit.

Return Type: Boolean

Parameter Name

Parameter Type

Required

Suggested

percentage

Number

True

Input, Number, SessionGet

positionId

String

False

Load

direction

Enum

False

PositionLong, PositionShort, NoPosition

StopLossROI

Calculates the defined position's current ROI percentage and gives a signal if the set loss is reached.

  • StopLossROI(percentage, [ positionId ], [ direction ])

Returns true if the stop loss has been hit.

Return Type: Boolean

Parameter Name

Parameter Type

Required

Suggested

percentage

Number

True

Input, Number, SessionGet

positionId

String

False

Load

direction

Enum

False

PositionLong, PositionShort, NoPosition

TakeProfit

Calculates the current percentage change from the average enter price and compares it with the take profit value.

  • TakeProfit(percentage, [ positionId ], [ direction ])

Returns true if the take profit has been reached.

Return Type: Boolean

Parameter Name

Parameter Type

Required

Suggested

percentage

Number

True

Input, Number, SessionGet

positionId

String

False

Load

direction

Enum

False

PositionLong, PositionShort, NoPosition

TakeProfitROI

Calculates the defined position's current ROI percentage and gives a signal if the set profit is reached.

  • TakeProfitROI(percentage, [ positionId ], [ direction ])

Returns true if the take profit has been reached.

Return Type: Boolean

Parameter Name

Parameter Type

Required

Suggested

percentage

Number

True

Input, Number, SessionGet

positionId

String

False

Load

direction

Enum

False

PositionLong, PositionShort, NoPosition

TrailingArmStopLoss

Keeps track of the highest/lowest recorded price and adjust the stop loss accordingly when the arm% has been reached.

  • TrailingArmStopLoss(percentage, arm, [ positionId ], [ direction ])

Returns true if the stop loss has been hit.

Return Type: Boolean

Parameter Name

Parameter Type

Required

Suggested

percentage

Number

True

Input, Number, SessionGet

arm

Number

True

Input, Number, SessionGet

positionId

String

False

Load

direction

Enum

False

PositionLong, PositionShort, NoPosition

TrailingStopLoss

Keeps track of the highest/lowest recorded price and adjust the stop loss accordingly.

  • TrailingStopLoss(percentage, [ positionId ], [ direction ])

Returns true if the stop loss has been hit.

Return Type: Boolean

Parameter Name

Parameter Type

Required

Suggested

percentage

Number

True

Input, Number, SessionGet

positionId

String

False

Load

direction

Enum

False

PositionLong, PositionShort, NoPosition

PreviousEasy InsurancesNextEquations

Last updated 4 years ago

Was this helpful?