The SIGNALAFTER function looks for a signal to occur but only after a previous signal has been met first.
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:
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:
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)
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:
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.