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

[amibroker] if else problem



PureBytes Links

Trading Reference Links

can anyone help with this code... it doesn't enter the last else to 
color the bar grey... i have tried to move the grey bar color to be 
the else from the plus/minusbar if and then it never gets into 
coloring the red and green

what this code does that im trying to change is: after 5 bars above 
or below it paints green/red. Thats fine, however if there are 5 
bars above and below the zero line and it changes direction and gets 
on the opposite side of the trend but doesn't make the 5 bar min... 
THEN goes back in the direction of the original trend i want it to 
pick up that trend color and not reset to grey and wait for the 5th 
bar again

any help would be appreciated... im going batty looking at this

z=cci(14);
Plusbars = BarsSince(z < 0);
Minusbars = BarsSince(z > 0);
TrendBarCount = 5;
for( i = 0; i < BarCount; i++ )
{
Color[i]  = colorLightGrey;

	if (Plusbars[i] >= TrendBarCount)
			{
			glight=1;
			rlight=0;
			Color[i] = colorGreen;
			}	
	
	else
		if (Minusbars[i] >= TrendBarCount) 
					{
					rlight=1;
					glight=0;
					Color[i] = colorDarkRed;
					}
	else
//		if ((z[i]>0 ) AND glight=1)
//				{ 
//				Color[i] = colorBrightGreen; 
//				glight=1;
//				rlight=0;
//				}
//			
//		else
//			if ((z[i]<0 )AND rlight=1)
//				{ 
//				Color[i] = colorRed ; 
//				glight=0;
//				rlight=1;
//				}
//		else
//			if (((glight=1) AND (z[i]<0)) OR ((rlight=0) 
AND (z[i]>0)))
			{
			Color[i] = colorLightGrey;
			}
}





------------------------ Yahoo! Groups Sponsor --------------------~--> 
In low income neighborhoods, 84% do not own computers.
At Network for Good, help bridge the Digital Divide!
http://us.click.yahoo.com/EpW3eD/3MnJAA/cosFAA/GHeqlB/TM
--------------------------------------------------------------------~-> 

Please note that this group is for discussion between users only.

To get support from AmiBroker please send an e-mail directly to 
SUPPORT {at} amibroker.com

For other support material please check also:
http://www.amibroker.com/support.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/