[amibroker] Why does this AFL work but other does not?

 

This is just a simple idea I got from a blog/e-mail I received from Adam Grimes. I wanted to try doing some test on just some certain candle patterns and maybe some other conditions and do some work with Amibroker/Excel just for some experience in working with data sets.

The idea I got was a bar with an average range that had an open and close within the top 80% of the bars range. First step was identifying this in AFL(pardon my math if its substandard, little rusty these days, Amibroker gets my brain working again which is fantastic).

This is kind of a rough idea of the first AFL I tried, I was trying to use a chart and explore window to see the math and make sure it was working as intended, but it wasn't, I was getting a bit frustrated until I tried breaking it up and using the second AFL.

Now part of me thinks its something to do with using the Open and Close >= or maybe I'm missing something simple. If my idea is correct, anyone have a good chapter of manual to read. I'm wondering why it didn't and to further understand the do's and don't's of AFL.

Failed try AFL.

----------------------------------------------------------------------------

Range = (High - Low) > ATR(20); // Bar greater then the ATR of past 20 days

TopOfRange = Open AND Close >= ((H-L) * 80 / 100) + Low; // Top 80 percent range of bar


RangeCalculation = ((H-L) * 80 / 100) + Low;


Filter = TopOfRange AND Range;

AddColumn( O, "Open" );
AddColumn( H , "High" );
AddColumn( L , "Low" );
AddColumn( C, "Close" );


AddColumn(TopofRange,"TopRangeCalculation",1);
AddColumn(RangeCalculation,"RangeCalculation",1);

PlotShapes(shapeUpArrow*Filter,colorOrange);

---------------------------------------------------------------------------------------------------------------------

Working AFL

Range = (High - Low) > ATR(20); // Bar greater then the ATR of past 20 days

TopOfRange = ((H-L) * 80 / 100) + Low; // Top 80 percent range of bar

OpenCondition = Open > TopOfRange;
CloseCondition = Close > TopOfRange;

Filter = Range AND OpenCondition AND CloseCondition;

AddColumn( O, "Open" );
AddColumn( H , "High" );
AddColumn( L , "Low" );
AddColumn( C, "Close" );


AddColumn(TopofRange,"TopRangeCalculation",1.2);
AddColumn(OpenCondition,"OpenCondition",1);
AddColumn(CloseCondition,"CloseCondition",1);

PlotShapes(shapeUpArrow*Filter,colorOrange);

--------------------------------------------------------------------------------------------------------------------------------------

Thanks in advance for any help


__._,_.___

Posted by: brandon.richard03@yahoo.com
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (1)
**** IMPORTANT PLEASE READ ****
This group is for the discussion between users only.
This is *NOT* technical support channel.

TO GET TECHNICAL SUPPORT send an e-mail directly to
SUPPORT {at} amibroker.com

TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
http://www.amibroker.com/feedback/
(submissions sent via other channels won't be considered)

For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/


.

__,_._,___

Related Posts


EmoticonEmoticon

:)
:(
=(
^_^
:D
=D
=)D
|o|
@@,
;)
:-bd
:-d
:p
:ng
:lv