Skip to content

Signal Handling

Signal constants are central to any script that uses easy indicators. This page covers everything from signal values and properties to combining multiple signals and executing trades. All information applies to both the Script Editor and Visual Editor.

Constants

HaasScript has 9 unique signal values.

  • SignalLong / SignalBuy — Synonyms for the same value.
  • SignalShort / SignalSell — Synonyms for the same value.
  • SignalExitPosition — Equal to SignalSell in spot markets. On margin and leverage, exits any position direction.
  • SignalExitLong — Also equal to SignalSell in spot markets. On margin and leverage, signals a long exit only.
  • SignalExitShort — Not supported in spot markets. On margin and leverage, signals a short exit only.
  • SignalNone — Returned by e.g. EasyRSI when RSI sits between buy and sell levels.
  • SignalError — Triggers an error in signal execution.
  • SignalReservedA / SignalReservedB — Reserved for use with Remote Signals or custom actions.

Signal Properties

Every signal constant carries a few properties that control how it's used in final decisions.

Property Description
useLong Include in (true) or exclude from (false) buy/long decisions.
useShort Include in or exclude from sell/short decisions.
useExit Include in or exclude from exit decisions.
weight The signal's influence in a weighted consensus.
delay Minutes to delay the signal before it's processed.

Signal Weight

Set a signal's weight with SignalWeight() or SignalProperties(). The weight is consumed by GetWeightedConsensusSignal() to calculate a final signal from multiple sources.

Directional Filters

These properties control which trade directions the indicator's signal applies to. By default, all directions are enabled. When a direction is disabled (false), the indicator's signal is excluded from that decision.

For example, with a script using BBands, MACD, and RSI: if the RSI's useShort is unchecked and all three feed into a GetUnanimousSignal command, only BBands and MACD need to agree for a short signal. But for a long signal, all three must agree.

Signal Actions

The same behaviour that SignalProperties() provides is also available as individual commands — see the reference section for SignalWeight(), DelaySignal(), IgnoreSignalIf(), and UseSignalIf().

Changing Signals

An easy indicator's output isn't always what you need. You might want to reverse it, map a specific value to another, or convert it only when it matches a condition. Three commands handle this:

SignalMapper

SignalMapper() lets you reverse a signal and remap any combination of its values.

SignalMapper(signal, [reverse], [mapLongTo], [mapShortTo], [mapExitTo], [mapNoneTo])

ReverseSignal

ReverseSignal() swaps SignalLongSignalShort. Other values (SignalNone, SignalExitPosition, etc.) pass through unchanged.

ConvertSignal / MapSignal

ConvertSignal() (aliased as MapSignal) converts a signal only when it matches a specific value. If the original signal doesn't match, it stays as-is.

Merging Multiple Signals

When you have multiple indicators, you need a way to combine their signals into a single decision. Three commands handle this:

GetUnanimousSignal

Returns SignalLong only when all relevant signals agree on long, and SignalShort only when all agree on short (signals with useLong/useShort disabled are excluded). Any other combination returns SignalNone.

GetConsensusSignal

Counts how many signals agree on each side. Whichever direction has a majority (>50%) wins. If there's no majority, SignalNone is returned.

GetWeightedConsensusSignal

Each signal is multiplied by its weight, then summed per direction. If one direction reaches its threshold and no other does, that signal wins. If two or more directions hit their thresholds, SignalNone is returned to avoid conflicting decisions.

Executing The Signal

Once you have a final signal, execute it with one of two commands:

  • DoSignal() — Takes a signal value and calls DoLong(), DoShort(), or DoExitPosition() depending on whether the signal is SignalLong, SignalShort, or SignalExitPosition.
  • TradeBotContainer() — Also calls DoSignal() internally, but only if the script's insurance checks don't block the trade.

Warning

Don't use both DoSignal and TradeBotContainer in the same script unless you have specific conditions that require it.