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

[amibroker] Problem calculating Sum of Equities for Watchlist


  • To: "AmiBroker" <amibroker@xxxxxxxxxxxxxxx>
  • Subject: [amibroker] Problem calculating Sum of Equities for Watchlist
  • From: "Herman vandenBergen" <psytek@xxxxxxxx>
  • Date: Fri, 12 Dec 2003 20:41:22 -0800

PureBytes Links

Trading Reference Links




<SPAN 
class=250190904-13122003>Hello,
<SPAN 
class=250190904-13122003> 
I need an 
Exploration that calculates the sum of equities for a watchlist. This has 
to be an looping solution because I want to do this on the fly while 
dynamically changing system parameters, I cannot use 
composites.  
<SPAN 
class=250190904-13122003> 
Below is 
a simplification of what I have but the sum of Equities in the last 
column keeps changing because the individual equities (based on SetForeign()) 
keep changing. I confirmed this with DebugView. Something is out of 
sync... Can somebody tell me w<SPAN 
class=250190904-13122003>here I 
went wrong?
<SPAN 
class=250190904-13122003> 
Many thanks for any 
help you can give,
<SPAN 
class=250190904-13122003>herman
<SPAN 
class=250190904-13122003> 
<FONT 
color=#ff0000><FONT 
color=#ff0000>Buy=<FONT 
color=#ff0000>Sell=<FONT 
color=#ff0000>Short=<FONT 
color=#ff0000>Cover=<FONT 
color=#ff00ff>0<FONT 
color=#000000>; <FONT 
color=#ff0000>Filter=<FONT 
color=#0000ff>Status(<FONT 
color=#ff00ff>"LastBarInTest"<FONT 
face=Arial>); // 
system's code, executed for each stock in 
Exploration<FONT 
color=#000000> Buy<FONT 
color=#000000>=Cross( 
MACD(), <FONT 
color=#0000ff>Signal<FONT 
color=#000000>() ); <FONT 
color=#ff0000>Sell = <FONT 
color=#0000ff>Cross( <FONT 
color=#0000ff>Signal(), <FONT 
color=#0000ff>MACD<FONT 
color=#000000>() ); <FONT 
color=#ff0000>Short = <FONT 
color=#ff0000>Sell; <FONT 
color=#ff0000>Cover = <FONT 
color=#ff0000>Buy<FONT 
face=Arial>; E = <FONT 
color=#0000ff>Equity(<FONT 
color=#ff00ff>0<FONT 
color=#000000>); AddColumn<FONT 
color=#000000>(E,"Equity"<FONT 
color=#000000>,1.2<FONT 
size=2>); <FONT 
color=#000000>// Same code, calculate sum of Equity for 
watchlist<FONT 
color=#000000> List = <FONT 
color=#0000ff>GetCategorySymbols(<FONT 
color=#ff0000>categoryWatchlist<FONT 
color=#000000>,8<FONT 
size=2>); Et = <FONT 
color=#ff00ff>0<FONT 
color=#000000>; for<FONT 
color=#000000>( n=0; 
(Ticker=StrExtract( List, 
n))!= ""<FONT 
face=Arial>; n++)    { 
   Ticker=<FONT 
color=#0000ff>StrExtract<FONT 
color=#000000>( List, n);    <FONT 
color=#0000ff>SetForeign<FONT 
color=#000000>(Ticker);    <FONT 
color=#ff0000>Buy=<FONT 
color=#0000ff>Cross( <FONT 
color=#0000ff>MACD(), <FONT 
color=#0000ff>Signal<FONT 
color=#000000>() );    <FONT 
color=#ff0000>Sell = <FONT 
color=#0000ff>Cross( <FONT 
color=#0000ff>Signal(), <FONT 
color=#0000ff>MACD<FONT 
color=#000000>() );    <FONT 
color=#ff0000>Short = <FONT 
color=#ff0000>Sell<FONT 
color=#000000>;   <FONT 
color=#ff0000>Cover = <FONT 
color=#ff0000>Buy<FONT 
face=Arial>;    E1 = <FONT 
color=#0000ff>Equity(<FONT 
color=#ff00ff>0<FONT 
color=#000000>);    Et = Et + E1; 
   <FONT 
color=#000000>//_TRACE(List+"  "+Ticker+"  "+NumToStr(n)+"  "+NumToStr(E1));<FONT 
size=2>    <FONT 
color=#0000ff>AddColumn(E1,Ticker,<FONT 
color=#ff00ff>1.2<FONT 
color=#000000>);    <FONT 
color=#0000ff>RestorePriceArrays<FONT 
face=Arial>();    } <FONT 
color=#0000ff>AddColumn(Et,<FONT 
color=#ff00ff>"WLSumEquity",<FONT 
color=#ff00ff>1.2)<FONT 
face=Arial color=#000000 size=2> ;
<SPAN 
class=250190904-13122003><SPAN 
class=250190904-13122003> 
<FONT face=Arial 
size=2><IMG alt="" hspace=0 
src="jpg00386.jpg" align=baseline border=0>
<SPAN 
class=250190904-13122003> 






Yahoo! Groups Sponsor


  ADVERTISEMENT 









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



Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.


Attachment: Description: ""