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

RE: [amibroker] for loop



PureBytes Links

Trading Reference Links




Thank 
you UM
 Jayson 
<FONT face=Tahoma 
size=2>-----Original Message-----From: uenal.mutlu@xxxxxxxxxxx 
[mailto:uenal.mutlu@xxxxxxxxxxx]Sent: Monday, April 28, 2003 10:26 
AMTo: amibroker@xxxxxxxxxxxxxxxSubject: Re: [amibroker] 
for loop
Hi, try this:
 
C[0] = 50;for(i = 1; i < BarCount; i++)  
C[i] = C[i-1] + C[i];
 
<BLOCKQUOTE 
>
  ----- Original Message ----- 
  <DIV 
  >From: 
  <A href="" 
  title=jcasavant@xxxxxxxxxxxx>Jayson 
  To: <A 
  href="" 
  title=amibroker@xxxxxxxxxxxxxxx>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 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 (<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 color=#0000ff face=Arial 
  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.