MTF timeframe scan output (Scanning Timeframe not Pattern with single timeframe)

Status
Not open for further replies.
#21
Here is a screenshot of what kind of an output you can get in Ami 5.9:



This version of the code was running on timeframes between 5 mins to 60 mins, at 5 min intervals and was running on these 4 stocks only.

This scanner does a single 2 bar scan for higher highs or lower lows. The data under each column shows the timeframes for which the signal was valid.

I chose a simple scan here, as the primary objective is to show how multi time frame scans can be done in any recent version of amibroker. This works for multiple patterns. The scan works using the exploration window, which allows you to change the current charted symbol by simply double clicking on any of the result rows.

This is a simple task that is easy to implement. Enough hint has already been shared on how this can be done.

Now if the objective is to get someone to write a fully working AFL, then maybe you should look at hiring a paid programmer and not expect free work from others on forums. Alternatively spend the time and effort required to learn how to write AFL.

-- no1lives4ever
 

cheap

Active Member
#22
Very easy work. :cool:

AddTextColumn("#", "BullBar"); ....etc above the loop.


inside the loop, below the filter
just do the AddRow() according to CHANGES FOR VERSION 5.91.0.


if your coders are good, they can spot how to do.

I never do AddRow() before, this is my first time within 1 hours, my past many years of programming experience don't help.

only:
Trial by Error.
sense of documentation error.
read development log.
doing command function test.

that help.

I Not CHEAP you know!!!:lol:
Code:
SetOption("NoDefaultColumns", True );
AddTextColumn( Name(), "Ticker",1, colorDefault,colorDefault, 50);
AddTextColumn( FullName(), "Company",1, colorDefault,colorDefault,250);
[B]AddColumn( DateTime(), "Date", formatDateTime, colorDefault,colorDefault, 80 );
[/B][COLOR="Red"]AddTextColumn("#", "BullBar");[/COLOR]

for ( i = 20; i <= 50; i++ ) // 1minute to 30minute
{
TimeFrameSet( i * in1Minute );

O1 = Ref(O,-1); 
C1 = Ref(C,-1);
MP = (H+L)/2;
R = H-L;


//-- Condition 
blBar=C>MP AND O>MP;
brBar=C<MP AND O<MP;

blEngulf = ((O1>C1) AND (C>O) AND (C>=O1) AND (C1>=O) AND ((C-O)>(O1-C1)));
brEngulf = ((C1>O1) AND (O>C) AND (O>=C1) AND (O1>=C) AND ((O-C)>(C1-O1)));

ss = ((R>4*(O-C)) AND ((H-C)/(.001+R)>= 0.75) AND ((H-O)/(.001+R)>= 0.75));

filter = blBar OR brBar or ss OR blEngulf OR brEngulf; 

[COLOR="red"]AddRow( StrFormat( ""+i+"%g minutes" ) );[/COLOR]
[B]str = WriteIf(blBar, "BullBar,", "")+
WriteIf(brBar, "BearBar,", "")+
WriteIf(blEngulf, "Bull Engulfing,","")+ 
WriteIf(brEngulf, "Bear Engulfing,", "") +
WriteIf(ss, "Shooting Star,", "");
str = StrLeft( str, StrLen(str)-1); [/B]

AddTextColumn(str, ""+NumToStr(i, 1.0)+"-Min"); 

TimeFrameRestore();


}


}
Hi,
I marked in red as you said,
Do i need to delete code that's in bold balck color?



this is output i got after i put code.
still timeframe is not shown correctly under it.
in addrow() inside it, what do i need to type
i can see in help menu about addrow() in amibroker
 

KelvinHand

Well-Known Member
#23
Code:
SetOption("NoDefaultColumns", True );
AddTextColumn( Name(), "Ticker",1, colorDefault,colorDefault, 50);
AddTextColumn( FullName(), "Company",1, colorDefault,colorDefault,250);
[B]AddColumn( DateTime(), "Date", formatDateTime, colorDefault,colorDefault, 80 );
[/B][COLOR="Red"]AddTextColumn("#", "BullBar");......etc[/COLOR]

for ( i = 20; i <= 50; i++ ) // 1minute to 30minute
{
TimeFrameSet( i * in1Minute );

O1 = Ref(O,-1); 
C1 = Ref(C,-1);
MP = (H+L)/2;
R = H-L;


//-- Condition 
blBar=C>MP AND O>MP;
brBar=C<MP AND O<MP;

blEngulf = ((O1>C1) AND (C>O) AND (C>=O1) AND (C1>=O) AND ((C-O)>(O1-C1)));
brEngulf = ((C1>O1) AND (O>C) AND (O>=C1) AND (O1>=C) AND ((O-C)>(C1-O1)));

ss = ((R>4*(O-C)) AND ((H-C)/(.001+R)>= 0.75) AND ((H-O)/(.001+R)>= 0.75));

filter = blBar OR brBar or ss OR blEngulf OR brEngulf; 

AddRow( StrFormat( ""+i+"%g minutes" ) );

[COLOR="Red"][B]/*************************************** 
This parts no longer required

str = WriteIf(blBar, "BullBar,", "")+    <==== This is the part move out of the loop and label as addtextcolumn ("#", "BullBar"), the rest follow
WriteIf(brBar, "BearBar,", "")+
WriteIf(blEngulf, "Bull Engulfing,","")+ 
WriteIf(brEngulf, "Bear Engulfing,", "") +
WriteIf(ss, "Shooting Star,", "");
str = StrLeft( str, StrLen(str)-1); 

AddTextColumn(str, ""+NumToStr(i, 1.0)+"-Min"); 
**************************************************/[/B][/COLOR]
TimeFrameRestore();


}


}
Hi,
I marked in red as you said,
Do i need to delete code that's in bold balck color?



this is output i got after i put code.
still timeframe is not shown correctly under it.
in addrow() inside it, what do i need to type
i can see in help menu about addrow() in amibroker
The trick is here:
CHANGES FOR VERSION 5.91.0.
You tell us what the different
 
Last edited:

cheap

Active Member
#24
The trick is here:
CHANGES FOR VERSION 5.91.0.
You tell us what the different
Hi,
I am not getting, what is mean of it?
Are you saying
Addrow() function work different for different amibroker. i guess function should work same for every amibroker.
I added red lines, is it right? Do i need to delete bold black codes .
 

cheap

Active Member
#25
Hi,
I am not getting, what is mean of it?
Are you saying
Addrow() function work different for different amibroker. i guess function should work same for every amibroker.
I added red lines, is it right? Do i need to delete bold black codes .
CHANGES FOR VERSION 5.91.0.
You tell us what the different
version 5.91.0 different meaning?
addrow() function is different in 5.91.0 version?
 

KelvinHand

Well-Known Member
#27
The screenshot I posted was from Ami v5.9 No need for AddRow

-- no1lives4ever
I know. I know.
that why you never stuck in AddRow()

But not fair.
I post code, you post picture only.:annoyed:

Top programmers always do that.
I shall learn from you all.
Next time, i will do the same thing.:)
Don't waste time to explain so much.

Tell ppl where the problem, also don't go and study it.
wasting time & effort.
 
#28
I know. I know.
that why you never stuck in AddRow()

But not fair.
I post code, you post picture only.:annoyed:

Top programmers always do that.
I shall learn from you all.
Next time, i will do the same thing.:)
Don't waste time to explain so much.

Tell ppl where the problem, also don't go and study it.
wasting time & effort.
I posted picture specifically because i dont want to help certain person with a working AFL. The op's query was not about getting a better understanding of AFL, but to get someone else to write an afl for free in the premise of "helping others"

The screenshot of the code is clear enough to any half decent programmer on how to achieve the output. I am not running a charity of giving out free AFL to those who dont contribute to the community.

-- no1lives4ever
 

cheap

Active Member
#29
I know. I know.
that why you never stuck in AddRow()

But not fair.
I post code, you post picture only.:annoyed:

Top programmers always do that.
I shall learn from you all.
Next time, i will do the same thing.:)
Don't waste time to explain so much.

Tell ppl where the problem, also don't go and study it.
wasting time & effort.
Hi,
changed unnecessary lines .
Code:
SetOption("NoDefaultColumns", True );
AddTextColumn( Name(), "Ticker",1, colorDefault,colorDefault, 50);
AddTextColumn( FullName(), "Company",1, colorDefault,colorDefault,250);
AddColumn( DateTime(), "Date", formatDateTime, colorDefault,colorDefault, 80 );
AddTextColumn("#", "BullBar");
AddTextColumn("#", "BearBar");
AddTextColumn("#", "Bull Engulfing");

for ( i = 20; i <= 50; i++ ) // 1minute to 30minute
{
TimeFrameSet( i * in1Minute );

O1 = Ref(O,-1); 
C1 = Ref(C,-1);
MP = (H+L)/2;
R = H-L;


//-- Condition 
blBar=C>MP AND O>MP;
brBar=C<MP AND O<MP;

blEngulf = ((O1>C1) AND (C>O) AND (C>=O1) AND (C1>=O) AND ((C-O)>(O1-C1)));
brEngulf = ((C1>O1) AND (O>C) AND (O>=C1) AND (O1>=C) AND ((O-C)>(C1-O1)));

ss = ((R>4*(O-C)) AND ((H-C)/(.001+R)>= 0.75) AND ((H-O)/(.001+R)>= 0.75));

filter = blBar OR brBar or ss OR blEngulf OR brEngulf; 

AddRow( StrFormat( ""+i+"%g minutes" ) );


TimeFrameRestore();


}
output is :


time shown under ticker, which is wrong i guess it's because of Addrow();
AddRow( StrFormat( ""+i+"%g minutes" ) );

How you add something in AddRow("text");
as it gives output as text as it's shown in help file.
why AddRow() add something in first column only?

Or use AddRow() function to get vertical output with patterns being column header.
it's already added.
 

KelvinHand

Well-Known Member
#30
hi,
changed unnecessary lines .
Code:
setoption("nodefaultcolumns", true );
addtextcolumn( name(), "ticker",1, colordefault,colordefault, 50);
addtextcolumn( fullname(), "company",1, colordefault,colordefault,250);
addcolumn( datetime(), "date", formatdatetime, colordefault,colordefault, 80 );
addtextcolumn("#", "bullbar");
addtextcolumn("#", "bearbar");
addtextcolumn("#", "bull engulfing");

for ( i = 20; i <= 50; i++ ) // 1minute to 30minute
{
timeframeset( i * in1minute );

o1 = ref(o,-1); 
c1 = ref(c,-1);
mp = (h+l)/2;
r = h-l;


//-- condition 
blbar=c>mp and o>mp;
brbar=c<mp and o<mp;

blengulf = ((o1>c1) and (c>o) and (c>=o1) and (c1>=o) and ((c-o)>(o1-c1)));
brengulf = ((c1>o1) and (o>c) and (o>=c1) and (o1>=c) and ((o-c)>(c1-o1)));

ss = ((r>4*(o-c)) and ((h-c)/(.001+r)>= 0.75) and ((h-o)/(.001+r)>= 0.75));

filter = blbar or brbar or ss or blengulf or brengulf; 

addrow( strformat( ""+i+"%g minutes" ) );


timeframerestore();


}
output is :


time shown under ticker, which is wrong i guess it's because of addrow();
addrow( strformat( ""+i+"%g minutes" ) );

how you add something in addrow("text");
as it gives output as text as it's shown in help file.
Why addrow() add something in first column only?

or use addrow() function to get vertical output with patterns being column header.
it's already added.
Read changes for version 5.91.0.
Read changes for version 5.91.0.
Read changes for version 5.91.0.
Read changes for version 5.91.0.
Read changes for version 5.91.0.
.....
Read changes for version 5.91.0.
Read changes for version 5.91.0.
Read changes for version 5.91.0.
Read changes for version 5.91.0.
Read changes for version 5.91.0.
 
Status
Not open for further replies.

Similar threads