Yes sir, you can achieve this using AlgoDelta's JSON Bridge or Custom Bridge. Below are the steps to configure the Custom Bridge for your requirement.
-Step 1: Create and Configure the Custom Bridge
Create a Custom Bridge in AlgoDelta and configure the UP-side and DOWN-side executions according to your option trading strategy.
-Step 2: Configure the UP-Side Execution
Configure the UP-side execution to Buy a NIFTY ATM Call (CE), as shown below.

-Step 3: Configure the DOWN-Side Execution
Configure the DOWN-side execution to Buy a NIFTY ATM Put (PE), as shown below.

-Step 4: Enable Exit on Opposite Signal
Enable the Exit on Opposite Signal option in the Custom Bridge configuration.
When an opposite signal arrives, the existing position is squared off according to the bridge configuration, and the new opposite-side position is entered.
-Step 5: Connect Your Signal Source
Connect the Custom Bridge to your signal source, such as TradingView alerts or your Python code, and configure it to send the appropriate UP and DOWN signals.
Now the flow will be:
BUY signal -> Buy NIFTY ATM CE
SELL signal -> Exit the existing CE position and Buy NIFTY ATM PE
BUY signal again -> Exit the existing PE position and Buy NIFTY ATM CE
This way, you can configure your strategy to exit the existing option position when an opposite signal arrives before entering the new position.