How to set a "flag" for an action

How do I set a “flag” for when an action happens, so that i can then use the flag in conjunction with another action to place a trade. For example, if i want an indicator to cross above 200 and then sometime later cross below 100 for a trade to take place. If the indicator has not crossed above 200 but crosses below 100 there would be not trade.

Use a bool that remembers the first event:

if (CrossAbove(ind, 200, 1)) armed = true;

if (armed && CrossBelow(ind, 100, 1)) { EnterShort(); armed = false; }

Declare ‘private bool armed;’ at class level so it keeps its value between bars. In the Strategy Builder it’s the same idea: add a bool user variable on the Inputs and variables page, one condition set that sets it to true on the cross above 200, and a second that requires it to be true plus the cross below 100, then enters and resets it to false. Decide whether it should also reset each session. Happy to help further, feel free to DM me.