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

Re: [amibroker] Re: Amibroker -> Plot Trailing Stop Level



PureBytes Links

Trading Reference Links

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



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/