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

Re: [amibroker] Q: same AFL working with different DBs ?



PureBytes Links

Trading Reference Links

Title: Re: [amibroker] Q: same AFL working with different DBs ?
Here's some code that works for me. It finds 2 symbols using either Yahoo or eSignal. It only works on Indexes and takes advantage of the categoryIndex list. You can modify to suit. Watch out for line wraps.
---------------------------------

/* Notes: User must insure they have one of the TWO symbols shown for Nasdaq Composite AND Nasdaq100 (or change to your symbols).
 
IF YOUR SYMBOLS ARE NOT BEING FOUND...
1. In Preferences->Miscellaneous tab be sure to uncheck "Case-sensitive ticker symbols"
2. Your COMP and NDX symbols MUST be marked as INDEX symbols. To do this:
    a. Right click on the ticker symbol
    b. Choose Information
    c. Check the INDEX box
3. Please use UPPERCASE ticker names. Lowercase will be accepted. MiXeD case will not be found! */
 
/* BEGIN CODE */
 
EnableTextOutput(False); //Don't print the following to the Interpretation window
 
list = CategoryGetSymbols( categoryIndex,0); //Get a list of Symbols marked as INDEX
 
//If $COMPQ exists as an Index symbol use it
if( StrFind( list, "$COMPQ" ) OR StrFind( list, "$compq" ) ) COMP = "$COMPQ";
//Try ^IXIC if no $COMPQ
else if( StrFind( list, "^IXIC" ) OR StrFind( list, "^ixic" ) ) COMP = "^IXIC";
else COMP = "N/A";
 
//If $NDX exists as an Index symbol use it
if( StrFind( list, "$NDX" ) OR StrFind( list, "$ndx" ) ) NDX = "$NDX";
//Try ^NDX if no $NDX
else if( StrFind( list, "^NDX" ) OR StrFind( list, "^ndx" ) ) NDX = "^NDX";
else NDX = "N/A";
 
AlertIf(COMP == "N/A","SOUND EXPLODE.WAV","COMP symbol not found",5,1+8);
AlertIf( NDX == "N/A","SOUND EXPLODE.WAV","NDX symbol not found",5,1+8);
 
EnableTextOutput(True);
"Symbols active: ";
COMP + " for Nasdaq Composite";
NDX + " for Nasdaq100\n";
 
//Now access your data using the variables loaded with the correct tickers
SetForeign(COMP,True,False);
--
Terry

> From: "dalengo" <dalengo@xxxxxxxxx>
> Reply-To: amibroker@xxxxxxxxxxxxxxx
> Date: Mon, 20 Dec 2004 00:49:19 -0000
> To: amibroker@xxxxxxxxxxxxxxx
> Subject: [amibroker] Q: same AFL working with different DBs ?
>
>
>
> Usually different databases (DBs) have different tickers for the
> same index.
> For instance, Yahoo has ^RUT, TC2000 for funds RUT-X for Russell
> 2000.
> I would like to have an AFL picking up whatever ticker is available
> irrespective of the DB loaded, since I do not want a separate AFL
> for each DB.
>
> I was not successful. The following AFL does pick ^RUT from Yahoo
> (native AB US-stocks DB),
> but does not pick RUT-X from TC2kF. If I were to switch the order of
> ckecking for
> the available ticker, it would pick that RUT-X if TC2kF is loaded,
> but won't pick ^RUT
> if load Yahoo DB.
>
> RUT =     IIf( NOT IsNull( Foreign("^RUT","C") ) ,  Foreign
> ("^RUT","C"),             //Yahoo
> IIf( NOT IsNull( Foreign("RUT-X","C")) ,  
> Foreign("RUT-X","C"), Null));   // TC2K Funds
>
> Any suggestions for getting around this problem would be appreciated.
> -Alex
>
>
>
>
>
>
> ------------------------ Yahoo! Groups Sponsor --------------------~-->
> Make a clean sweep of pop-up ads. Yahoo! Companion Toolbar.
> Now with Pop-Up Blocker. Get it for free!
> http://us.click.yahoo.com/L5YrjA/eSIIAA/yQLSAA/GHeqlB/TM
> --------------------------------------------------------------------~->
>
> Check AmiBroker web page at:
> http://www.amibroker.com/
>
> 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:
>   http://docs.yahoo.com/info/terms/
>
>
>
>


Check AmiBroker web page at:
http://www.amibroker.com/

Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html



Yahoo! Groups Sponsor
ADVERTISEMENT
click here


Yahoo! Groups Links