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(O>S1,1,IIf(S1>O<S2,2,IIf(S2>O<L,3,0)));// POSITION OF OPENING PRICE ;
CL=IIf(C>S1,1,IIf(S1>C<S2,2,IIf(S2>C<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,colorRed,IIf(COND_N,colorBlue,colorWhite)));
PlotOHLC( Open, High, Low, Close, "Price chart ",DYNAMIC_COLOR, styleBar );
Thank you,
JG
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(O>S1,1,IIf(S1>O<S2,2,IIf(S2>O<L,3,0)));// POSITION OF OPENING PRICE ;
CL=IIf(C>S1,1,IIf(S1>C<S2,2,IIf(S2>C<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,colorRed,IIf(COND_N,colorBlue,colorWhite)));
PlotOHLC( Open, High, Low, Close, "Price chart ",DYNAMIC_COLOR, styleBar );
Thank you,
JG