Signal Handling
Last updated
Last updated
Signals constants are a big part of your script when you are using easy indicators. It's important to know how we can manage and properly change them. This page will cover the signal features from an easy indicator output to trade execution.
All the information here applies for both the script and visual editor
HaasScript has 4 different signal values.
SignalLong / SignalBuy
Both are the same value. SignalBuy is a synonym for SignalLong.
SignalShort / SignalSell
Both are the same value. SignalSell is a synonym for SignalShort.
SignalExitPosition
On spot this will equal SignalShort. On margin and leverage it means exit any position direction.
SignalNone
This is, for example, the result of the EasyRSI when the RSI is between the buy and sell levels.
All signal constants have a few hidden properties you can't see, but can control. The properties are the signal weight and values which tell another command when to use the signal and not use the signal for a final decision.
The signal weight can be set by 2 commands. SignalWeight and SignalProperties. The weight is used by the GetWeightedConsensusSignal to create a final signal from multiple sources.
The other properties are for when to use or not use the signal. By default, the signal is used for every decision direction but if the settings are set to false they will be excluded. When for example the script has 3 indicators, a BBands, MACD, and RSI. When the 'useShort' of the RSI is unchecked and we connect all indicators result to a GetUnanimousSignal command, only the BBands & MACD have to signal short for a final short decision. But for a final long signal, all 3 need to agree.
The SingalProperties functionality is also available in separate commands.
The output of an Easy Indicator might be perfect when reversed or only usable if we change the output type for a specific direction. 3 commands in the Signal Helper category gives that control.
With the SignalMapper we can reverse and map specific signals.
With the ReverseSignal you can reverse a signal. SignalLong becomes SignalShort and SignalShort will become SignalLong. Other values wont change.
ConvertSignal (or MapSignal) will change a specific signal when it matches the defined one.
There are 3 ways to merge multiple signals into a final signal. GetUnanimousSignal, GetCrossOverUnderSignal & GetWeightedConsensusSignal. All 3 are located in the Signal Helper category.
Returns SignalLong when there is a unanimous decision across all signal (excludes the ones who are set to be ignored on long) to long and SignalShort when all the relevant signals agree on short. Any other combination will result in SignalNone
Will count the number of signals agreeing on aside. When there is a majority (>50%) agreeing on a direction that signal will be returned.
Sums the signals multiplied by their weight. When a direction has reached the threshold and no other direction has, it will be returned. When there are 2 or more directions who reached their threshold, SignalNone is returned.
Executing a final signal can be done with one of 2 commands. DoSignal takes a signal value and executes DoLong, DoShort or DoExitPosition when the signal is SignalLong, SignalShort or SignalExitPostion.
The TradeBotContainer() will execute DoSignals if the insurances are not blocking the trade.
Dont use both DoSignal and TradeBotContainer in the same script unless there are specific conditions to do so.