TickSize changes after SetForeign()

TickSize value is changing. Is this normal?

SetForeign("CBOE", True, true);

You are calling SetForeign - so you say: “Hey AmIBroker change the SYMBOL TO CBOE and get ALL data from it OHLCV and TickSize too!” And program is doing what you told it to do. It gets new TickSize as entered in CBOE symbol information window.

But I am also doing a RestorePriceArrays(true), should it not set it back?

No, because RestorePriceArrays is restoring PRICE arrays (as name says). The only case when you should call SetForeign with 2nd and 3rd parameter set to NON-default values is when you are using backtester-in-a-box legacy function Equity.

The fundamental mistake that you are doing is that you are using SetForeign as it would be used for backtest. Generally it is NOT the case. Backtest is run on current symbol*, not on foreign symbol.
If you want to backtest CBOE you should run your backtest on CBOE, not on other symbol. SetForeign does NOT change the symbol for backtest.
The only exception is legacy backtester-in-a-box Equity() function that does old, single-symbol backtest in place of the call. But other than that backtest is always done on current symbol (or group/portfolio of symbols selected in the “Apply To:” selection.