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

[amibroker] for loop



PureBytes Links

Trading Reference Links




Hi 
Guys,
<SPAN 
class=966553613-28042003> 
I am trying to 
understand how to use the for loop. I try this....
<SPAN 
class=966553613-28042003> 
<FONT 
color=#000000>
for( i = <FONT 
color=#ff00ff>1; i < <FONT 
color=#000000>BarCount<FONT 
face=Arial size=2>; i++ )
{

C<FONT 
color=#282828>[ i ] = <FONT 
color=#000000>C<FONT 
color=#282828>[ i-1 
]+C<FONT color=#282828 
face=Arial size=2>[i];
}
And I 
think I get C=c+ref(c,-1); where I increment the close by adding yesterdays 
close to todays and move forward doing so for each bar of the chart. Now if I 
wanted to set the first bar to 50 I would think I could add an if statement like 
this.....<SPAN 
class=966553613-28042003>
if (Cum<FONT 
color=#282828>(1<FONT 
color=#282828>)==1<SPAN 
class=966553613-28042003>)
C<FONT 
color=#282828>[ i ] = 50<FONT 
color=#282828>;
else<FONT 
size=2>
C[ i ] = 
C[ i-<FONT 
color=#ff00ff>1 ]+<FONT 
color=#000000>C[i];
but this 
gives me an error telling me that if ,for,when requires a numeric or Boolean 
statement. <FONT face=Arial 
size=2> What I am trying to do is set the first 
bar to 50 I then want the 2nd bar to be the first bar(50) + the value of the 
second bar  then increment each bar forward by the previous bar plus the 
current bar. I cannot seem to get my mind around this.
If any one can steer 
me in the right direction I would appreciate 
it<FONT color=#0000ff face=Arial 
size=2>Jayson 
 






Yahoo! Groups Sponsor












Send BUG REPORTS to bugs@xxxxxxxxxxxxx
Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
-----------------------------------------
Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx 
(Web page: http://groups.yahoo.com/group/amiquote/messages/)
--------------------------------------------
Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html



Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.