Multi time frame exploration of individual security using date rage

Hi,
For around an year I have been using multi time frame explorations, with some help from members of this forum, thanks for the help.

This instance the cry for help is for an RSI exploration, periodicity is set to hourly, the exploration is for weekly, daily and hourly time frames. Below is the code:

_SECTION_BEGIN("MT RSI");

Filter=1;
//RSI BEGIN
TimeFrameSet(inWeekly);
tr =IIf(RSI(14)>60,colorGreen,IIf(RSI(14)<40,colorRed,IIf(RSI(14)<60 AND RSI(14)>40 ,colorTan,colorBlack)));
AddColumn(RSI(14),"RSI WLY",1.2,colorDefault ,   tr,75);
TimeFrameRestore();

//RSI DAILY
TimeFrameSet(inDaily);
tr =IIf(RSI(14)>60,colorGreen,IIf(RSI(14)<40,colorRed,IIf(RSI(14)<60 AND RSI(14)>40 ,colorTan,colorBlack)));
AddColumn(RSI(14),"RSI DLY",1.2,colorDefault ,   tr,75);
TimeFrameRestore();

//HOURLY RSI
TimeFrameSet(inHourly);
tr =IIf(RSI(14)>60,colorGreen,IIf(RSI(14)<40,colorRed,IIf(RSI(14)<60 AND RSI(14)>40 ,colorTan,colorBlack)));
AddColumn(RSI(14),"RSI Hly",1.2,colorDefault ,   tr);
TimeFrameRestore();

///////// END RSI///////////////

_SECTION_END();

When I run this exploration on a watchlist using "1 recent bar" there is no problem, works OK. Screen capture below:

image

However when run on an individual security, "Current" with "from-To dates", the results are incorrect.
The exploration is for a standard , 14, period setting of the RSI, hence values for the daily RSI should start showing from the 15th day onwards and for weekly 15th week onwards.

But this does not happen, selected date range is 01/04/20 to 19/02/21, the first value for the daily RSI shows on 30/12/20 - after nearly 9 months and only on 1/02/21 for the weekly, screen shots below:

image

image

Request help to get the values at the correct, after 15 days / weeks as the period of the RSI is 14.

Thanks.

You should use TimeFrameExpand so the Daily and Weekly arrays are properly expanded to hourly.
A simple modification in below code:
Make sure to run periodicity in Settings as HOURLY

_SECTION_BEGIN("MT RSI");

//HOURLY RSI
//TimeFrameSet(inHourly);
hrs = RSI(14);
htr =IIf(hrs>60,colorGreen,IIf(hrs<40,colorRed,IIf(hrs<60 AND hrs>40 ,colorTan,colorBlack)));

//TimeFrameRestore();

//RSI BEGIN
TimeFrameSet(inWeekly);
wrs = RSI(14);
wtr =IIf(wrs>60,colorGreen,IIf(wrs<40,colorRed,IIf(wrs<60 AND wrs>40 ,colorTan,colorBlack)));
TimeFrameRestore();

//RSI DAILY
TimeFrameSet(inDaily);
drs = RSI(14);
dtr =IIf(drs>60,colorGreen,IIf(drs<40,colorRed,IIf(drs<60 AND drs>40 ,colorTan,colorBlack)));
TimeFrameRestore();

AddColumn( TimeFrameExpand( wrs, inWeekly),"RSI WLY",1.2,colorDefault, wtr,75);
AddColumn( TimeFrameExpand( drs, inDaily),"RSI DLY",1.2,colorDefault, dtr,75);
AddColumn( hrs,"RSI Hly",1.2,colorDefault , htr);

///////// END RSI///////////////

Filter=1;

_SECTION_END();
1 Like

@nsm51,

Thanks, tried it and have the following observation, tough the RSI values start showing, the color conditions do not, for daily, till 30/12/20 all readings have a bkgndcolor of a grey shade and after that the colour is not as specified in the code, eg >60, colorgreen - but as you may observe in the screen shot >60 shows all colors - green/tan and red.

image

Kindly advise.\regards and thanks.

Because the correction by @nsm51 is still not correct.
Your color variables are arrays also and they depend on the multi time frame RSIs. So you just need to call the expanded indicator variables.

_SECTION_BEGIN("MT RSI");

//HOURLY RSI
//TimeFrameSet(inHourly);
hrs = RSI(14);
//TimeFrameRestore();

//RSI BEGIN
TimeFrameSet(inWeekly);
wrs = RSI(14);
TimeFrameRestore();

//RSI DAILY
TimeFrameSet(inDaily);
drs = RSI(14);
TimeFrameRestore();

dtr = TimeFrameExpand( drs, inDaily);
wrs = TimeFrameExpand( wrs, inWeekly);

htr =IIf(hrs>60,colorGreen,IIf(hrs<40,colorRed,IIf(hrs<60 AND hrs>40 ,colorTan,colorBlack)));
wtr =IIf(wrs>60,colorGreen,IIf(wrs<40,colorRed,IIf(wrs<60 AND wrs>40 ,colorTan,colorBlack)));
dtr =IIf(drs>60,colorGreen,IIf(drs<40,colorRed,IIf(drs<60 AND drs>40 ,colorTan,colorBlack)));

AddColumn( wrs,"RSI WLY",1.2,colorDefault, wtr,75);
AddColumn( drs,"RSI DLY",1.2,colorDefault, dtr,75);
AddColumn( hrs,"RSI Hly",1.2,colorDefault , htr);

///////// END RSI///////////////

Filter=1;

_SECTION_END();
2 Likes

@fxshrat tnx for that. color var needed to expanded too as the original variables were created in HTF.

@JEETU i am not sure how much you know AFL but i hope you got the idea of multi timeframes.

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