Plot Spread in AMIbroker

Hi,

How can I plot a spread chart (Iine or candlestick) between 2 indices

eg nifty and bank nifty

Based on the spread than I need to trade both indices up or down

Thanks

To create a spread chart in amibroker you can use "Foreign" function.

go to Amibroker

Analysis -> Formula Editor
then enter the below formula:

spread = Foreign( "ticker1", "C") - Foreign( "ticker2", "C");
Plot( spread, "spread", colorRed); 

add your two scripts in ticker1 and ticker2

WHAT STUPID CODE.Nonsense.It is neither working or executing.