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

[amibroker] Example code doesn't work



PureBytes Links

Trading Reference Links

Hi

Sorry for asking. In the code below, which I got from Common Coding mistakes I

neither see red nor green colors in my plot but I do see a gray plot.

What is wrong with this simple code?

Thanks in advance

Olli

/*

From: Common Coding mistakes in AFL

Example: if-else statement needs boolean (or single numeric expression), not array

Re: [Amibroker] Creating a toggle switch Sent: 27.06.2005

*/

_SECTION_BEGIN("ShowEarnings_1");

Color[0] = colorGreen;    // if I don't add this line I'll get Error 29, Variable 'color' used without having been initialized

  

for (i=0; i > BarCount; i++)

{

if (Close[i] > Open[i] )

Color[i] = colorGreen;

else

Color[i] = colorRed;

}

Plot(Close,"Colored Price", Color, styleCandle);

_SECTION_END();



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





SPONSORED LINKS
Investment management software Real estate investment software Investment property software
Software support Real estate investment analysis software Investment software


YAHOO! GROUPS LINKS