Terry
I didn't think about "Limit Trade Size as % of entry bar volume" That was my problem.
Thank you for your time
Jim Hutchison
SIDE NOTE: There is a similar problem with using AA->Settings->Portfolio tab->"Limit trade size as % of entry bar volume" when using TradeDelays(1,1,1,1) and OPEN prices because the Volume that is used is tomorrow's closing Volume (which IS the entry bar volume, but it is info that cannot be known at the time of the trade). When running in real-time it will use Today's volume since tomorrow's volume does not yet exist. This is not as significant a problem because it just allows a somewhat larger or smaller trade that you would get by using Today's volume as the limit.
At 11:31 AM 6/2/2006, you wrote:
Jim,
As I tried to explain below, I believe it works correctly unless you do something with PositionSize as in the following example AND you are trading Next Day OPEN. Simply setting the PositionSize as you have done is fine. You will not get a "looks into the future" error with this example, but it effectively does look into the future:
TradeDelays( 1 , 1 , 1 , 1 );
PositionSize = = - 100 / 6 ;
BuyPrice = SellPrice = ShortPrice = CoverPrice = Open;
//Your code to get a signal goes here
//
SetForeign( "$RUT"); //Market is OK to trade when $RUT RSI > 30.
MarketOK = IIf ( RSI ( 14 ) > 30 , 1 , 0 );
RestorePriceArrays();
PositionSize = PositionSize * MarketOK; //This is the problem code
Buy = yourCondition;
//and so on
This looks into the future because the evaluation of MarketOK and PositionSize is taken on the day of the trade, which is tomorrow. This info cannot be known in real-time because the RSI depends on the Close.
To fix the above problem do this instead:
//PositionSize = PositionSize * MarketOK; //Delete this line of code
Buy = yourCondition AND MarketOK; //Now we are using MarketOK on the signal day instead of the trading day
SIDE NOTE: There is a similar problem with using AA->Settings->Portfolio tab->"Limit trade size as % of entry bar volume" when using TradeDelays(1,1,1,1) and OPEN prices because the Volume that is used is tomorrow's closing Volume (which IS the entry bar volume, but it is info that cannot be known at the time of the trade). When running in real-time it will use Today's volume since tomorrow's volume does not yet exist. This is not as significant a problem because it just allows a somewhat larger or smaller trade that you would get by using Today's volume as the limit.
--
Terry
-----Original Message-----
From: amibroker@yahoogroups.com [ mailto:amibroker@yahoogroups.com] On Behalf Of James Hutchison
Sent: Friday, June 02, 2006 05:16
To: amibroker@yahoogroups.com
Subject: RE: [amibroker] Backtester picks wrong stocks
I have experienced this problem also when the setting is SetTradeDelays(1, 1, 1, 1). SetOption ( "MaxOpenPositions", 6);
PositionSize = -100 / 6;
The system I am working on Trades and sells on open the next morning. I have been testing the system each evening after my new data is in and I find that some times some of my previous trades disappear and are replaced with a different stock. I have used the check button and have no future bars. Does this mean I can not use my system to find tomorrow's trade or is there an other way.
Thank You
Jim Hutchison
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
SPONSORED LINKS
Investment management software | Real estate investment software | Investment property software |
Software support | Real estate investment analysis software | Investment software |
YAHOO! GROUPS LINKS
- Visit your group "amibroker" on the web.
- To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
- Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.