SIGNALAFTER() Function

Author: Optuma Team Last updated: Jul 10, 2020 13:32

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);<br></br>S2 = MA(BARS=20, CALC=Close) TurnsDown;<br></br><br></br>SIGNALAFTER(S1,S2)

Shown here with the green Show Bar arrows:

AIMEB3z4wU

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;<br></br>S1A = TIMESINCESIGNAL(S1) S2 = DD() == 3;<br></br>S1A == 1 and SIGNALAFTER(S1, S2)

aER1l4lddZ

Including the Same Bar

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

Capture

Example:

Ex3 (1)

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.