# Mutiple time frame in trading system and multi conditions in afl

#### Stockbroker81

##### New Member
Hi everyone.

I have a problem, I try to write a system which I wish to test but it seems to be way harder that I thought at the begining.

TimeFrameSet(inDaily);

and under given conditions for daily interval like:

%K < 30 And %D < 30 and Cross(%K,%D)

In other words I trade on hourly interval and I take long position only when upper time frame shows oversold and shows willing to recovery .

Have anyone has an idea how to deal with such problem.

I am a rookie regarding AFL, btw.

#### Abhi1284

##### Active Member
Hi everyone.

I have a problem, I try to write a system which I wish to test but it seems to be way harder that I thought at the begining.

TimeFrameSet(inDaily);

and under given conditions for daily interval like:

%K < 30 And %D < 30 and Cross(%K,%D)

In other words I trade on hourly interval and I take long position only when upper time frame shows oversold and shows willing to recovery .

Have anyone has an idea how to deal with such problem.

I am a rookie regarding AFL, btw.
I THINK THIS WILL HELP U PLOT UR STOCH AFL INSTED OF ADX IN BELOW AFL

THANX
ABHISHEK

range = Param("Periods", 14, 2, 200, 1 );
p = ParamList("Timeframe", "5 Minute|15 Minute|Hourly|Daily|Weekly|Monthly", 3);
switch (p) {
case "5 Minute": tf = in5Minute; break;
case "15 Minute": tf = in15Minute; break;
case "Hourly": tf = inHourly; break;
case "Daily": tf = inDaily; break;
case "Weekly": tf = inWeekly; break;
case "Monthly": tf = inMonthly; break;
default: tf = inDaily; break;
}

TimeFrameSet(tf);
pdiVal = PDI(range);
mdiVal = MDI(range);
TimeFrameRestore();

Plot(TimeFrameExpand(pdiVal, tf), "+DI", ParamColor( "+DI color", colorGreen ), ParamStyle("+DI style") );
Plot(TimeFrameExpand(mdiVal, tf), "-DI", ParamColor( "-DI color", colorRed ), ParamStyle("-DI style") );

Plot(Param("Signal Line", 24, 20, 30, 1), "", ParamColor("Signal Line color", colorBlack), ParamStyle("Signal Line style", styleLine|styleThick|styleNoLabel));
_SECTION_END();

#### DataRam

##### Banned
I THINK THIS WILL HELP U PLOT UR STOCH AFL INSTED OF ADX IN BELOW AFL

THANX
ABHISHEK

range = Param("Periods", 14, 2, 200, 1 );
p = ParamList("Timeframe", "5 Minute|15 Minute|Hourly|Daily|Weekly|Monthly", 3);
switch (p) {
case "5 Minute": tf = in5Minute; break;
case "15 Minute": tf = in15Minute; break;
case "Hourly": tf = inHourly; break;
case "Daily": tf = inDaily; break;
case "Weekly": tf = inWeekly; break;
case "Monthly": tf = inMonthly; break;
default: tf = inDaily; break;
}

TimeFrameSet(tf);
pdiVal = PDI(range);
mdiVal = MDI(range);
TimeFrameRestore();

Plot(TimeFrameExpand(pdiVal, tf), "+DI", ParamColor( "+DI color", colorGreen ), ParamStyle("+DI style") );
Plot(TimeFrameExpand(mdiVal, tf), "-DI", ParamColor( "-DI color", colorRed ), ParamStyle("-DI style") );

Plot(Param("Signal Line", 24, 20, 30, 1), "", ParamColor("Signal Line color", colorBlack), ParamStyle("Signal Line style", styleLine|styleThick|styleNoLabel));
_SECTION_END();
Good One .

Thanks.

#### pra1968

##### Member
GOOD WORK
CAN U ALSO TRY TO SOLVE THIS

I THINK THIS WILL HELP U PLOT UR STOCH AFL INSTED OF ADX IN BELOW AFL

THANX
ABHISHEK

range = Param("Periods", 14, 2, 200, 1 );
p = ParamList("Timeframe", "5 Minute|15 Minute|Hourly|Daily|Weekly|Monthly", 3);
switch (p) {
case "5 Minute": tf = in5Minute; break;
case "15 Minute": tf = in15Minute; break;
case "Hourly": tf = inHourly; break;
case "Daily": tf = inDaily; break;
case "Weekly": tf = inWeekly; break;
case "Monthly": tf = inMonthly; break;
default: tf = inDaily; break;
}

TimeFrameSet(tf);
pdiVal = PDI(range);
mdiVal = MDI(range);
TimeFrameRestore();

Plot(TimeFrameExpand(pdiVal, tf), "+DI", ParamColor( "+DI color", colorGreen ), ParamStyle("+DI style") );
Plot(TimeFrameExpand(mdiVal, tf), "-DI", ParamColor( "-DI color", colorRed ), ParamStyle("-DI style") );

Plot(Param("Signal Line", 24, 20, 30, 1), "", ParamColor("Signal Line color", colorBlack), ParamStyle("Signal Line style", styleLine|styleThick|styleNoLabel));
_SECTION_END();

#### sartish

##### New Member
I THINK THIS WILL HELP U PLOT UR STOCH AFL INSTED OF ADX IN BELOW AFL

THANX
ABHISHEK

range = Param("Periods", 14, 2, 200, 1 );
p = ParamList("Timeframe", "5 Minute|15 Minute|Hourly|Daily|Weekly|Monthly", 3);
switch (p) {
case "5 Minute": tf = in5Minute; break;
case "15 Minute": tf = in15Minute; break;
case "Hourly": tf = inHourly; break;
case "Daily": tf = inDaily; break;
case "Weekly": tf = inWeekly; break;
case "Monthly": tf = inMonthly; break;
default: tf = inDaily; break;
}

TimeFrameSet(tf);
pdiVal = PDI(range);
mdiVal = MDI(range);
TimeFrameRestore();

Plot(TimeFrameExpand(pdiVal, tf), "+DI", ParamColor( "+DI color", colorGreen ), ParamStyle("+DI style") );
Plot(TimeFrameExpand(mdiVal, tf), "-DI", ParamColor( "-DI color", colorRed ), ParamStyle("-DI style") );

Plot(Param("Signal Line", 24, 20, 30, 1), "", ParamColor("Signal Line color", colorBlack), ParamStyle("Signal Line style", styleLine|styleThick|styleNoLabel));
_SECTION_END();
I have same question but situation is oppsite. I work in 15min candles.... and if certain condition(signal) is generated in 5min candle how to show it in 15 min candle chart.