Exploration ignores 15mins TimeFrame

#1
Hello All,

I am trying to use exploration to find the stocks that have the FastK trending up on a 15min timeframe. However it seems during the exploration the TimeFrameSet(in15Minute) is being ignored and it uses the Daily timeframe to compute the results. Below is the afl:

Code:
Filter=1;
k=-1;
TimeFrameSet(in15Minute);
pds=8; //Periods

//FastK calculation
L8=LLV(L,pds);
H8=HHV(H,pds);
FastK15Minute = 100*((C-L8)/(H8-L8)); 

//Previous period FastK calculation
L8X=Ref(LLV(L,pds),k);
H8X=Ref(HHV(H,pds),k);
CX=Ref(C,k);
FastK15MinuteX = 100*((CX-L8X)/(H8X-L8X));

//Comparison and Results
FastKResult15Minute = FastK15Minute > FastK15MinuteX;
FastK15MinuteTrend=WriteIf(FastKResult15Minute==1, "Up","Down");

//Output 
AddColumn(FastK15Minute,"FastK15Minute");
AddTextColumn(FastK15MinuteTrend,"FastK15MinuteTrend");

TimeFrameRestore();
Has anyone else come across this previously? Is there a way to resolve this?

Thanks and Regards,
~cygnus
 

amitrandive

Well-Known Member
#2
Hello All,

I am trying to use exploration to find the stocks that have the FastK trending up on a 15min timeframe. However it seems during the exploration the TimeFrameSet(in15Minute) is being ignored and it uses the Daily timeframe to compute the results. Below is the afl:

Code:
Filter=1;
k=-1;
TimeFrameSet(in15Minute);
pds=8; //Periods

//FastK calculation
L8=LLV(L,pds);
H8=HHV(H,pds);
FastK15Minute = 100*((C-L8)/(H8-L8)); 

//Previous period FastK calculation
L8X=Ref(LLV(L,pds),k);
H8X=Ref(HHV(H,pds),k);
CX=Ref(C,k);
FastK15MinuteX = 100*((CX-L8X)/(H8X-L8X));

//Comparison and Results
FastKResult15Minute = FastK15Minute > FastK15MinuteX;
FastK15MinuteTrend=WriteIf(FastKResult15Minute==1, "Up","Down");

//Output 
AddColumn(FastK15Minute,"FastK15Minute");
AddTextColumn(FastK15MinuteTrend,"FastK15MinuteTrend");

TimeFrameRestore();
Has anyone else come across this previously? Is there a way to resolve this?

Thanks and Regards,
~cygnus
Seems working okay

Make sure you have the correct 15 min periodicity setting as per the image from settings

 

trash

Well-Known Member
#3
Hello All,

I am trying to use exploration to find the stocks that have the FastK trending up on a 15min timeframe. However it seems during the exploration the TimeFrameSet(in15Minute) is being ignored and it uses the Daily timeframe to compute the results. Below is the afl:

Code:
Filter=1;
k=-1;
TimeFrameSet(in15Minute);
pds=8; //Periods

//FastK calculation
L8=LLV(L,pds);
H8=HHV(H,pds);
FastK15Minute = 100*((C-L8)/(H8-L8)); 

//Previous period FastK calculation
L8X=Ref(LLV(L,pds),k);
H8X=Ref(HHV(H,pds),k);
CX=Ref(C,k);
FastK15MinuteX = 100*((CX-L8X)/(H8X-L8X));

//Comparison and Results
FastKResult15Minute = FastK15Minute > FastK15MinuteX;
FastK15MinuteTrend=WriteIf(FastKResult15Minute==1, "Up","Down");

//Output 
AddColumn(FastK15Minute,"FastK15Minute");
AddTextColumn(FastK15MinuteTrend,"FastK15MinuteTrend");

TimeFrameRestore();
Has anyone else come across this previously? Is there a way to resolve this?

Thanks and Regards,
~cygnus
First of all your MTF code is wrong and missing things! Take a look into the documentation once in a while!

Besides if you wanna specifically look at 15 minute from another different time frame then that different time frame has to be equal or lower to 15 minute set in your code. If your code is used in analysis then periodicity setting is to be found in backtest settings "General" tab.
 

trash

Well-Known Member
#4
Here is one fixed possibility

Code:
// http://www.traderji.com/amibroker/96757-exploration-ignores-15mins-timeframe.html
// fixed by trash

tmfrm = in15Minute;

if( Interval() > tmfrm )
	Error( "Set time frame lower or equal to " + tmfrm/ 60 + "-minutes" );

Filter= Status( "lastbarinrange" );
delay = 1;
pds = 8; //Periods

TimeFrameSet( tmfrm ); 

	//FastK calculation
	L8 = LLV( L, pds );
	H8 = HHV( H, pds );
	FastK15Minute = 100 * ( ( C - L8 ) / ( H8 - L8 ) );

	//Previous period FastK calculation
	L8X = Ref( L8, -delay );
	H8X = Ref( H8, -delay );
	CX = Ref( C, -delay );
	FastK15MinuteX = 100 * ( ( CX - L8X ) / ( H8X - L8X ) );

	htfstr = Interval(2);

TimeFrameRestore();

expandmode = expandFirst; // other options: expandlast, expandpoint  see manual!
FastK15Minute = TimeFrameExpand( FastK15Minute, tmfrm, expandmode );
FastK15MinuteX = TimeFrameExpand( FastK15MinuteX, tmfrm, expandmode );

//Comparison and Results
FastKResult15Minute = FastK15Minute > FastK15MinuteX;
FastK15MinuteTrend = WriteIf( FastKResult15Minute, "Up", "Down" );

//Output
AddTextColumn( Interval(2), "Set Timeframe", 1 );
AddColumn( FastK15Minute, "FastK"+htfstr, 1.2 );
AddTextColumn( FastK15MinuteTrend, "FastK"+htfstr+"Trend", 1, colorLightGrey, IIf( FastKResult15Minute, colorDarkGreen, colorDarkRed) );
 
#5
I followed what amitrandive had suggested and it did the trick. thank you very much amitrandive :)

trash, thank you very much for the suggestions and the code.. i am in awe looking at it... it would take me a decade to come up with something like that. am new to coding as well as afls. believe me i had sleepless nights to come up with this simple code itself :) the colored output is cool and makes it easy to interpret. I need to go through the help file to understand what magic you did to get that output first :) you did mention documentation couple of times... were you referring to the help file in amibroker or another resource.. please do share... am willing to learn

thanks and regards,
~cynus
 

trash

Well-Known Member
#6
If you just wanna explore in very same timeframe as being set in backtest settings then you don't need time frame functions.

Code:
// http://www.traderji.com/amibroker/96757-exploration-ignores-15mins-timeframe.html
// fixed by trash

Filter= Status( "lastbarinrange" );
delay = 1;
pds = 8; //Periods

//FastK calculation
L8 = LLV( L, pds );
H8 = HHV( H, pds );
FastK15Minute = 100 * ( ( C - L8 ) / ( H8 - L8 ) );

//Previous period FastK calculation
L8X = Ref( L8, -delay );
H8X = Ref( H8, -delay );
CX = Ref( C, -delay );
FastK15MinuteX = 100 * ( ( CX - L8X ) / ( H8X - L8X ) );

//Comparison and Results
FastKResult15Minute = FastK15Minute > FastK15MinuteX;
FastK15MinuteTrend = WriteIf( FastKResult15Minute, "Up", "Down" );

//Output
intstr = Interval(2);
AddTextColumn( intstr , "Set Timeframe", 1 );
AddColumn( FastK15Minute, "FastK"+intstr,  1.2 );
AddTextColumn( FastK15MinuteTrend, "FastK"+intstr +"Trend", 1, colorLightGrey, IIf( FastKResult15Minute, colorDarkGreen, colorDarkRed) );
EDIT: one comma was missing
 
Last edited:

trash

Well-Known Member
#7
If you just wanna explore in very same timeframe as being set in backtest settings then you don't need time frame functions.

Code:
// http://www.traderji.com/amibroker/96757-exploration-ignores-15mins-timeframe.html
// fixed by trash

Filter= Status( "lastbarinrange" );
delay = 1;
pds = 8; //Periods

//FastK calculation
L8 = LLV( L, pds );
H8 = HHV( H, pds );
FastK15Minute = 100 * ( ( C - L8 ) / ( H8 - L8 ) );

//Previous period FastK calculation
L8X = Ref( L8, -delay );
H8X = Ref( H8, -delay );
CX = Ref( C, -delay );
FastK15MinuteX = 100 * ( ( CX - L8X ) / ( H8X - L8X ) );

//Comparison and Results
FastKResult15Minute = FastK15Minute > FastK15MinuteX;
FastK15MinuteTrend = WriteIf( FastKResult15Minute, "Up", "Down" );

//Output
intstr = Interval(2);
AddTextColumn( intstr , "Set Timeframe", 1 );
AddColumn( FastK15Minute, "FastK"+intstr,  1.2 );
AddTextColumn( FastK15MinuteTrend, "FastK"+intstr +"Trend", 1, colorLightGrey, IIf( FastKResult15Minute, colorDarkGreen, colorDarkRed) );

BTW, both codes can be made shorter by using ROC()

Code:
Filter= Status( "lastbarinrange" );
delay = 1;
pds = 8; //Periods

//FastK calculation
L8 = LLV( L, pds );
H8 = HHV( H, pds );
FastK15Minute = 100 * ( ( C - L8 ) / ( H8 - L8 ) );

//Comparison and Results
FastKResult15Minute = ROC( FastK15Minute, delay ) > 0;
FastK15MinuteTrend = WriteIf( FastKResult15Minute, "Up", "Down" );

//Output
intstr = Interval(2);
AddTextColumn( intstr , "Set Timeframe", 1 );
AddColumn( FastK15Minute, "FastK"+intstr,  1.2 );
AddTextColumn( FastK15MinuteTrend, "FastK"+intstr +"Trend", 1, colorLightGrey, IIf( FastKResult15Minute, colorDarkGreen, colorDarkRed) );
 

hmsanil

Active Member
#8
Is it possible to make this code with buy and sell signals on price chart

Thanks


BTW, both codes can be made shorter by using ROC()

Code:
Filter= Status( "lastbarinrange" );
delay = 1;
pds = 8; //Periods

//FastK calculation
L8 = LLV( L, pds );
H8 = HHV( H, pds );
FastK15Minute = 100 * ( ( C - L8 ) / ( H8 - L8 ) );

//Comparison and Results
FastKResult15Minute = ROC( FastK15Minute, delay ) > 0;
FastK15MinuteTrend = WriteIf( FastKResult15Minute, "Up", "Down" );

//Output
intstr = Interval(2);
AddTextColumn( intstr , "Set Timeframe", 1 );
AddColumn( FastK15Minute, "FastK"+intstr,  1.2 );
AddTextColumn( FastK15MinuteTrend, "FastK"+intstr +"Trend", 1, colorLightGrey, IIf( FastKResult15Minute, colorDarkGreen, colorDarkRed) );
 

Similar threads

Broker Special Offers

Intraday Higher Leverage

Save up to 90% in brokerage and get higher leverage for intraday trades.

Name:Phone:
Email:City:
State:
Are you a day trader?