Hy there,
I would appreciate if someone can help me with the following TimeFrame issue. I already read “ Multiple time Frame support “ , “ time compression of data Retrieved from another symbol”, the Time frame related formulas and Tedbundy book.
The problem I have is that when I Set Timeframe (in weekly) and expand the Compressed array to use it in the Chart, or the exploration or the system code , the value of the array compressed in the dayly periodicity does not match the value of the array in the weekly periodicity.
I did the check with the following code.
_SECTION_BEGIN("RSC Mansfield FIJO EXPANDED");
TimeFrameSet(inWeekly);
//creado por Mansfield LTD y modificado por JA en 2010
//calculo de RSC Mansfield en comparacion con S&P500
period=52;
Cociente=C/Foreign("^GSPC","C");
CountR=Sum(Cociente,period);
Baseprice=CountR/period;
RSC=((Cociente/Baseprice)-1)*10;
TimeFrameRestore();
RSCweek=TimeFrameExpand(RSC,inWeekly,expandLast);
//escogemos la forma de representacion y estilos
SetGradientFill(colorGreen/*top*/,colorRed/*bottom*/,0/*baseline level*/,GetChartBkColor()/*baseline color*/);
//mostramos en pantalla la variable RSC que contiene el RSC de Mansfield
Plot(RSCweek,"RSCMansfield vs S&P500---FIJO SEMANAL EXpanded", colorLightOrange, styleLine | styleGradient);
_SECTION_END();
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
_SECTION_BEGIN("RSC Mansfield FIJO");
TimeFrameSet(inWeekly);
//creado por Mansfield LTD y modificado por JA en 2010
//calculo de RSC Mansfield en comparacion con S&P500
period=52;
Cociente=C/Foreign("^GSPC","C");
CountR=Sum(Cociente,period);
Baseprice=CountR/period;
RSCweeknot=((Cociente/Baseprice)-1)*10;
TimeFrameRestore();
//escogemos la forma de representacion y estilos
SetGradientFill(colorGreen/*top*/,colorRed/*bottom*/,0/*baseline level*/,GetChartBkColor()/*baseline color*/);
//mostramos en pantalla la variable RSC que contiene el RSC de Mansfield
Plot(RSCweeknot,"RSCMansfield vs S&P500---FIJO SEMANAL ", colorLightOrange, styleLine | styleGradient);
_SECTION_END();
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
_SECTION_BEGIN("RSC Mansfield normal");
//creado por Mansfield LTD y modificado por JA en 2010
//calculo de RSC Mansfield en comparacion con S&P500
period=Param("Periodo",52,1,500,1);
rsSymbol=ParamStr("Base Index Symbol","^GSPC");
Cociente=C/Foreign(rsSymbol,"C");
CountR=Sum(Cociente,period);
Baseprice=CountR/period;
RSCnormal=((Cociente/Baseprice)-1)*10;
//escogemos la forma de representacion y estilos
SetGradientFill(colorGreen/*top*/,colorRed/*bottom*/,0/*baseline level*/,GetChartBkColor()/*baseline color*/);
//mostramos en pantalla la variable RSC que contiene el RSC de Mansfield
Plot(RSCnormal,"RSCMansfield vs S&P500---FIJO SEMANAL ", colorLightOrange, styleLine | styleGradient);
_SECTION_END();
Filter=1;
AddColumn(RSCweek,"RSCWeekExpanded",1.2);
AddColumn(RSCweekNot,"RSCWeekNotExpanded",1.2);
AddColumn(RSCnormal,"RSC",1.2);
AddColumn(DayOfWeek(),"DayOfWeek",1.2);
As yo can see in the code there are three indicators. The three are calculated the same way but:
In one of them I expanded the compressed array
In the other one I did not expand the compressed array
And in the third one I did not use the timeframe set function.
Then I apply the exploration in weekly periodicity to a symbol( in this case Argenx).
As a result the Three indicators gave me the same value, which is ok and is what I expected.
However when I apply the exploration in a daily Peridicity I see the following:
I am not worried about the Not expanded data column because I know is wrong( I do not know what is computing but I do not care) . the column labeled RSC is doing it right , the problem is the column with the expended array.
The values for the day 26/06 , 29/06 to 02/07 should be the values that the exploration run on the weekly peridicty for the week of 26/06 ; thus should be 5,01 instead of 4,89. It looks like if the compressed value is not properly computed.
However I do the same exercise with the code or a Simple moving average of 3, and everything matches and looks OK.
Any idea or Help. Please