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

Re: [amibroker] I give up



PureBytes Links

Trading Reference Links




Thanks a lot Dingo
 
Regards
 
Prashanth
<BLOCKQUOTE dir=ltr 
>
  ----- Original Message ----- 
  <DIV 
  >From: 
  dingo 
  To: <A title=amibroker@xxxxxxxxxxxxxxx 
  href="">amibroker@xxxxxxxxxxxxxxx 
  Sent: Saturday, April 17, 2004 11:55 
  PM
  Subject: RE: [amibroker] Multiple file 
  Import
  
  <SPAN 
  class=984572118-17042004>EOD Export To AFL is a separate file that will export 
  the quotes from the EOD database:
  <SPAN 
  class=984572118-17042004> 
  <SPAN 
  class=984572118-17042004>One thing I left out of the notes is that you need to 
  have an instance of Amibroker running before you run the script. It doesn't 
  matter what database it's pointing to as that will be set by the 
  script.
  <SPAN 
  class=984572118-17042004> 
  <SPAN 
  class=984572118-17042004>Here is the AFL formula:
  <SPAN 
  class=984572118-17042004> 
  <SPAN 
  class=984572118-17042004>Buy=Sell=Short=Cover=0;Filter=Status("LastBarInTest");// 
  The following code exports quotes of current stock to quotes.csv comma 
  separated filePath = "C:\\Program Files\\AmiBroker\\Output\\";fh = 
  fopen( Path+Name()+"-EOD.csv", "w");if( fh 
  )        
  {//      fputs( 
  "Date,Open,High,Low,Close,Volume\n", fh );
   
  <SPAN 
  class=984572118-17042004>        y = 
  Year();        m = 
  Month();        d = 
  Day();
   
  <SPAN 
  class=984572118-17042004>        for( i = 
  0; i < BarCount; i++ 
  )                
  {                
  ds = StrFormat("%02.0f-%02.0f-%02.0f,", y[ i ], m[ i ], d[ i ] 
  );                
  fputs( ds, fh );
   
  <SPAN 
  class=984572118-17042004>                
  qs = StrFormat("%.4f, %.4f, %.4f, %.4f, %.0f\n", O[ i ], H[ i ], L[ i ], C[ i 
  ], V[ i ] 
  );                
  fputs( qs, fh 
  );                
  }        fclose( fh 
  );        }
  
    <SPAN 
    class=984572118-17042004><FONT face=Arial color=#0000ff 
    size=2>d 
    <SPAN 
    class=984572118-17042004> 
    
    
    
    <FONT 
    face=Tahoma size=2>From: Prashanth 
    [mailto:prash454@xxxxxxxxxxxxxxxxx] Sent: Saturday, April 17, 
    2004 1:56 PMTo: amibroker@xxxxxxxxxxxxxxxSubject: Re: 
    [amibroker] Multiple file Import
    
    Hi dingo,
     
    Thanks for the Code. A small query, in the code 
    you have reffered to EOD Export.afl. What I want to know is should I save 
    this file also as EOD Export.afl alongwith Export.vbs or is there any other 
    file.
     
    Thanks
     
    Prashanth
    <BLOCKQUOTE dir=ltr 
    >
      ----- Original Message ----- 
      <DIV 
      >From: 
      dingo 
      
      To: <A 
      title=amibroker@xxxxxxxxxxxxxxx 
      href="">amibroker@xxxxxxxxxxxxxxx 
      
      Sent: Saturday, April 17, 2004 9:05 
      PM
      Subject: RE: [amibroker] Multiple 
      file Import
      
      <FONT face=Arial 
      color=#0000ff size=2>Just wanted to post the latest version - I've added a 
      lot of comments that should help. 
      <FONT face=Arial 
      color=#0000ff size=2> 
      <FONT 
      color=#0000ff><FONT face="Courier New" 
      size=1>'**************************************'Purpose: Run A 
      Procedure in 
      Amibroker'         that will 
      export quotes from'         
      one database into CSV files 
      '         and then import them 
      into '         another 
      database.''Operation: Name this file whatever 
      you'         wish but give it 
      an extension'         of vbs. 
      Place it in your'         
      Amibroker folder and run 
      it'         by double clicking 
      on the file'         
      name.'  '         
      Make sure that you change 
      those'         lines under the 
      !!!!!!! lines'         to 
      match your 
      system.''         Make 
      sure that you have the 
      '         correct format file 
      in the '         format 
      folder.''The Code: Is written in VB Script and 
      '         runs within "Windows 
      Scripting'         Host 
      (WSH)". I have 
      included'         many 
      commented out msgbox 
      lines'         that you can 
      uncomment if you're'         
      having problems. That way 
      you'         have a way to 
      monitor the progress'         
      of the script as it executes.''vbScript Help: The following links 
      will'         provide 
      information on 
      VBScript:'         (Be careful 
      of folded lines)'' <A 
      href=""><FONT 
      face="Courier New" 
      size=1>http://msdn.microsoft.com/library/default.asp?url="";><FONT 
      face="Courier New" size=1>'' <A 
      href=""><FONT 
      face="Courier New" 
      size=1>http://msdn.microsoft.com/library/default.asp?url="";><FONT 
      face="Courier New" size=1>'' <A 
      href=""><FONT 
      face="Courier New" 
      size=1>http://www.microsoft.com/technet/community/scriptcenter/default.mspx<FONT 
      face="Courier New" size=1>'' <A 
      href=""><FONT 
      face="Courier New" 
      size=1>http://groups.msn.com/windowsscript/_homepage.msnw?pgmarket=en-us<FONT 
      face="Courier New" size=1>''Created By: 
      dingo'**************************************
       
      <FONT 
      face="Courier New" color=#0000ff size=1>Dim oABDim oAADim 
      fsoDim fldrDim flsDim fleDim flenamDim 
      result
       
      <FONT 
      face="Courier New" color=#0000ff size=1>dim RT_DB_Pathdim 
      EOD_DB_Pathdim Frmla_Pathdim CSV_Dirdim CSV_FleNamdim 
      FmtFleNam
       
      <FONT 
      face="Courier New" color=#0000ff 
      size=1>'!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!' 
      change the following paths to suit your 
      configuration'!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!RT_DB_Path 
      = "C:\Program Files\Amibroker\Data"EOD_DB_Path = "C:\Program 
      Files\Amibroker\TC2000"Frmla_Path = "C:\Program 
      Files\Amibroker\AFL\EOD Export.Afl"CSV_Dir = "C:\Program 
      Files\Amibroker\Output"FmtFleNam = 
      "EOD_To_RT.Format"
       
      <FONT 
      face="Courier New" color=#0000ff size=1>' declare object for Amibroker and 
      the file system objectset oAB = 
      CreateObject("Broker.Application")Set oAA = oAB.Analysisset fso = 
      CreateObject("Scripting.FileSystemObject")
       
      <FONT 
      face="Courier New" color=#0000ff 
      size=1>'------------------------------------------' Delete all csv 
      files in the CSV folder' so that we don't import any old ones' 
      that may still be 
      there'------------------------------------------'wscript.echo 
      "Cleaning Out " + 
      CSV_Dir'------------------------------------------' set the folder 
      object'------------------------------------------Set fldr = 
      fso.GetFolder(CSV_Dir)'------------------------------------------' 
      set the files object'------------------------------------------Set 
      fls  = fldr.FilesFor Each fle in fls    flenam 
      = fle.name    
      '------------------------------------------    ' make 
      sure its a csv file    
      '------------------------------------------    if 
      right(ucase(flenam), 4) = ".CSV" 
      then        
      '------------------------------------------        
      ' Delete this old file        
      '------------------------------------------        
      fle.Delete    end 
      ifNext'------------------------------------------' destroy the 
      folder and file 
      objects'------------------------------------------set fle = 
      nothingset fls = 
      nothing '------------------------------------------' Set 
      from and to dates, and the 
      watchlist'------------------------------------------with 
      oAA    
      '!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!    
      ' change the following settings to suit your 
      configuration    
      '!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!    
      .RangeMode = 3    .RangeFromDate = 
      "01/01/2001"    .RangeToDate = 
      "12/31/2002"    ClearFilters    
      .ApplyTo = 2    .Filter(0, "watchlist") = 29end 
      with '------------------------------------------' The 
      following is the "main" code for the' exporting and importing of the 
      data'------------------------------------------' Load EOD Data 
      Base'------------------------------------------'wscript.echo 
      "Loading EOD Database: " + EOD_DB_PathIf 
      oAB.LoadDatabase(cstr(EOD_DB_Path)) Then    
      '------------------------------------------    ' Load 
      the AFL for Building the CSV File    
      '------------------------------------------    
      'wscript.echo "Loading AFL: " + Frmla_Path    if 
      oAA.LoadFormula(cstr(Frmla_Path)) 
      Then        
      '------------------------------------------        
      ' Run The Scan        
      '------------------------------------------        
      'wscript.echo "Running Scan"        
      result = oAA.Scan         
      '------------------------------------------        
      ' now load the RT Database        
      '------------------------------------------        
      'wscript.echo "Loading RT Database: " + 
      RT_DB_Path        If 
      oAB.LoadDatabase(cstr(RT_DB_Path)) 
      Then            
      '------------------------------------------            
      ' import each csv file in the EODexports folder 
                  ' 
      set the files 
      object            
      '------------------------------------------            
      Set fls  = 
      fldr.Files            
      For Each fle in 
      fls                
      flenam = 
      fle.name                
      '------------------------------------------                
      ' make sure its a csv 
      file                
      '------------------------------------------                
      if right(ucase(flenam), 4) = ".CSV" 
      then                    
      '------------------------------------------                    
      ' Import the CSV File using the correct 
      format                    
      '------------------------------------------                    
      CSV_FleNam = CSV_Dir + "\" + 
      flenam                    
      'wscript.echo "Importing " + 
      CSV_FleNam                    
      result = oAB.Import(0, cstr(CSV_FleNam), cstr(FmtFleNam)) 
                          
      if result <> 0 
      Then                        
      msgbox "Error Running 
      Import"                        
      Exit 
      For                    
      end 
      if                
      end 
      if            
      Next    
                  
      oAB.RefreshAll()            
      'wscript.echo "Saving RT 
      Database"            
      oAB.SaveDataBase            
      MsgBox "Finished"        
      Else            
      msgbox "Can't Load RT 
      Database"        End 
      IF    
      else        msgbox "Can't Load EOD 
      Export.Afl"    End If    
      Else    MsgBox "Cant Load EOD Database"End 
      If
       
      <FONT 
      face="Courier New" color=#0000ff 
      size=1>'------------------------------------------' destroy all 
      objects'------------------------------------------set fle = 
      nothingset fls = nothingset fldr = nothingset fso = 
      nothing
       
      <FONT 
      face="Courier New" color=#0000ff size=1>Set oAA = Nothingset oAB = 
      nothing<FONT 
      face=Arial color=#0000ff size=2>d
      
        
        
        From: Prashanth 
        [mailto:prash454@xxxxxxxxxxxxxxxxx] Sent: Saturday, April 17, 
        2004 4:54 AMTo: amibroker@xxxxxxxxxxxxxxxSubject: 
        Re: [amibroker] Multiple file Import
        
        Hi Graham,
         
        The reason for 2 Files is like this. I am 
        just checking out how the Forex markets Trade and whether my TA methods 
        work there. While there are paid services available, since I do not 
        intend (atleast for now) to trade, I am trying to use whatever freeforex 
        data is available. Someone on this group (I dont remember the name, 
        Sorry) was kind enough to give some links where one could find free 
        forex data. Data is available upto the time I download, 
      


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.