Trading a stock with the price of another stock as an indicator

Say we have a stock, that is +ve ly correlated with another index/stock, eg, if Singapore Nifty Futures SGX goes up, our nifty goes up as well as soon as the market opens (Singapore SGX nifty trades early in the morning and is used as an indicator for Nifty). I want to write a script to reference whether Singapore SGX Nifty is up, and based on that put long/short orders on Nifty Call Options. Is there a way to write this script? I want to backtest it.

If this query is regarding Tradescript on Zerodha Pi, it wont be possible.

But with Amibroker everything is possible