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

[amibroker] Re: Problem calculating Sum of Equities for Watchlist



PureBytes Links

Trading Reference Links

Herman
You need to set tradeprices=True as opposed to default of false.
SetForeign( ticker, fixup = True, tradeprices = False ) to perform 
correct equity(0) calculations.  
ie.  SetForeign(Ticker,True,True); 
HTH
Andrew
--- In amibroker@xxxxxxxxxxxxxxx, "Herman vandenBergen" 
<psytek@xxxx> wrote:
> Hello,
> 
> 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.
> 
> 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 where I went wrong?
> 
> Many thanks for any help you can give,
> herman
> 
> Buy=Sell=Short=Cover=0;
> Filter=Status("LastBarInTest");
> 
> // system's code, executed for each stock in Exploration
> Buy=Cross( MACD(), Signal() );
> Sell = Cross( Signal(), MACD() );
> Short = Sell; Cover = Buy;
> E = Equity(0);
> AddColumn(E,"Equity",1.2);
> 
> // Same code, calculate sum of Equity for watchlist
> List = GetCategorySymbols(categoryWatchlist,8);
> 
> Et = 0;
> for( n=0; (Ticker=StrExtract( List, n))!= ""; n++)
>    {
>    Ticker=StrExtract( List, n);
>    SetForeign(Ticker);
>    Buy=Cross( MACD(), Signal() );
>    Sell = Cross( Signal(), MACD() );
>    Short = Sell;   Cover = Buy;
>    E1 = Equity(0);
>    Et = Et + E1;
>    //_TRACE(List+"  "+Ticker+"  "+NumToStr(n)+"  "+NumToStr(E1));
>    AddColumn(E1,Ticker,1.2);
>    RestorePriceArrays();
>    }
> AddColumn(Et,"WLSumEquity",1.2) ;


------------------------ 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 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/