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

[amibroker] Portfolio ranking problem -



PureBytes Links

Trading Reference Links

I am trying to develop a portfolio ranking system. Here is a simple 
system to illustrate my question:				
			
SetOption("NoDefaultColumns",0);				
SetOption("InitialEquity",250000);				
SetOption("AllowSameBarExit",0);				
SetOption("ActivateStopsImmediately",0);			
SetOption("AllowPositionShrinking",1);				
SetOption("FuturesMode",0);					
SetOption("InterestRate",0);					
SetOption("MaxOpenPositions",1000);				
SetOption("MinShares",.001);
SetOption("PriceBoundChecking",1) ; 
SetOption("CommissionMode",1); 
SetOption("CommissionAmount",0);
SetOption("MarginRequirement",100); 
SetOption("ReverseSignalForcesExit",0);
SetOption("UsePrevBarEquityForPosSizing",1);
SetTradeDelays(0,0,0,0); 

pos        = Param("pos",             1,     1,     4,     1); 
SetOption("MaxOpenPositions", pos ); 
per1       = Optimize("per1",           3,     2,    10,     1); 
per3       = Optimize("per3",           33,     1,    90,     1); 
amt2       = Optimize("amt2",        0.013,  0.01,   0.3, 0.001); 
Buy = ROC(C,per1)> amt2  ;
Sell               = 0;
trail      = Optimize("trail",         1.4,   0.5,     6,   0.1); 
ApplyStop( stopTypeTrailing, stopModePercent, trail); 

PositionSize = -100/pos; 
PositionScore = 10000+ ROC(C,per3) ; 
Filter=1; 
AddColumn(Buy,"buy",1.0); 
AddColumn(Sell,"sell",1.0);
AddColumn(ROC(C,per3),"buy the highest of this column",1.1);   

Using this example, when a fund sells, the next fund purchased should 
be selected from all the funds that are on a buy with the highest 
position score. What actually happens is, the fund purchased after a 
sell is the fund that changes from a sell to a buy. A fund that is 
already on a buy with a higher position score is not selected if it 
went on a buy prior to the sell. So, for example, if three funds have 
positions scores and buy / sell states of:
Fund  positionscore       Buy/Sell   
A	1.0		  Sell (went to a sell today)
B	1.5		  Buy (went to a buy today)
C 	2.0		  Buy (went to a buy several days ago)

When Fund A goes on a sell, the next fund purchased is not 
necessarily fund C, which has the highest position score.  The fund 
selected is the fund that next changes from a sell to a buy, which is 
B in this example; but fund C should have been selected.

Is there a way to have the system select from all the funds that are 
on a buy, not just the ones that have most recently changed from a 
sell to a buy? I suspect the answer is simple, but I am stumped on 
this one! I've tried applying "Flip" and/or "Exrem" functions without 
success. 
Thanks in advance
Larry






------------------------ Yahoo! Groups Sponsor --------------------~--> 
Try Online Currency Trading with GFT. Free 50K Demo. Trade 
24 Hours. Commission-Free. 
http://us.click.yahoo.com/RvFikB/9M2KAA/U1CZAA/GHeqlB/TM
--------------------------------------------------------------------~-> 

Please note that this group is for discussion between users only.

To get support from AmiBroker please send an e-mail directly to 
SUPPORT {at} amibroker.com

For other support material please check also:
http://www.amibroker.com/support.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/