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

RE: [amibroker] Line drawing routine request/suggestion



PureBytes Links

Trading Reference Links

Steve
This is one I use to put a gann fan on the chart at my required line
slopes so that I can align the inbuilt gann fan then move it to where I
want on the chart. It may be more than you were asking but the line draw
is there.

Length = 10;
LowPrice = LLV(L,period);
HighPrice = HHV(H,period);
StartBar = LastValue(Cum(1))-period;
Linecount = Cum(1) - startbar;
Slope = LastValue(
IIf(C<=5,0.1,
IIf(C>5 AND C<=10,0.2,
IIf(C>10 AND C<=50,0.5,
IIf(C>50 AND C<=200,1,
IIf(C>200 AND C<=500,2,
IIf(C>500 AND C<=1000,5,
IIf(C>1000 AND C<=2000,10,
20 ))))))) );

StartPrice = LastValue((Highprice+Lowprice)/2);
LineUp = IIf(Cum(1)<startbar OR Cum(1)>(startbar+Length), Null,
Startprice + slope*Linecount);
LineUpHalf = IIf(Cum(1)<startbar OR Cum(1)>(startbar+Length*2), Null,
Startprice + slope*Linecount/2);
LineUpDouble = IIf(Cum(1)<startbar OR Cum(1)>(startbar+Length/2), Null,
Startprice + slope*Linecount*2);
LineDown = IIf(Cum(1)<startbar  OR Cum(1)>(startbar+Length), Null,
startprice - slope*Linecount);
LineDownHalf = IIf(Cum(1)<startbar  OR Cum(1)>(startbar+Length*2), Null,
startprice - slope*Linecount/2);
LineDownDouble = IIf(Cum(1)<startbar  OR Cum(1)>(startbar+Length/2),
Null, startprice - slope*Linecount*2);

GraphXSpace = 5;
Plot(LineUp,        "1:1 Trend", colorBlueGrey,
styleNoLabel+styleNoLine+styleDots);
Plot(LineUpHalf,    "1:2 Trend", colorDarkGrey,
styleNoLabel+styleNoLine+styleDots);
Plot(LineUpDouble,  "2:1 Trend", colorDarkGrey,
styleNoLabel+styleNoLine+styleDots);
Plot(LineDown,      "1:1 Trend", colorBlueGrey,
styleNoLabel+styleNoLine+styleDots);
Plot(LineDownHalf,  "1:2 Trend", colorDarkGrey,
styleNoLabel+styleNoLine+styleDots);
Plot(LineDownDouble,"2:1 Trend", colorDarkGrey,
styleNoLabel+styleNoLine+styleDots);
Plot(Slope,"slope",colorBlack,styleNoLabel+styleNoLine+styleOwnScale);
Plot(C,"Candle chart",colorBlack,styleCandle+styleNoLabel);

Cheers,
Graham
http://groups.msn.com/ASXShareTrading
http://groups.msn.com/FMSAustralia

-----Original Message-----
From: Steve [mailto:scrombie@xxxxxxxxxxxxx] 
Sent: Saturday, 15 March 2003 4:26 AM
To: amibroker@xxxxxxxxxxxxxxx
Subject: [amibroker] Line drawing routine request/suggestion

I'm looking for an AFL routine that will draw a straight line on the 
chart from Datetime1,Price1 to Datetime2,Price2. Hopefully someone 
could show me how this can be done in AFL or direct me to a piece of 
code in some AFL already written that could be used. 

Also, as a suggestion, I think it would be nice if a future upgrade 
of Amibroker could have a drawing function that would accomplish this 
(maybe it exist and I'm not aware of it) For example a line drawing 
function like I need:

Draw(datetime1,price1,datetime2,price2,color,style);

That would simplify some of the things I'm trying to do.


Send BUG REPORTS to bugs@xxxxxxxxxxxxx
Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
-----------------------------------------
Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx 
(Web page: http://groups.yahoo.com/group/amiquote/messages/)
--------------------------------------------
Check group FAQ at:
http://groups.yahoo.com/group/amibroker/files/groupfaq.html 

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


Send BUG REPORTS to bugs@xxxxxxxxxxxxx
Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
-----------------------------------------
Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx 
(Web page: http://groups.yahoo.com/group/amiquote/messages/)
--------------------------------------------
Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html 

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