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

Re: TJ - Re: [amibroker] Sector Rotation ... Finally - VBscript: HELP



PureBytes Links

Trading Reference Links





Ara,
 
AmiBroker handles only numeric arrays. Technically 
speaking
it accepts COM variants of VT_ARRAY | VT_VARIANT 
type.
 
Your code seems to generate array of strings 
instead.
 
THe quickest way to ensure proper type of the array is to 
make
a copy of AMiBroker's array:
 
EnableScript("vbscript");
<%
 
myarray = AFL("close"); ' myarray is a copy of close array and 
this ensures its proper type
 
%>
 
and don't use Dim() , Redim() at all
Best regards,Tomasz Janeczkoamibroker.com
<BLOCKQUOTE 
>
  ----- Original Message ----- 
  <DIV 
  >From: 
  Ara Kaloustian 
  
  To: <A title=amibroker@xxxxxxxxxxxxxxx 
  href="">amibroker@xxxxxxxxxxxxxxx 
  Sent: Tuesday, February 11, 2003 4:48 
  PM
  Subject: TJ - Re: [amibroker] Sector 
  Rotation ... Finally - VBscript: HELP
  
  d 
   
  Thanks for the suggestion .... still have same 
  problem
   
  I tried converting the VBS read strLine before 
  passing array back to AFL to:
   
  <FONT 
  face=Arial>arrBuyArray(intSize) = 
  Left(strLine,1)              
  - Remove any CntFeed characters
  <FONT 
  face=Arial>arrBuyArray(intSize) = 
  Cint(strLine)                
  - Convert to integer
  <FONT 
  face=Arial>arrBuyArray(intSize) = 
  Cint(Left(strLine,1))      - 
  Convert to integer after removing CntFeed
   
  No luck... AFL still gives "Mismatch - Assignment 
  failed" error 
   
  Hope TJ sees this.... 
   
  Ara 
  <BLOCKQUOTE 
  >
    ----- Original Message ----- 
    <DIV 
    >From: 
    dingo 
    To: <A title=amibroker@xxxxxxxxxxxxxxx 
    href="">amibroker@xxxxxxxxxxxxxxx 
    Sent: Tuesday, February 11, 2003 7:00 
    AM
    Subject: RE: [amibroker] Sector 
    Rotation ... Finally - VBscript: HELP
    
    <FONT face=Tahoma color=#0000ff 
    size=2>The only thing I can think of is that if there is a crlf at the end 
    of each line that you're putting them in as well as the 1 or 0.  Try 
    this:
    <FONT face=Tahoma color=#0000ff 
    size=2> 
    <FONT 
    size=2>arrBuyArray(intSize) = <FONT 
    face=Tahoma color=#0000ff> Left( strLine<SPAN 
    class=688285814-11022003><FONT face=Tahoma 
    color=#0000ff> ,1) 
    <FONT face=Tahoma 
    color=#0000ff size=2><SPAN 
    class=688285814-11022003> 
    <FONT face=Tahoma 
    color=#0000ff size=2>This assumes that you 
    have a 1 or 0 in each line. If a line contains something other than 1 or 0 
    or is missing either you'll need to allow for 
    that.
    <FONT face=Tahoma 
    color=#0000ff size=2><SPAN 
    class=688285814-11022003> 
    <FONT face=Tahoma 
    color=#0000ff size=2>Hope this gets you 
    going.
    <FONT face=Tahoma 
    color=#0000ff size=2><SPAN 
    class=688285814-11022003> 
    <FONT face=Tahoma 
    color=#0000ff size=2><SPAN 
    class=688285814-11022003>d
    
      
      <FONT 
      face=Tahoma size=2>-----Original Message-----From: Ara 
      Kaloustian [mailto:ara1@xxxxxxxxxx] Sent: Tuesday, February 11, 
      2003 9:49 AMTo: amibroker@xxxxxxxxxxxxxxxSubject: 
      Re: [amibroker] Sector Rotation ... Finally - VBscript: 
      HELP
      d
       
      The buy / sell file is one character per 
      line:  
                    
      objBuyFile.WriteLine 1
       
      Reading back: 
      intSize = 0Do While objFile.AtEndOfStream 
      = False   strLine = objFile.ReadLine
       
         ReDim Preserve 
      ArrBuyArray(intSize)   arrBuyArray(intSize) = 
      strLine   intSize = 
      intSize+1LoopobjFile.Close
       
      Transfer back to 
      AFL:        AFL("BuyArray") = 
      arrBuyArray  
       
      So the final presentation to AFL should be 
      101010 type sequence
       
      Thanks
       
      Ara
      <BLOCKQUOTE 
      >
        ----- Original Message ----- 
        <DIV 
        >From: 
        dingo 

        To: <A 
        title=amibroker@xxxxxxxxxxxxxxx 
        href="">amibroker@xxxxxxxxxxxxxxx 
        
        Sent: Tuesday, February 11, 2003 
        6:03 AM
        Subject: RE: [amibroker] Sector 
        Rotation ... Finally - VBscript: HELP
        
        <FONT face=Tahoma color=#0000ff 
        size=2>How did you write the file out to disk? IOW is it jut 
        1010010  or did you separate them with commas?
        <FONT face=Tahoma color=#0000ff 
        size=2> 
        <FONT face=Tahoma color=#0000ff 
        size=2>You need to know that in order to load the 
        array's..
        <FONT face=Tahoma color=#0000ff 
        size=2> 
        <FONT face=Tahoma color=#0000ff 
        size=2>d
        
          
          <FONT 
          face=Tahoma size=2>-----Original Message-----From: Ara 
          Kaloustian [mailto:ara1@xxxxxxxxxx] Sent: Tuesday, February 
          11, 2003 12:54 AMTo: AmiBroker - BBSubject: 
          [amibroker] Sector Rotation ... Finally - VBscript: 
          HELP
          We're almost there...
           
          Completed code in 3 
sections:
          1. Export data files from AFL to VBS to 
          disk
          2. Data processing - process data and 
          create buy / sell arrays
          3. Import processed Buy / Sell arrays 
          back to AFL
           
          Current problem interfacing with 
          AFL...
           
          The Buy Sell arrays are VBS  files 
          with "1" and "0" read into arrays to send back to AFL
           
          When I bring them back, I get AFL error 
          saying "Missmatch,  Assignment Failed. One message for each array 
          transferred back.
           
          Anyone with suggestions?
           
          Thanks
           
          Ara
           
          
          //File - DEV - Sector Rotation #3 - VB to AFL<FONT 
          size=1>
           
           
          Ticker = Name<FONT 
          size=1>();
          EnableScript(<FONT color=#ff00ff 
          size=1>"vbscript");
          <%
          VBS code ..... to read disk file
          
          AFL("BuyArray"<FONT 
          size=1>) = arrBuyArray '* Transfer array back to AFL 
          AFL("SellArray"<FONT 
          size=1>)= ArrSellArray
          %>
          BuyPrice = Close;
          SellPrice = Close;
          Buy = BuyArray;
          Sell= SellArray;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. 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. 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. 
      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. 
    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. 




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.