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

RE: [amibroker] Backtester picks wrong stocks



PureBytes Links

Trading Reference Links

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@xxxxxxxxxxxxxxx 
>[mailto:amibroker@xxxxxxxxxxxxxxx] On Behalf Of James Hutchison
>Sent: Friday, June 02, 2006 05:16
>To: amibroker@xxxxxxxxxxxxxxx
>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