Tokens - SET statement

The SET command is used to set a variety of instrument/symbol properties. The format for setting a property in a scan, signal, or custom indicator, is:

SET(property, value)

The SET statement is commonly used in a scan to set the properties on all the symbols in the scans target (input) quotepage. SET is also used in trading system signals to manage targets and stops. The resulting "value" of the SET statement in the context of the scan, signal, or custom indicator, is TRUE (or 1 numerically). To reverse this meaning (to False or "0"), just use !SET

Below are some examples of common uses of the SET statement...

Setting User Variables (V# Variables) This is probably the most common use of the SET command. Learn more about V# variables. V# variables can be set for a variety of reasons. The following scan would set the user variable V#5 to the 105% of the current high for all the symbols in the scans target (input) quotepage.

SET(V#5, 1.05 * HI)

This scan would resulting in a quotepage containing all the symbol in the scans target quotepage, since SET always results in TRUE. If you'd rather your scan just run, perform it's "setting" of the symbols property, and not show you a resulting quotepage, use the syntax...

!SET(V#5, 1.05 * HI)

Setting Stops in Trading Systems The token STOP is used to maintain stops, or trailing stops in a trading system via the SET statement. The expression..

SET(STOP, LO - 1)

...will SET the STOP to $1 below the current low. STOP will be managed as a trailing stop, with the SET statement only resetting the STOP in the direction of the trade (only up for longs, only down for shorts). If the SET statement above were being used to manage a trailing stop on a long trade, the STOP would initially be set to the low of the entry bar minus $1. On each subsequent bar, the STOP would only change if "LO - 1" was greater than the current value of STOP. STOP would never decrease after initially being set on the first bar. It will only move(trail) in the direction of the trade.

Setting Alarms and Alarm Properties Alarm properties can be set for individual symbols by right-clicking on the symbol and choosing "Alarms", or going to "Setup: Alarms" in the main menu. However, the following uses of the SET statement can be used to set alarm properties for a whole quotepage of symbols at once.

To turn the high alarm on...

SET(MON, ALARM_GE)

To turn the high alarm off...

SET(MON, -ALARM_GE)

To turn the low alarm on or off, replace ALARM_GE with ALARM_LE. To turn the volume alarm on or off, replace ALARM_GE with ALARM_VOL. To turn the news alarm on or off, replace ALARM_GE with ALARM_NEWS. To turn off all alarms at once, use...

SET(MON, ALARM_OFF)

To set the high alarm price level (in this case, to the current high + $2)...

SET(HIALARM, HI + 2)

To set the low alarm price level, replace HIALARM with LOALARM. To set the volume alarm level, replace HIALARM with VOLALARM. To set the high alarm step value, use...

SET(HISTEP, CL * 0.01)

Similarly, use LOSTEP to set the low alarm step, and VOLSTEP to set the volume alarm step. To clear/reset all triggered alarms, use...

SET(MON, ALARM_RESET)

To clear only the high alarms, use ALARM_RESET_HI in place of ALARM_RESET. To clear only low alarms, use ALARM_RESET_LO. To clear only volume alarms use ALARM_RESET_VOL. To turn on the "Maintain Hi-Lo Alarm Spread when Stepping" option of alarms, use...

SET(MON, ALARM_SPREAD)

More uses...

SET(MON, -FLAG_HILITE)

SET(COLOR, COLOR_LTBLUE)

SET(FLAG, FLAG_HILITE)

SET(USERDATA, CLEAR)

SET(SESSION,31)

SET(HRI, 5)

SET(HRD, 500)

SET(MON, MON_INTRA)

SET(MON, -MON_INTRA)