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

Re: [amibroker] Re: How to detect if 'foreign' is successful or not ?



PureBytes Links

Trading Reference Links





Hello,
Just follow up --- if you want to use if-else you have to 
convert ARRAY to just a number.There are many ways to do that. One of 
possibilities is using LastValue function:
f = Foreign<FONT 
face="Courier New" size=1>(<FONT face="Courier New" color=#ff00ff 
size=1>"MSFT<FONT face="Courier New" 
color=#ff00ff size=1>",<FONT 
face="Courier New" color=#ff00ff size=1>"C"<FONT face="Courier New" 
size=1>);
if( <FONT color=#0000ff 
size=1>L<FONT face="Courier New" color=#0000ff 
size=1>astValue( 
IsNull( f ) <FONT 
face="Courier New" size=1>) )
{
result = "No such 
symbol";
}
else
{ 
result = "symbol 
exists";
}<FONT face="Courier New" 
size=1>
result;
Best regards,Tomasz Janeczkoamibroker.com
<BLOCKQUOTE 
>
  ----- Original Message ----- 
  <DIV 
  >From: 
  Tomasz Janeczko 
  
  To: <A title=amibroker@xxxxxxxxxxxxxxx 
  href="">amibroker@xxxxxxxxxxxxxxx 
  Sent: Wednesday, April 30, 2003 4:29 
  PM
  Subject: Re: [amibroker] Re: How to 
  detect if 'foreign' is successful or not ?
  
  Salil,
   
  The code has syntax error.
   
  Foreign returns array. IsEmpty from ARRAY is also 
  ARRAY.
  You can not use ARRAYS in conjunction with if because it 
  requires
  single value (it has to decide YES or NO whenever one 
  or other execution path
  should be choosen - and ARRAY has multiple 
  values)
   
  BTW: you are using OLD version of the program because 
  newer
  one would give you appropriate ERROR MESSAGE in this 
  case.
   
  Best regards,Tomasz Janeczkoamibroker.com
  <BLOCKQUOTE 
  >
    ----- Original Message ----- 
    <DIV 
    >From: 
    Salil V 
    Gangal 
    To: <A title=amibroker@xxxxxxxxxxxxxxx 
    href="">amibroker@xxxxxxxxxxxxxxx 
    Sent: Wednesday, April 30, 2003 4:24 
    PM
    Subject: RE: [amibroker] Re: How to 
    detect if 'foreign' is successful or not ?
    
    
    Chuck,
     
    Nope ... this technique was 
    not 'successful' when I tried.  Code I 
    used in 'Guru' was ===>
     
    
      
      x = <FONT 
      color=#0000ff size=1>IsEmpty<FONT color=#000000 
      size=1>(Foreign<FONT 
      color=#000000 size=1>("<FONT 
      color=#ff00ff size=1>MSFT"<FONT 
      color=#000000 size=1>,<FONT color=#ff00ff 
      size=1>"Close",fixup=<FONT 
      color=#ff00ff size=1>1<FONT color=#000000 
      size=1>));
      if (x) {
         message = <FONT 
      face=courier color=#ff00ff size=1>"x is true"<FONT color=#000000 
      size=1>;
      }
      else {
          message = <FONT 
      face=courier color=#ff00ff size=1>"x is false"<FONT color=#000000 
      size=1>;
      }
      message;<FONT color=#000000 
size=1>
      x = <FONT 
      color=#0000ff size=1>IsEmpty<FONT color=#000000 
      size=1>(Foreign<FONT 
      color=#000000 size=1>("<FONT 
      color=#ff00ff size=1>Non_existant_ticker<FONT color=#ff00ff 
      size=1>",<FONT color=#ff00ff 
      size=1>"Close",fixup=<FONT 
      color=#ff00ff size=1>1<FONT color=#000000 
      size=1>));
      i<FONT 
      face=courier>f (x) {
          message = <FONT 
      face=courier color=#ff00ff size=1>"x is true"<FONT color=#000000 
      size=1>;
      }
      else {
          message = <FONT 
      face=courier color=#ff00ff size=1>"x is false"<FONT color=#000000 
      size=1>;
      }
      message;
     
    Regards,
    - Salil V 
    GangalSalil V Gangal 
    <salil_gangal@xxxxxxxxx> wrote:
    <BLOCKQUOTE 
    >
      Chuck,
       
      If you get a chance, try the example I gave in 
      'Guru'.  Use one of the tickers that exists in the database 
      and one that does not.  Please let me know if this technique is 
      'successful' (!) or not.
       
      Regards,
      - Salil V 
      GangalChuck Rademacher 
      <chuck_rademacher@xxxxxxxxxx> wrote:
      <BLOCKQUOTE 
      >
        
        <FONT face=Arial color=#0000ff 
        size=2>Why can't you just say:
        <FONT face=Arial color=#0000ff 
        size=2> 
        <FONT face=Arial color=#0000ff 
        size=2>x = 
        IsEmpty(Foreign("Symbol","Close",fixup=1));
        <FONT face=Arial color=#0000ff 
        size=2> 
        <FONT face=Arial color=#0000ff 
        size=2>This should work if your Foreign instrument has no 
        holes and the date range is the same or longer than the stock you are 
        evaluating at the time.
        <FONT face=Arial color=#0000ff 
        size=2> 
        <FONT face=Arial color=#0000ff 
        size=2>Works for me... unless I don't understand the 
        question.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. 
      
      
      Do you Yahoo!?<A 
      href="">The 
      New Yahoo! Search - Faster. Easier. Bingo. 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. 
      
    
    
    Do you Yahoo!?<A 
    href="">The 
    New Yahoo! Search - Faster. Easier. Bingo. 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. 
    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.