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

[amibroker] Re: Optimizing Max Open Positions



PureBytes Links

Trading Reference Links

Thanks.  I optimized the Max Open Positions to 8.

Maxpos=Optimize("maxpos",8,1,20,1);
PositionSize = -100/Maxpos;
SetOption("MaxOpenPositions", Maxpos );

I am getting 8 positions open in the Results window:

12/4/03								
			
	Entry signals(score):GU-9967=short(-1)	 UC-9967=buy(1)	 
								
	Exit signals:GU-9967=sell	 UC-9967=cover	 	
							
	Enter Short	 GU-9967	 Price: 1.7278	 Shares: 250
	 Commission: 0	 Rank: -1	 Equity 3712.71		
		
	Enter Long	 UC-9967	 Price: 1.3007	 Shares: 350
	 Commission: 0	 Rank: 1	 Equity 3712.71		
		
	8 Open Positions:$C-9967	 $E-9967	 AU-9967
	 AC-9967	 E$-9967	 EA-9967	 GU-9967
	 UC-9967	 Equity: 3718.23	 Cash: 317.445	

But I find a discrepancy with the Open position count using the 
following code, where I got 11 positions open, when I plot it in a 
indicator window using 

Graph1 = Foreign( "~OpenPosCount", "V"); 
Plot(Graph1,"OpenPosCount",1,style=1,0,100);

The following is in Automatic Analysis:

/* the following line uses Flip function to get "1" after the buy 
signal and reset it back to "0" after sell appears. */

in_trade = Flip( Buy, Sell );

AddToComposite( in_trade, "~OpenPosCount", "V" );

/* We use "~OpenPosCount" artificial ticker to store the results. 
Again we should run just Scan of the formula AND the "~OpenPosCount" 
ticker would become available. 

Use */ 

Graph0 = Foreign( "~OpenPosCount", "V"); 

/* in Indicator Builder after running the back-test to see the chart 
of the number of Open positions of your system. */

Can somebody tell me why this discrepancy occurs.  TIA.

rgds, Pal



--- In amibroker@xxxxxxxxxxxxxxx, "bvandyke" <bvandyke@xxxx> wrote:
> Pal,
> 
> Try the following example and modify the # of positions as needed:
> 
> Maxpos=Optimize("maxpos",2,1,4,1);
> PositionSize = -100/Maxpos;
> SetOption("MaxOpenPositions", Maxpos );
> 
> Bill
> 
> --- In amibroker@xxxxxxxxxxxxxxx, "palsanand" <palsanand@xxxx> 
wrote:
> > Hi All,
> > 
> > Does anybody has the code for Optimizing Max Open Positions.  I 
> > remember seeing it somewhere in AFL guides.  I can't seem to find 
> it 
> > now or remember how to do it.
> > 
> > TIA
> > 
> > rgds, Pal


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