Hedging in Amibroker

I am running a long only strategy of stocks and i want to add hedging to it. I want to hedge same amount of what i am long in stocks. So if i open long position in 5 stocks each with x amount of dollars, then i want to hedge 5x amount in the index. Basically i want to hedge total long exposure and keep myself delta neutral.I am not asking for exact code but just an understanding of how to go about doing it?

I don’t believe there’s any way to achieve this other than via a Custom Backtest (CBT) procedure. Here’s a place to start: https://www.amibroker.com/guide/a_custombacktest.html.

Thanks for informing about CBT. Would like if you could give an example on to approach this hedging issue.