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

RE: [amibroker] If Then...



PureBytes Links

Trading Reference Links




<FONT face=Arial color=#0000ff 
size=2>Lou,
I 
think you have made it more difficult than need be. First take a look at the 
syntax for foreign() , do you want AB to fix the "holes" or leave them be?? You 
may want to leave the default fixup...
<FONT face=Arial color=#0000ff 
size=2> 
 Cc = <FONT 
size=1>Foreign("~Low Cap 
Count", "C<SPAN 
class=290174313-20042004>");
 
To 
simply replace the value I do not think a loop is needed , instead use 
IIF...

X=IIf(CC > 
1.08<FONT color=#282828 
size=2>*Ref<FONT face=Arial 
color=#282828 size=2>(CC<FONT 
face=Arial color=#282828 size=2>,-<FONT face=Arial color=#ff00ff 
size=2>1)<FONT color=#282828 
size=2> OR<FONT 
color=#282828 size=2> CC < 0.92<FONT 
color=#282828 size=2>*<FONT face=Arial color=#0000ff 
size=2>Ref(<FONT 
color=#282828 size=2>Cc<FONT face=Arial color=#282828 
size=2>,-1<FONT face=Arial 
color=#282828 size=2>),<FONT 
color=#0000ff size=2>Ref(cc,-<FONT 
color=#ff00ff size=2>1),cc);
Which states "if cc 
is greater than 1.08 times yesterdays value OR if cc is less than .92*yesterdays 
value THEN X= yesterdays value ELSE use today's value"
You can use X in 
calculations or simply plot it as I did below....
<FONT 
color=#282828 size=2> 
Cc = Foreign<FONT 
size=2>("~Low Cap Count", <FONT 
size=2>"C");
X=<FONT color=#0000ff 
size=2>IIf(CC > <FONT color=#ff00ff 
size=2>1.08*<FONT face=Arial 
color=#0000ff size=2>Ref<FONT face=Arial color=#282828 
size=2>(CC<FONT face=Arial 
color=#282828 size=2>,-<FONT face=Arial color=#ff00ff 
size=2>1)<FONT color=#282828 
size=2> OR<FONT 
color=#282828 size=2> CC < 0.92<FONT 
color=#282828 size=2>*<FONT face=Arial color=#0000ff 
size=2>Ref(<FONT 
color=#282828 size=2>Cc<FONT face=Arial color=#282828 
size=2>,-1<FONT face=Arial 
color=#282828 size=2>),<FONT 
color=#0000ff size=2>Ref(cc,-<FONT 
color=#ff00ff size=2>1),cc);<FONT 
color=#0000ff size=2>
Plot(x,<FONT color=#ff00ff 
size=2>"Corrected Composite",<FONT 
color=#ff00ff size=2>4,<FONT 
color=#ff00ff size=2>1<FONT color=#282828 
size=2>);
Regards,Jayson 
 

  <FONT face=Tahoma 
  size=2>-----Original Message-----From: lhoward121@xxxxxxxxxxxxx 
  [mailto:lhoward121@xxxxxxxxxxxxx]Sent: Tuesday, April 20, 2004 
  12:06 AMTo: amibroker@xxxxxxxxxxxxxxxSubject: Re: 
  [amibroker] Help with a Composite Filter
  Hi Jayson, 
   
  Thanks for the reply.  I caught the missing quotes 
  right after sending the e-mail.  
   
  What I'm trying to do is to erase a bad value in the 
  composite and replace it with the previous value hence the assignment in the 
  last line (which doesn't work).  I am now trying to replace the composite 
  array with the 'corrected' cc array as I don't know how to replace a single 
  element in the composite.
   
  thanks again
  lou howard
  <BLOCKQUOTE dir=ltr 
  >
    ----- Original Message ----- 
    <DIV 
    >From: 
    <A title=jcasavant@xxxxxxxxxxx 
    href="">Jayson 
    To: <A title=amibroker@xxxxxxxxxxxxxxx 
    href="">amibroker@xxxxxxxxxxxxxxx 
    Sent: Monday, April 19, 2004 11:41 
    PM
    Subject: RE: [amibroker] Help with a 
    Composite Filter
    <FONT 
    size=2>
    <FONT face=Arial color=#0000ff 
    size=2>Lou,
    <FONT face=Arial color=#0000ff 
    size=2>Your error comes from a syntax error in line 1. note that field 
    information in a foreign call requires quotes, so..
    Cc = Foreign(<FONT 
    color=#ff00ff>"~Low Cap Count", <SPAN 
    class=049193703-20042004>"C<SPAN 
    class=049193703-20042004>", fixup = 
    0);
     
    I am a bit lost as to what 
    you are trying to do in the last line but for one thing you would need to 
    make an assignment, something like X=bla, bla. that in its self does not fix 
    the problem. What are you trying to do??
    Regards,Jayson 
    
      <FONT face=Tahoma 
      size=2>-----Original Message-----From: lhoward121@xxxxxxxxxxxxx 
      [mailto:lhoward121@xxxxxxxxxxxxx]Sent: Monday, April 19, 2004 
      11:18 PMTo: AmiBroker GroupSubject: [amibroker] Help 
      with a Composite Filter
       
      I want to filter a composite to get rid of 
      irregularities caused by bad data.  The following code does not 
      work.  The first line gives a "bad arguments" error so I havn't 
      gotten beyond it yet.  There is also a question on the validity of 
      the last line assigning a value from cc[i] to the composite.  Any 
      help or thoughts would be appreciated.
       
      lou howard
      
      Cc = Foreign<FONT 
      size=1>("~Low Cap Count"<FONT 
      size=1>, C, fixup = 
      0<FONT 
      size=1>);
      for (i = <FONT 
      face="Courier New" color=#ff00ff size=1>1<FONT face="Courier New" 
      size=1>; i < BarCount -1 ; i++)
      {
      <FONT face="Courier New" color=#800000 
      size=1>    if 
      (Cc[i] > <FONT face="Courier New" color=#ff00ff 
      size=1>1.08*Cc[i-<FONT 
      face="Courier New" color=#ff00ff size=1>1<FONT face="Courier New" 
      size=1>] OR Cc[i] < <FONT face="Courier New" 
      color=#ff00ff size=1>0.92<FONT face="Courier New" 
      size=1>*Cc[i-<FONT face="Courier New" color=#ff00ff 
      size=1>1]);
      Cc[i] = Cc[i-<FONT face="Courier New" color=#ff00ff 
      size=1>1];<FONT 
      face="Courier New" color=#0000ff size=1>
      <FONT color=#0000ff 
      size=1>Foreign("~Low 
      Cap Count", C, <FONT color=#ff00ff 
      size=1>0)[i] = Cc[i];<FONT 
      face="Courier New" size=1>
      }
       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 
      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 
      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 
  


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








Yahoo! Groups Links
To visit your group on the web, go to:http://groups.yahoo.com/group/amibroker/ 
To unsubscribe from this group, send an email to:amibroker-unsubscribe@xxxxxxxxxxxxxxx 
Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.