[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[amibroker] FAST & EASY Horizontal lines



PureBytes Links

Trading Reference Links


All,

This is a technique which I use to rapidly "auto-apply" my horizontal 
buy and sell lines with alerts.
Lines do not display until the close is within 2% of the close (which 
can be adjusted as desired).
Once the initial files are setup, the only procedure to generate the 
lines is to run the special explore (detailed below) and export the 
result. 
All stocks returned from the explore will now be "auto-lined"...

>>First, create a file called "autoLines.afl" in your "standard 
include path" defined in the preferences "AFL" tab.
Place the following code in this file:

/*----------- autoLines.afl -----------------*/
curLineIN=LineArray(BarCount-20,curinpr,BarCount-1,curinpr,1);
curLineOut=LineArray(BarCount-20,curOutpr,BarCount-1,curoutpr,1);
if(LastValue(curInPr >-999 AND Abs(curInPr-C)/C<.02)) Plot
(CurLineIn,"IN",colorGreen);
if(LastValue(curOutPr >-999 AND Abs(curOutPr-C)/C<.02)) Plot
(CurLineOut,"OUT",colorRed);
AlertIf( Cross(C,Curlinein), "", "AL_IN", 1 );
AlertIf( Cross(CurlineOut,C), "", "AL_OUT", 2 );
/*----------- end autoLines.afl ---------------*/

>>Next, place the following "textColumn" in the AA window setting the 
filter to return ONE record for each Stock 
(I use "BarIndex()==BarCount-1" for this purpose):

/**************** AA Explore Code ******************/
//1. use what-ever filter as long as ONE line is returned for each 
stock

Filter=BarIndex()==BarCount-1 AND Name()=="HD" OR Name()=="MSFT" OR 
Name()=="INTC";

//2. set the following variables according to your calculations...
myBuyPrice=C*.99;
mySellPrice=C*1.01;
myScore=1;

//3. Use this column ONLY!!
AddTextColumn("*/if  (name()==\""+Name()+"\"){curInPr="+NumToStr
(myBuyPrice)+"; curOutPr="+NumToStr(mySellPrice)+"; 
curscore="+NumToStr(myScore)+";}/*","");

/*************** End Explore code ********************/

>> Last setup step:
Place the following code at the top of any indicator you choose;
(Usually you want to plot "close" also...)
Note: Remember to enable alerts in indicators; Preferences: Alerts.

/******************* Indicator Code ***************/
 #pragma nocache;
curinpr=-999;
curOutpr=-999;
curscore=-999;
/*
#include <orders.afl>;
*/
#include <autoline.afl>;

/*************** End Indicator code ********************/

Caution: Leave the open & close comment before and after the 
<orders.afl>. They are required! 

NOW, You are ready! 
Run the 1 column explore and export the result file to "Orders.afl"
in your "standard include path" defined in the preferences "AFL" tab.

Thats it! From now on just run the explore for the stocks you need, 
export it to "orders.afl" and your lines are there.

You can automate it even further by scripting the explore. 
Also, you may want to rename yesterday's order file if you want to 
keep it...

I hope this will relieve some of the tedium of daily setup.

Walt






------------------------ Yahoo! Groups Sponsor --------------------~--> 
$9.95 domain names from Yahoo!. Register anything.
http://us.click.yahoo.com/J8kdrA/y20IAA/yQLSAA/GHeqlB/TM
--------------------------------------------------------------------~-> 

Check AmiBroker web page at:
http://www.amibroker.com/

Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/

<*> To unsubscribe from this group, send an email to:
    amibroker-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/