Hold function until condition

Trying to come up with a equivalent of the Hold function but instead of periods until another expression is true.

How can I propagate a true value in a array until another condition is met.

// For example, for a bounce trade today
conditions_to_trade_today =  is_current_price_below_past_20_day_low AND is_low_4_days_ago;

// Once those conditions are met, I want to hold that for the rest of the session
// Periods up to the end of the session are  unknown, so I cannot calculate them, but I have a condition once the first bar in after hours is found.
trade_allowed = Hold(conditions_to_trade_today, regular_session_ended)

Any idea how to write this, please? I know the combination is there somehow with all the functions, but I cannot come up with it.

Just use Flip() function

trade_allowed = Flip(conditions_to_trade_today, regular_session_ended);


1 Like

This topic was automatically closed 100 days after the last reply. New replies are no longer allowed.