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

Re: [amibroker] Example code doesn't work



PureBytes Links

Trading Reference Links

Hello,
 
If you are taking code from somewhere - copy paste it instead of re-typing.
That way you won't make mistakes.
This time during re-typing you have changed < character to > and that's the problem.
 
In
 
the code is:
for( i = 0; i < BarCount; i++ ) // CORRECT
 
 
while you have replaced it with:
 
for( i = 0; i > BarCount; i++ ) // INCORRECT

Best regards,
Tomasz Janeczko
amibroker.com
----- Original Message -----
From: metaboxfan
Sent: Monday, March 06, 2006 10:32 AM
Subject: [amibroker] Example code doesn't work

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





YAHOO! GROUPS LINKS