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

Re: [amibroker] Re: a bug in portfolio tester?



PureBytes Links

Trading Reference Links

That is not a bug but operation as per specification.
The trades are taken in order of absolute position score.
If trade with higher position score can not be open because of insufficient funds, 
the backtester will not enter any more trades on given day/bar using
signals that have lower position score.
This prevents entering trades on poor candidates (low position score)
only because you have run out of funds.
If you want to add handicap for low-priced stocks, just include price (or rather
inversion of price) in your position score.

Best regards,
Tomasz Janeczko
amibroker.com
----- Original Message ----- 
From: <hydroblue@xxxxxxxxxxxxxx>
To: <amibroker@xxxxxxxxxxxxxxx>
Sent: Tuesday, June 02, 2009 5:06 AM
Subject: [amibroker] Re: a bug in portfolio tester?


> Not sure if this is the same issue you are seeing, but there is an issue
> involving insufficient funds when high priced stocks have a greater
> position score than low priced stocks.
> 
> http://www.amibroker.com/feedback/view_bug.php?bug_id=1619
> 
> --- In amibroker@xxxxxxxxxxxxxxx, "Tomasz Janeczko \(groups\)"
> <groups@xxx> wrote:
>>
>> Hello,
>>
>> There is no bug. If it says that position is not entered because of
> insufficient funds it means
>> that desired position can't be opened with specified size.
>> Most probably either your formula specifies wrong (too high) size, or
> your round lot sizing
>> does not allow too small pos, or you don't have "position size
> shrinking" option enabled.
>> If you have trouble, send the formula to SUPPORT and we will point out
> the error in your formula.
>>
>> Best regards,
>> Tomasz Janeczko
>> amibroker.com
>>   ----- Original Message -----
>>   From: liguoyi
>>   To: amibroker@xxxxxxxxxxxxxxx
>>   Sent: Monday, June 01, 2009 12:51 PM
>>   Subject: [amibroker] a bug in portfolio tester?
>>
>>
>>
>>
>>   Hi,
>>
>>   I am trying to test the scale in/out in AM5.2, and base the code on
> the AM tutorial on scalein/out. I found that, sometimes, portfolio
> backtester doesn't enter a trade, even though there are enough cash. For
> example, I set the backtester initial fund to 100,000, max 4 open
> positions, and each position will use 10,000, report to detailed log
> mode. It is very strange that backtester doesn't enter the trade on some
> days, like 14/4/09 and shows message.
>>   CTV not entered because of insufficient funds
>>   But there is 80,514.9 cash available. A trade only needs 10,000
>>
>>   Anyone has seen this issue before? Is it a bug?
>>
>>   thanks,
>>   Steven
>>
>>
>>   Date    Information
>>
>>   3/4/2009
>>       Entry signals(score):
>>       Exit signals:
>>       0 Open Positions: , Equity: 100000, Cash: 100000
>>   6/4/2009
>>       Entry signals(score):ALV=Buy(68.6973), YRCW=Buy(66.7675),
> BCS=Buy(64.5193), ACH=Buy(63.5376), BGC=Buy(63.3302), JBL=Buy(62.4348),
> TIN=Buy(60.5582), FCX=Buy(60.5032),
>>       Exit signals:
>>       Enter Long, ALV, Price: 22.53, Shares: 440, Commission: 2, Rank:
> 68.6973, Equity 99996, Margin Loan: 0, Fx rate: 1
>>       Enter Long, YRCW, Price: 5.42, Shares: 1840, Commission: 2,
> Rank: 66.7675, Equity 99992, Margin Loan: 0, Fx rate: 1
>>       Enter Long, BCS, Price: 10.24, Shares: 970, Commission: 2, Rank:
> 64.5193, Equity 99988, Margin Loan: 0, Fx rate: 1
>>       Enter Long, ACH, Price: 18.01, Shares: 550, Commission: 2, Rank:
> 63.5376, Equity 99984, Margin Loan: 0, Fx rate: 1
>>       4 Open Positions: , ALV (+440), , YRCW (+1840), , BCS (+970), ,
> ACH (+550), Equity: 99816.3, Cash: 60267.7
>>   7/4/2009
>>       Entry signals(score):LAMR=Buy(68.0092), CE=Buy(66.6134),
> ALV=Buy(62.2498), ACH=Buy(59.5062), FCX=Buy(59.2346), BGC=Buy(56.7888),
> HPT=Buy(55.0469), BX=Buy(53.7648),
>>       Exit signals:BCS=Sell, CI=Sell, FRPT=Sell, JBL=Sell, TIN=Sell,
> YRCW=Sell,
>>       Exit Long, YRCW, Price: 5.17, (Avg. exit pr. 5.17), Shares:
> 1840, Commission: 2, (Total comm.: 4), Profit: -464 (-4.65 %), Entry
> rank:66.7675, Equity: 98051.8, Fx rate: 1
>>       Exit Long, BCS, Price: 9.468, (Avg. exit pr. 9.468), Shares:
> 970, Commission: 2, (Total comm.: 4), Profit: -752.84 (-7.58 %), Entry
> rank:64.5193, Equity: 98051.8, Fx rate: 1
>>       Enter Long, LAMR, Price: 13.72, Shares: 720, Commission: 2,
> Rank: 68.0092, Equity 97919.8, Margin Loan: 0, Fx rate: 1
>>       Enter Long, CE, Price: 15.6003, Shares: 640, Commission: 2,
> Rank: 66.6134, Equity 97915.8, Margin Loan: 0, Fx rate: 1
>>       4 Open Positions: , ALV (+440), , ACH (+550), , LAMR (+720), ,
> CE (+640), Equity: 97384.1, Cash: 59093.9
>>   8/4/2009
>>       Entry signals(score):PAY=Buy(66.8912), HOG=Buy(62.6152),
> ACH=Buy(61.577), BGC=Buy(59.7941), DB=Buy(59.7539), HPT=Buy(57.583),
> CI=Buy(56.9387), FCX=Buy(56.7986),
>>       Exit signals:LEN=Sell, MBI=Sell, XCO=Sell,
>>       4 Open Positions: , ALV (+440), , ACH (+550), , LAMR (+720), ,
> CE (+640), Equity: 98179, Cash: 59093.9
>>   9/4/2009
>>       Entry signals(score):CE=Buy(72.8305), VMED=Buy(72.798),
> ALV=Buy(70.1462), PAY=Buy(68.8664), HOG=Buy(68.3335), ACH=Buy(65.9337),
> DB=Buy(65.6035), BGC=Buy(64.8912),
>>       Exit signals:ALV=Scale-Out, CE=Scale-Out, CI=Scale-Out,
> DB=Scale-Out, HOG=Scale-Out, HPT=Sell, M=Sell, PAY=Scale-Out, STT=Sell,
> WSM=Sell,
>>       Scale-Out Long ALV, Price 24.783, Shares 220, Fx Rate 1, Number
> of shares - Current: 220, Exited: 220, Total Cost: 9913.2, Avg. Entry
> Price 22.53, Avg. Exit Price 24.783, Avg Fx. Rate Entry 1, Exit 1,
> Entry+scaling commission 4
>>       Scale-Out Long CE, Price 17.1603, Shares 320, Fx Rate 1, Number
> of shares - Current: 320, Exited: 320, Total Cost: 9984.19, Avg. Entry
> Price 15.6003, Avg. Exit Price 17.1603, Avg Fx. Rate Entry 1, Exit 1,
> Entry+scaling commission 4
>>       4 Open Positions: , ALV (+220), , ACH (+550), , LAMR (+720), ,
> CE (+320), Equity: 101133, Cash: 70033.4
>>   13/4/2009
>>       Entry signals(score):CE=Buy(74.071), SLT=Buy(73.3671),
> VMED=Buy(73.2845), CTV=Buy(72.7264), AXP=Buy(72.5197), HAR=Buy(71.7026),
> LAMR=Buy(71.2575), HBI=Buy(70.9452),
>>       Exit signals:ALV=Sell, FCX=Scale-Out, SPW=Sell,
>>       Exit Long, ALV, Price: 22.725, (Avg. exit pr. 23.754), Shares:
> 220, Commission: 2, (Total comm.: 6), Profit: 532.56 (5.37 %), Entry
> rank:68.6973, Equity: 100602, Fx rate: 1
>>       Enter Long, SLT, Price: 8.36, Shares: 1190, Commission: 2, Rank:
> 73.3671, Equity 100569, Margin Loan: 0, Fx rate: 1
>>       4 Open Positions: , ACH (+550), , LAMR (+720), , CE (+320), ,
> SLT (+1190), Equity: 101877, Cash: 65080.5
>>   14/4/2009
>>       Entry signals(score):CTV=Buy(75.8929), WYN=Buy(74.2171),
> ACH=Buy(68.8466), VMED=Buy(68.2965), YGE=Buy(68.2023), GT=Buy(68.0403),
> SLT=Buy(68.011), CE=Buy(68.0085),
>>       Exit signals:ACH=Scale-Out, AXP=Sell, BX=Sell, CMC=Scale-Out,
> LAMR=Sell, MAS=Sell, SFD=Sell,
>>       Scale-Out Long ACH, Price 19.811, Shares 270, Fx Rate 1, Number
> of shares - Current: 280, Exited: 270, Total Cost: 9905.5, Avg. Entry
> Price 18.01, Avg. Exit Price 19.811, Avg Fx. Rate Entry 1, Exit 1,
> Entry+scaling commission 4
>>       Exit Long, LAMR, Price: 14.013, (Avg. exit pr. 14.013), Shares:
> 720, Commission: 2, (Total comm.: 4), Profit: 206.96 (2.10 %), Entry
> rank:68.0092, Equity: 101850, Fx rate: 1
>>       CTV not entered because of insufficient funds
>>       3 Open Positions: , ACH (+280), , CE (+320), , SLT (+1190),
> Equity: 101367, Cash: 80514.9
>>   15/4/2009
>>       Entry signals(score):WYN=Buy(76.2004), VMED=Buy(72.2697),
> CTV=Buy(70.5929), STP=Buy(69.4714), LAMR=Buy(68.8434), SLT=Buy(68.4844),
> BCS=Buy(68.3006), CE=Buy(67.2862),
>>       Exit signals:ACH=Sell, CTX=Sell, DRH=Sell, HOG=Sell, JAVA=Sell,
> MBI=Sell, PAY=Sell, TIN=Sell, YGE=Sell,
>>       Exit Long, ACH, Price: 21.612, (Avg. exit pr. 20.7279), Shares:
> 280, Commission: 2, (Total comm.: 6), Profit: 1488.83 (15.03 %), Entry
> rank:63.5376, Equity: 101677, Fx rate: 1
>>       WYN not entered because of insufficient funds
>>       2 Open Positions: , CE (+320), , SLT (+1190), Equity: 101973,
> Cash: 86564.2
>>   16/4/2009
>>       Entry signals(score):WYN=Buy(78.7895), VMED=Buy(75.8454),
> CTV=Buy(74.1817), GT=Buy(73.9597), BCS=Buy(70.9163), CE=Buy(69.2603),
> JBL=Buy(68.0727), CTX=Buy(66.4456),
>>       Exit signals:BCS=Scale-Out, CTV=Scale-Out, FRPT=Sell,
> GT=Scale-Out, JBL=Scale-Out, JNY=Sell, LAMR=Sell, VMED=Scale-Out,
> WYN=Scale-Out,
>>       WYN not entered because of insufficient funds
>>       2 Open Positions: , CE (+320), , SLT (+1190), Equity: 101940,
> Cash: 86564.2
>>   17/4/2009
>>       Entry signals(score):GT=Buy(76.3274), LHO=Buy(74.57),
> JNY=Buy(71.7901), CTX=Buy(69.0205), ALV=Buy(68.3688), CE=Buy(68.0378),
> BGC=Buy(65.6471), CMC=Buy(65.4784),
>>       Exit signals:AXA=Scale-Out, BCS=Sell, BGC=Scale-Out, DB=Sell,
> DSX=Scale-Out, SLT=Sell, VMED=Sell, WYN=Sell,
>>       Exit Long, SLT, Price: 7.848, (Avg. exit pr. 7.848), Shares:
> 1190, Commission: 2, (Total comm.: 4), Profit: -613.28 (-6.16 %), Entry
> rank:73.3671, Equity: 101692, Fx rate: 1
>>       GT not entered because of insufficient funds
>>       1 Open Positions: , CE (+320), Equity: 101512, Cash: 95901.3
>>
> 
> 
> 
> 
> ------------------------------------
> 
> **** IMPORTANT PLEASE READ ****
> This group is for the discussion between users only.
> This is *NOT* technical support channel.
> 
> TO GET TECHNICAL SUPPORT send an e-mail directly to 
> SUPPORT {at} amibroker.com
> 
> TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
> http://www.amibroker.com/feedback/
> (submissions sent via other channels won't be considered)
> 
> For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
> http://www.amibroker.com/devlog/
> 
> Yahoo! Groups Links
> 
> 
> 


------------------------------------

**** IMPORTANT PLEASE READ ****
This group is for the discussion between users only.
This is *NOT* technical support channel.

TO GET TECHNICAL SUPPORT send an e-mail directly to 
SUPPORT {at} amibroker.com

TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
http://www.amibroker.com/feedback/
(submissions sent via other channels won't be considered)

For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/

Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/amibroker/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:amibroker-digest@xxxxxxxxxxxxxxx 
    mailto:amibroker-fullfeatured@xxxxxxxxxxxxxxx

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