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

RE: [amibroker] refresh all after exploration



PureBytes Links

Trading Reference Links




<SPAN 
class=755390903-21122003>I understand how to know when I'm at the end of a known 
watchlist. 
<SPAN 
class=755390903-21122003> 
<SPAN 
class=755390903-21122003>I'm looking for a way to know when I'm at the end of 
the stocks being processed, whether they come from a watchlist, a market, all 
stocks, a market but excluding a sector and a watchlist, whatever. The feature I 
suggested also keeps you from having to change your AFL or use parameters to run 
the same code against a different watchlist.
<SPAN 
class=755390903-21122003> 
<SPAN 
class=755390903-21122003>Dave
<BLOCKQUOTE 
>
  Faster again at finding when the Exploration 
  has reached the final stock in a watchlist. Try this 
  AFL-
   
   
  // -------------------------------------------- 
  //
  watchlistnum = 4; //set to 
  current watchlist 
  Length = 3; //<FONT 
  face="Courier New" color=#008000>set to minimum 
  ticker string length
  // -------------------------------------------- 
  //
  List = GetCategorySymbols( 
  categoryWatchlist, WatchlistNum);
  do
  {
  Length++;
  Ticker = StrRight(list,Length);
  }
  while(StrLeft(Ticker,1)!=",");
  Ticker = StrRight(list,Length-<FONT 
  face="Courier New" color=#ff00ff>1);
  if(ticker == Name())
  { 
  // place code to be excuted at end of exploration 
  here
  Laststock = 1;
  }
  else<FONT 
  face="Courier New">
  {Laststock = <FONT 
  color=#ff00ff>0;}
  Filter=1;
  <FONT 
  color=#000000>AddColumn(Laststock,"Laststock");<FONT 
  color=#0000ff>
  AddColumn(Status("StockNum"),"<FONT 
  face="Courier New">StockNum");
   
  This is the final version (I think)
  HTH
  Andrew.
  <BLOCKQUOTE 
  >
    ----- Original Message ----- 
    <DIV 
    >From: 
    Andrew 
    Perrin 
    To: <A title=amibroker@xxxxxxxxxxxxxxx 
    href="">amibroker@xxxxxxxxxxxxxxx 
    Sent: Sunday, December 21, 2003 9:57 
    AM
    Subject: Re: [amibroker] refresh all 
    after exploration
    
    Dave 
    Better still, try the below code.  No need 
    to save values to external tables etc.  It does initiate a loop thru 
    watchlist tickers for each ticker during your exploration, which will slow 
    things down a bit, but it also terminates the loop as soon as it determines 
    the current stock isn't the last in the watchlist.  I've set the 
    exploration to simply add 2 columns, one with the stock statusnum, the other 
    simple sets LastStock to 1 for the last stock in the 
    watchlist. 
     
    // 
    -------------------------------------------- //
    watchlistnum = 4; 
    //set to current 
    watchlist 
    // 
    -------------------------------------------- //
    Laststock = <FONT 
    color=#ff00ff>0;
    StatusNum = <FONT 
    color=#0000ff>Status(<FONT 
    color=#ff00ff>"StockNum");
    List = <FONT 
    color=#0000ff>GetCategorySymbols( categoryWatchlist, 
    WatchlistNum);
    for<FONT 
    face=Arial size=2> (j=0; (sTicker = StrExtract (List , j)) !=""; j++ 
    )
    {
    if<FONT 
    face=Arial size=2>(j > StatusNum){J=99999;} <FONT face=Arial 
    size=2>//terminate loop once established stock is not last in 
    watchlist
    }
    if<FONT 
    face=Arial size=2>(j != 100000)
    { <FONT 
    face="Courier New"><FONT face="Courier New" color=#008000 
    size=2>
    // place code to be excuted at end of 
    exploration here
    Laststock = <FONT 
    color=#ff00ff>1;
    }
    Filter=<FONT 
    color=#ff00ff>1;
    <FONT face=Arial 
    size=2>AddColumn<FONT face=Arial 
    size=2>(Laststock,"Laststock");
    <FONT face=Arial 
    size=2>AddColumn<FONT face=Arial 
    size=2>(StatusNum,"statusNum");
     
    Hope this is of some use
     
    Andrew
    <BLOCKQUOTE 
    >
      ----- Original Message ----- 
      <DIV 
      >From: 
      Andrew 
      Perrin 
      To: <A 
      title=amibroker@xxxxxxxxxxxxxxx 
      href="">amibroker@xxxxxxxxxxxxxxx 
      
      Sent: Sunday, December 21, 2003 8:55 
      AM
      Subject: Re: [amibroker] refresh all 
      after exploration
      
      Dave
      why not use 
      (Status("StockNum") == 0)  to initiate a watchlist count, something 
      like<FONT 
      size=1>
      watchlistnum = <FONT 
      color=#ff00ff>1;
      List = <FONT 
      color=#0000ff>GetCategorySymbols( categoryWatchlist, 
      WatchlistNum);
      <FONT 
      face=Arial>for (j=<FONT 
      color=#ff00ff>0; (sTicker = StrExtract 
      (List , j)) !=""; j++ )<FONT 
      face="Courier New">
      { Count = j;}
       
      Then save the value of count using Osaka or possibly 
      the new AB File Input/Output functions (I've not totally 
      sorted out these functions myself yet).  Then at the end of 
      exploration code, retreive Count value and then use something 
      like
      if (Status("StockNum") == 
count)
          { the 
      code you want to excute at end of exploration }
       
      These are ideas, I've not 
      tried them but will later on today.
       
      <FONT 
      face=Arial>Andrew
      <BLOCKQUOTE 
      >
        ----- Original Message ----- 
        <DIV 
        >From: 
        Dave 
        Merrill 
        To: <A 
        title=amibroker@xxxxxxxxxxxxxxx 
        href="">amibroker@xxxxxxxxxxxxxxx 
        
        Sent: Sunday, December 21, 2003 
        3:15 AM
        Subject: [amibroker] refresh all 
        after exploration
        I know the following code refreshes all watchlists 
        etc:AB = 
        CreateObject("Broker.Application");AB.RefreshAll();How can I 
        get this to run once, at the end of an 
        exploration?Status("StockNum") == 0 is true for only the first 
        stock, but unless theexploration is running on a watchlist and I 
        hard code its number into my AFLto find the number of stocks in it, 
        I don't see any way to detect when I'mon the LAST stock.Can 
        this be done?If not, Tomasz, please consider this a request for 
        some feature that wouldallow it. Status("LastIssue") would do 
        it.A more flexible thing I'd love to see is a way to get the 
        list of all stocksin the current backtest or exploration, something 
        likeStatus("IssuesInTest"), or a reserved variable, maybe 
        IssuesInTest. Thosewould be very useful in any case, for calculating 
        averages or otherquasi-composites on the stocks being 
        tested.Dave MerrillSend 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 
        
        
        Yahoo! Groups Links
        
          To visit your group on the web, go to:<A 
          href="">http://groups.yahoo.com/group/amibroker/  

          To unsubscribe from this group, send an email to:<A 
          href="">amibroker-unsubscribe@xxxxxxxxxxxxxxx  

          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 
      
      
      Yahoo! Groups Links
      
        To visit your group on the web, go to:<A 
        href="">http://groups.yahoo.com/group/amibroker/  

        To unsubscribe from this group, send an email to:<A 
        href="">amibroker-unsubscribe@xxxxxxxxxxxxxxx  

        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 
    
    
    Yahoo! Groups Links
    
      To visit your group on the web, go to:<A 
      href="">http://groups.yahoo.com/group/amibroker/  

      To unsubscribe from this group, send an email to:<A 
      href="">amibroker-unsubscribe@xxxxxxxxxxxxxxx  

      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 
  
  
  Yahoo! Groups Links
  
    To visit your group on the web, go to:<A 
    href="">http://groups.yahoo.com/group/amibroker/  

    To unsubscribe from this group, send an email to:<A 
    href="">amibroker-unsubscribe@xxxxxxxxxxxxxxx  

    Your use of Yahoo! Groups is subject to the <A 
    href="">Yahoo! Terms of Service. 
  


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.