Foreign symbol, Multi timeframe, MACD

Hi Experts,
Say, Chart time interval is 15m and it is showing symbol_B. Following is a snippet which I use for finding the MACD of a index (let us call it symbol_A) in hourly time frame.

SetForeign (ix_sym);
	C1_hourly_comp = C;
	macd_ix_comp = MACD( 12, 26 );
	sg_ix_comp = Signal( 12, 26, 9 );
RestorePriceArrays ();

macd_ix = TimeFrameExpand(macd_ix_comp, inHourly);
sg_ix = TimeFrameExpand (sg_ix_comp, inHourly);

I print the indicator values in title as shown below..


When I see the MACD of the Index symbol (Symbol_A) directly using a hourly chart, I see the following..


As you can notice, there is difference in values of macd and signal.

What am I missing ? Thanks for any pointers.

Carefully read about expansion modes:

Default mode is expandLast.

Hi @fxshrat,

I noticed some thing. In the 15m chart, if I change the symbol to say Symbol_D, I am seeing that indicator values are fine.

Difference between the symbol_B and Symbol_D is that, symbol_B is a weekly option symbol whereas Symbol_D is a continuous future symbol. In case of option symbol, there could be no or hardly some data for previous weeks. Can this have any impact on the calculations ? My thinking is once SetForeign is called, it would completely change all the values of an array (with that of foreign symbol) ? If there are any holes in the values of chart symbol (in this case symbol_B), how would it behave ?

Thank you for the help.

This topic was automatically closed 100 days after the last reply. New replies are no longer allowed.