Choose Next expiry based on condition

I would like to use Next weekly expiry on Wednesday and Thursdays. How to use this.

Condition 1: For Wednesday & Thursday for a future signal choose Next week Expiry ATM

Condition 2: Already position created on current expiry and on Wednesday after 2:00PM switch position to next week expiry.

There are two ways. 1st suing Week Day: Keyword

Week Day returns Day of the week as an integer as 1 for Monday, 2 for Tuesday and so on till 5 as Friday

The above condition will be satisfied if today is Monday

The weekday keyword is very useful for users who want to trade only on particular days of the week. You can create multiple sets such that each set is active only on that particular day

The above condition will be satisfied on all the days except Monday

Number range is from 1- 5 …

But this FAILs when expiry is on Wednesday if Thrusday is holiday.
so you can use Current Week Expiry keyword.

Current Week Expiry:

This keyword returns the current weekly expiry date of the instrument as a string in the format YYYY-MM-DD

Please make sure not to use stocks in this as they don’t have weekly expiries.

This keyword can be used in condition builder as well as expiry FX in position builder

The above example can be used in condition builder to check if current day is weekly expiry

The above condition can be used in the expiry FX of the position builder to trade next week expiry