Hi @varun,
You may encounter margin errors if you execute hedges and sell legs simultaneously. To benefit from margin advantages, you should first buy hedges and then execute sell legs. When exiting, you should first exit sell legs and then buy legs.
In AlgoTest, To get margin benefits, you can delay the execution of sell legs by a few seconds, you can utilize the "delay entry by" feature in the execution settings of your strategy. The execution settings can be found on the right side of your strategy name in live trade page under the "strategies" button. By default, the algorithm will send sell orders before buy orders when exiting.