There is no blanket solution for this. You need to provide all the details before we can provide a solution. This cannot be done through any user settings. It must be written directly into the code and the method to accomplish this is going to be unique to every set of conditions you want to use.
Since you did not include any details at all the best I can offer is a very generic example:
def conditionOne = close > open;
def conditionTwo = close < open;
plot trigger = conditionOne within 10 bars ago and conditionTwo;
Notice there is no "chronological" component to this solution. Your question title was updated to correctly describe the context of your request.