Skip to content

SIGNALAFTER() Function

By Optuma Team · Updated 2024-03-08

The SIGNALAFTER() function looks for a signal to occur but only after a previous signal has been met first.

SIGNALAFTER(Signal1, Signal2)

For example, to show when the 20 period moving average turns down after a new 6 month high you would use the following:

S1 = HIGH() > HIGHESTHIGH(BACKTYPE=Months, BARS=6, INCBAR=False);
S2 = MA(BARS=20, CALC=Close) TurnsDown;
SIGNALAFTER(S1,S2)

Shown here with the green Show Bar arrows:

Show Bar Arrows

The Signal Number property will show the number of second signals after the first. In the above example the following will show where the 20MA turns down a second time after a new 6 month high:

SIGNALAFTER(S1,S2, NUMBER=2)

Another example showing where 3 consecutive up days (using the DU() function) are immediately followed by 3 consecutive down days:

S1 = DU() == 3;
S1A = TIMESINCESIGNAL(S1) S2 = DD() == 3;
S1A == 1 and SIGNALAFTER(S1, S2)

Show Bar Arrows

If you want to include when the signals appear on the same day then you can select the Same Bar option:

Include same bar

Example

The Blue show view has been setup to include instances where the 2 criteria occur on the same bar, the Black show view excludes these instances.

Choose which categories of cookies you allow. Strictly-necessary cookies are always on. You can change this any time via the "Cookie Settings" link in the footer.

  • Functional

    Remember preferences like dismissed banners and your dark-mode choice.

  • Analytics

    Help us understand how the site is used so we can improve it.

  • Marketing

    Measure our advertising and help us reach people who may be interested in Optuma.