PureBytes Links
Trading Reference Links
|
Jayson,
It is actually simpler that you wrote, correct code
is:
<FONT
color=#000000>
<FONT
face=Arial>for<FONT
color=#282828>( i = 1; i
< BarCount<FONT
color=#282828>; i++
)
<FONT
color=#000000>{
<FONT
color=#000000>if ( i <FONT
color=#282828>== 1 <SPAN
class=966553613-28042003>)
C[ i ] = <FONT
color=#ff00ff>50<FONT face=Arial
size=2>;
else<FONT
size=2>
C[ i ] =
C[ i-<FONT
color=#ff00ff>1 ]+<FONT
color=#000000>C[i];
}
Note however that this code overwrites built-in
Close array.
Best regards,Tomasz Janeczkoamibroker.com
<BLOCKQUOTE
>
----- Original Message -----
<DIV
>From:
<A title=jcasavant@xxxxxxxxxxxx
href="">Jayson
To: <A title=amibroker@xxxxxxxxxxxxxxx
href="">1ami
Sent: Monday, April 28, 2003 4:12
PM
Subject: [amibroker] for loop
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++ )
{
<FONT
color=#000000>C[ i ] = <FONT
color=#000000>C<FONT
color=#282828>[ i-1
]+C<FONT face=Arial
color=#282828 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 (<FONT
color=#0000ff>Cum(<FONT
color=#ff00ff>1)==1<SPAN
class=966553613-28042003>)
<FONT
color=#000000>C[ i ] = <FONT
color=#ff00ff>50<FONT face=Arial
size=2>;
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 face=Arial color=#0000ff
size=2>Jayson
Send
BUG REPORTS to bugs@xxxxxxxxxxxxxSend SUGGESTIONS to
suggest@xxxxxxxxxxxxx-----------------------------------------Post
AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx (Web page: <A
href="">http://groups.yahoo.com/group/amiquote/messages/)--------------------------------------------Check
group FAQ at: <A
href="">http://groups.yahoo.com/group/amibroker/files/groupfaq.html
Your use of Yahoo! Groups is subject to the <A
href="">Yahoo! Terms of Service.
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.
|