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
  • AbsolutePriceChange
  • NeverEnterWithALoss
  • NeverExitWithLoss
  • OvercomeDoubleFeeCosts
  • OvercomeFeeCosts
  • PercentagePriceChange
  • StopLossCooldown
  • TradeOncePerBar
  • TradeOnlySideways
  • TradeOnlyTrending
  • WaitAfterTrade

Was this helpful?

  1. HaasScript
  2. Commands

Easy Insurances

AbsolutePriceChange

Compares the average entry price to current price, absolute value-based.

  • AbsolutePriceChange([ amount ], [ targetPrice ], [ positionId ])

Returns true if the minimum price change percentage is reached.

Return Type: Boolean

Parameter Name

Parameter Type

Required

Suggested

amount

Number

False

Input, Number, SessionGet

targetPrice

Number

False

Input, Number, SessionGet

positionId

String

False

Load

NeverEnterWithALoss

Blocks enter trade when targetPrice is above the last sell order. Only works on spot and when there is no position open.

  • NeverEnterWithALoss([ acceptedLoss ], [ targetPrice ])

Returns true if the trade is allowed.

Return Type: Boolean

Parameter Name

Parameter Type

Required

Suggested

acceptedLoss

Number

False

Input, Number, SessionGet

targetPrice

Number

False

Input, Number, SessionGet

NeverExitWithLoss

Compares the average enter price to the targetPrice or current price.

  • NeverExitWithLoss([ acceptedLoss ], [ targetPrice ], [ positionId ])

Returns true if the trade is allowed.

Return Type: Boolean

Parameter Name

Parameter Type

Required

Suggested

acceptedLoss

Number

False

Input, Number, SessionGet

targetPrice

Number

False

Input, Number, SessionGet

positionId

String

False

Load

OvercomeDoubleFeeCosts

Calculates the target profit and makes sure the fee costs are double-covered.

  • OvercomeDoubleFeeCosts([ targetPrice ], [ positionId ])

Returns true if the trade profit is enough to cover double the fees.

Return Type: Boolean

Parameter Name

Parameter Type

Required

Suggested

targetPrice

Number

False

Input, Number, SessionGet

positionId

String

False

Load

OvercomeFeeCosts

Calculates the target profit and makes sure the fee costs are covered.

  • OvercomeFeeCosts([ targetPrice ], [ positionId ])

Returns true if the trade profit is enough to cover the fees.

Return Type: Boolean

Parameter Name

Parameter Type

Required

Suggested

targetPrice

Number

False

Input, Number, SessionGet

positionId

String

False

Load

PercentagePriceChange

Compares the average enter price to current price, percentage-based.

  • PercentagePriceChange([ percentage ], [ targetPrice ], [ positionId ])

Returns true if the minimum price change percentage is reached.

Return Type: Boolean

Parameter Name

Parameter Type

Required

Suggested

percentage

Number

False

Input, Number, SessionGet

targetPrice

Number

False

Input, Number, SessionGet

positionId

String

False

Load

StopLossCooldown

Blocks any signal until a certain number of minutes have passed since the last exit trade executed by a safety.

  • StopLossCooldown(minutes, [ positionId ])

Returns true when the last trade is a certain number of minutes ago.

Return Type: Boolean

Parameter Name

Parameter Type

Required

Suggested

minutes

Number

True

Input, Number, SessionGet

positionId

String

False

Load

TradeOncePerBar

Only allows a trade to occur once per bar. Signals produced during a traded bar are blocked.

  • TradeOncePerBar([ interval ], [ positionId ])

Returns true when new bar opens or no trade occured during a bar.

Return Type: Boolean

Parameter Name

Parameter Type

Required

Suggested

interval

Number

False

Input, Number, SessionGet

positionId

String

False

Load

TradeOnlySideways

Checks the current market condition for sideways movement.

  • TradeOnlySideways([ threshold ], [ interval ], [ fullCandles ], [ market ])

Returns true if the trade is allowed.

Return Type: Boolean

Parameter Name

Parameter Type

Required

Suggested

threshold

Number

False

Input, Number, SessionGet

interval

Number

False

InputInterval, Number, CurrentInterval

fullCandles

Boolean

False

True, False

market

String

False

InputAccountMarket, InputMarket, InputPriceSourceMarket, PriceMarket

TradeOnlyTrending

Checks the current market condition for a trend.

  • TradeOnlyTrending([ threshold ], [ interval ], [ fullCandles ], [ market ])

Returns true if the trade is allowed.

Return Type: Boolean

Parameter Name

Parameter Type

Required

Suggested

threshold

Number

False

Input, Number, SessionGet

interval

Number

False

InputInterval, Number, CurrentInterval

fullCandles

Boolean

False

True, False

market

String

False

InputAccountMarket, InputMarket, InputPriceSourceMarket, PriceMarket

WaitAfterTrade

Blocks any signal until a certain number of minutes have passed since the last trade.

  • WaitAfterTrade(timeout, [ positionId ])

Returns true when the last trade is a certain number of minutes ago.

Return Type: Boolean

Parameter Name

Parameter Type

Required

Suggested

timeout

Number

True

Input, Number, SessionGet

positionId

String

False

Load

PreviousEasy IndicatorsNextEasy Safeties

Last updated 4 years ago

Was this helpful?