http://www.traderji.com/amibroker/26482-amibroker-assistance-coding-bill-williams-price-bars-ohlc.html


From: Patrick Tobin 
Sent: Sunday, February 08, 2009 5:14 PM
To: [email protected] 
Subject: [amibroker] AFL Assistance - Color Coding of Price Bars( Bill Williams 
Profitunity Windows )


Hi Friends,

I've been trying to assign colors to bars based on Bill Williams' 
assignments to bar structures (CLIMBERS, DRIFTERS AND NEUTARAL BARS) 
without success. The colors do not come out at all. With the AFL 
coding below, the only result is Green Bars. 

I have limited knowledge of the AFL and definitely need help. The 
logic seems in place but my expertise with AFL is wanting. I would 
appreciate any assistance with the coding.

R=(H-L);//RANGE;
FR=(H-L)/3;//THIRD OF RANGE;
S1=H-FR;//SEGMENT ONE;
S2=H-2*FR;//SEGMENT TWO;
S3=L;//SEGMENT THREE;

/*POSITION OF OPEN AND CLOSE RELATIVE TO BAR*/

P=IIf(OPEN>S1,1,IIf(S1>OPEN<S2,2,IIf(S2>OPEN<L,3,0)));// POSITION OF 
OPENING PRICE ;
CL=IIf(CLOSE>S1,1,IIf(S1>CLOSE<S2,2,IIf(S2>CLOSE<L,3,0)));// POSITION 
OF CLOSING PRICE;

/*CONDITIONAL STATEMENTS */

COND_C=(((P=2 OR 3) AND CL=1)) OR (P=3 AND (C=1 OR 2)); //CLIMBERS
COND_D=(P=1 AND (CL=2 OR 3) ) OR (P=2 AND (CL=2 OR 3));//DRIFTERS
COND_N=(P=CL=1 OR 2 OR 3); // NEUTRAL BARS

DYNAMIC_COLOR=IIf(COND_C,colorGreen,IIf(COND_D,col orRed,IIf
(COND_N,colorBlue,colorWhite)));

PlotOHLC( Open, High, Low, Close, "Price chart ",DYNAMIC_COLOR, 
styleBar );

Thank you,

Pat Tobin



Reply via email to