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

Re: [amibroker] Re: SetForeign's funcationality -- FullName() becomes Name() ?



PureBytes Links

Trading Reference Links

Dimitris,

Excellent solution as always.  

As I wrote earlier I can bypass this using DiskFileWatchLists 
(http://finance.groups.yahoo.com/group/amibroker-
dll/files/FV/fvDiskFileWatchList/), however it is nice to have more 
than one way of doing things.  If one is talking about pretty long 
lists then inputting them in the string such as what you've written 
will be quite tedious, but for short lists your solution is an 
*outstanding* one.

Maybe I should next version of the DLL that will take-up the list 
from disk as initialization, will in memory and then Index it by 
tickers.

Regards,
- Salil V Gangal


--- In amibroker@xxxxxxxxxxxxxxx, "DIMITRIS TSOKAKIS" <TSOKAKIS@xxxx> 
wrote:
> For multiple use g=""; should be inside the function.
> 
> Example:
> 
> NfN="IBM,International Business Machines Co.,INTC,Intel 
> Corporation,MSFT,Microsoft Corp.";
> function fn(X)
> {
> g="";
> for(n=0;n<10;n=n+2)
> {
> SetForeign(X);
> if(Name()==StrExtract(NfN,n))
> {
> g= g+StrExtract(NfN,n+1);
> }}
> return g;
> }
> Title=Name()+"\n"+fn("INTC")+","+fn("IBM")+","+fn("INTC");
> 
> The function fn() gives the FullName of a foreign ticker.
> Dimitris Tsokakis
> --- In amibroker@xxxxxxxxxxxxxxx, "DIMITRIS TSOKAKIS" 
<TSOKAKIS@xxxx> 
> wrote:
> > Of course, [almost] any problem has a solution.
> > You may create your own FullName function fn().
> > It will give the fullname even after a SetForeign() call.
> > You only need to create [once] the NfN comma separated string.
> > Example:
> > NfN="IBM,International Business Machines Co.,INTC,Intel 
> > Corporation,MSFT,Microsoft Corp.";
> > g="";
> > function fn()
> > {
> > for(n=0;n<10;n=n+2)
> > {
> > SetForeign("IBM");
> > if(Name()==StrExtract(NfN,n))
> > {
> > g= g+StrExtract(NfN,n+1)+",";
> > }}
> > return g;
> > }
> > Title=Name()+" "+fn();
> > 
> > Dimitris Tsokakis
> > --- In amibroker@xxxxxxxxxxxxxxx, "DIMITRIS TSOKAKIS" 
> <TSOKAKIS@xxxx> 
> > wrote:
> > > Salil,
> > > 1.
> > > It is written [twice] in the description
> > > 
> > > SETFOREIGN
> > > - replace current price arrays with those of foreign security 
> > > Referencing other symbol data
> > > (AFL 2.5)
> > > SYNTAX  SetForeign( ticker, fixup = True, tradeprices = 
False )  
> > > RETURNS NUMBER  
> > > FUNCTION  The SetForeign function replaces current price/volume 
> > > arrays with those of foreign security. 
> > > 
> > > " replace current price arrays " and " replaces current 
> > price/volume 
> > > arrays "
> > > No ref for ANY other ticker elements.
> > > 2.
> > > At the end of the description, 
> > > 
> > > Single SetForeign( "ticker" ) call is equivalent to the 
following 
> > > sequence: 
> > > C = Foreign( "ticker", "C" ); 
> > > O = Foreign( "ticker", "O" ); 
> > > H = Foreign( "ticker", "H" ); 
> > > L = Foreign( "ticker", "L" ); 
> > > V = Foreign( "ticker", "V" ); 
> > > OI = Foreign( "ticker", "I" ); 
> > > Avg = ( C + H + L )/3; 
> > > 
> > > No ref again for ANYTHING else.
> > > 
> > > 3.
> > > Since it replaces the basic Foreign() function, see the 
> respective 
> > > description
> > > SYNTAX  foreign( TICKER, DATAFIELD, fixup = 1)  
> > > DATAFIELD defines which array is referenced. Allowable data 
> > > fields: "open", "close", "high", "low", "volume", "interest".
> > > 
> > > Ticker Fullname is not included as "allowable data field" .
> > > Dimitris Tsokakis
> > > 
> > > 
> > > --- In amibroker@xxxxxxxxxxxxxxx, "Salil V Gangal" 
> > > <salil_gangal@xxxx> wrote:
> > > > Friends,
> > > > 
> > > > I set the 'Symbol->Information->Full Name' 
for 'MSFT' / 'CSCO' 
> > > > and 'YHOO' to 'Company 1' / 'Company 2' and 'Company 3' 
> > > respectively 
> > > > and ensured that without SetForeign(), the FullName() is 
> working 
> > > > properly.  It does seem as if after executing SetForeign(), 
the 
> > > > FullName() becomes Name() !
> > > > 
> > > > Has anyone else observed this ?
> > > > 
> > > > Regards,
> > > > - Salil V Gangal
> > > > 
> > > > 
> > > > 
> > > > --- In amibroker@xxxxxxxxxxxxxxx, "Salil V Gangal" 
> > > > <salil_gangal@xxxx> wrote:
> > > > > Friends,
> > > > > 
> > > > > Based on the documentation, I see that the SetForeign() 
sets 
> > > OHLCV, 
> > > > > OI, Avg to foreign security.  However it does not go to get 
> the 
> > > > > FullName().  So when used in combination, as far as I can 
> tell, 
> > > it 
> > > > > sort-of does something weird. For example following code 
===>
> > > > > 
> > > > > SetForeign("MSFT");
> > > > > Title = FullName();
> > > > > SetForeign("CSCO");
> > > > > Title = Title + " " + FullName();
> > > > > SetForeign("YHOO");
> > > > > Title = Title + " " + FullName();
> > > > > 
> > > > > Sets the Title to 'MSFT CSCO YHOO', which is as if FullName
() 
> > is 
> > > > > returning Name() after SetForeign() goes in effect.  Is 
this 
> > > > > expected ?
> > > > > 
> > > > > Sure ... I can get around SetForeign's apparent inability 
to 
> > work 
> > > > > with FullName(), by using external Watch Lists, but will 
like 
> > to 
> > > > know 
> > > > > what's going on here.  Why does FullName() not return the 
> name 
> > of 
> > > > > the 'current' security, why does it return the symbol of 
the 
> > > > > SetForeign's security ?
> > > > > 
> > > > > Regards,
> > > > > - Salil V Gangal



------------------------ Yahoo! Groups Sponsor ---------------------~-->
Buy Ink Cartridges or Refill Kits for your HP, Epson, Canon or Lexmark
Printer at MyInks.com.  Free s/h on orders $50 or more to the US & Canada.
http://www.c1tracking.com/l.asp?cid=5511
http://us.click.yahoo.com/mOAaAA/3exGAA/qnsNAA/GHeqlB/TM
---------------------------------------------------------------------~->

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:
     http://docs.yahoo.com/info/terms/