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

Re: [amibroker] if else problem



PureBytes Links

Trading Reference Links

Try this:
 
 
----- Original Message -----

z=CCI(14);

Plusbars = BarsSince(z < 0);

Minusbars = BarsSince(z > 0);

TrendBarCount = 5;

Plot(C, "", IIf(plusbars  >  trendbarcount, colorBrightGreen

    IIf(minusbars  >=  trendbarcount, colorRed, colorAqua)), styleBar);

From: coba702002
Sent: Friday, June 03, 2005 10:22 AM
Subject: [amibroker] if else problem

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;
                  }
}





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




No virus found in this incoming message.
Checked by AVG Anti-Virus.
Version: 7.0.323 / Virus Database: 267.5.2 - Release Date: 6/3/2005


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