Skip to content

description: "Craft profitable crypto trading bots with HaasOnline's "Easy Insurances" commands. Protect positions, overcome fees, and manage risk with AbsolutePriceChange..."

Easy Insurances

AbsolutePriceChange

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

Syntax: AbsolutePriceChange([ amount ], [ targetPrice ], [ positionId ])

Returns true if the minimum price change percentage is reached.

Return type: Boolean

Parameter Name Parameter Type Required Suggestions
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.

Syntax: NeverEnterWithALoss([ acceptedLoss ], [ targetPrice ])

Returns true if the trade is allowed.

Return type: Boolean

Parameter Name Parameter Type Required Suggestions
acceptedLoss Number False Input,Number,SessionGet
targetPrice Number False Input,Number,SessionGet

NeverExitWithLoss

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

Syntax: NeverExitWithLoss([ acceptedLoss ], [ targetPrice ], [ positionId ])

Returns true if the trade is allowed.

Return type: Boolean

Parameter Name Parameter Type Required Suggestions
acceptedLoss Number False Input,Number,SessionGet
targetPrice Number False Input,Number,SessionGet
positionId String False Load

OrderOncePerBar

Only allows an order to occur once per bar. Signals produced during an ordered bar are blocked.

Syntax: OrderOncePerBar([ interval ], [ positionId ])

Returns true when new bar opens or no orders occurred during a bar.

Return type: Boolean

Parameter Name Parameter Type Required Suggestions
interval Number False Input,Number,SessionGet
positionId String False Load

OvercomeDoubleFeeCosts

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

Syntax: OvercomeDoubleFeeCosts([ targetPrice ], [ positionId ])

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

Return type: Boolean

Parameter Name Parameter Type Required Suggestions
targetPrice Number False Input,Number,SessionGet
positionId String False Load

OvercomeFeeCosts

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

Syntax: OvercomeFeeCosts([ targetPrice ], [ positionId ])

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

Return type: Boolean

Parameter Name Parameter Type Required Suggestions
targetPrice Number False Input,Number,SessionGet
positionId String False Load

PercentagePriceChange

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

Syntax: PercentagePriceChange([ percentage ], [ targetPrice ], [ positionId ])

Returns true if the minimum price change percentage is reached.

Return type: Boolean

Parameter Name Parameter Type Required Suggestions
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.

Syntax: StopLossCooldown(minutes, [ positionId ])

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

Return type: Boolean

Parameter Name Parameter Type Required Suggestions
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.

Syntax: TradeOncePerBar([ interval ], [ positionId ])

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

Return type: Boolean

Parameter Name Parameter Type Required Suggestions
interval Number False Input,Number,SessionGet
positionId String False Load

TradeOnlySideways

Checks the current market condition for sideways movement.

Syntax: TradeOnlySideways([ threshold ], [ interval ], [ fullCandles ], [ market ])

Returns true if the trade is allowed.

Return type: Boolean

Parameter Name Parameter Type Required Suggestions
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.

Syntax: TradeOnlyTrending([ threshold ], [ interval ], [ fullCandles ], [ market ])

Returns true if the trade is allowed.

Return type: Boolean

Parameter Name Parameter Type Required Suggestions
threshold Number False Input,Number,SessionGet
interval Number False InputInterval,Number,CurrentInterval
fullCandles Boolean False True,False
market String False InputAccountMarket,InputMarket,InputPriceSourceMarket,PriceMarket

WaitAfterOrder

Blocks any signal until a certain number of minutes have passed since the last placed order. This includes orders executed in an update cycle

Syntax: WaitAfterOrder(timeout, [ positionId ])

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

Return type: Boolean

Parameter Name Parameter Type Required Suggestions
timeout Number True Input,Number,SessionGet
positionId String False Load

WaitAfterTrade

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

Syntax: WaitAfterTrade(timeout, [ positionId ])

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

Return type: Boolean

Parameter Name Parameter Type Required Suggestions
timeout Number True Input,Number,SessionGet
positionId String False Load