PureBytes Links
Trading Reference Links
|
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
At 10:36 PM 6/1/2006, you wrote:
PositionScore works correctly, but if you use PositionScore to modify
the PositionSIZE, then this is done on the trading day and you have that
set to 1,1,1,1. So, you would see the effect you describe. In essence,
it looks forward a day.
Lest I get in trouble with TJ, if this is your problem it just cannot be
coded that way. Instead of modifying PositionSize, just make
PositionScore part of your Buy statement to block certain trades.
If you are not doing the above, then you'll have to post code to
evaluate.
Have you tried the CHECK button in the editor? It needs to say you are
not using forward looking code. If it does say you are looking into the
future, then you have to find that code and eliminate it (if it affects
Buy/Sell code).
--
Terry
-----Original Message-----
From: amibroker@xxxxxxxxxxxxxxx [ mailto:amibroker@xxxxxxxxxxxxxxx
<mailto:amibroker@xxxxxxxxxxxxxxx> ] On
Behalf Of intermilan04
Sent: Wednesday, May 31, 2006 23:58
To: amibroker@xxxxxxxxxxxxxxx
Subject: [amibroker] Backtester picks wrong stocks
Hi all,
I have a daytrade system which buys at open, sells at close.
The system has SetTradeDelays(1, 1, 1, 1);
The idea here is I download the market data at night, scan for signals
then place market orders overnight so I will buy at open the next day.
The problem I'm facing is this:
Suppose I run my system at night and it signals Stock A, B, and C. I
place orders and buy them tomorrow morning. The following night, I
run backtest and see which ones my backtester picked. Strangely, the
backtester does not always pick out Stock A, B, and C, despite having
signaled them the night before.
I am ranking my signals by PositionScore variable, but criteria used
by PositionScore looks at past quotes, not future quotes.
Has anyone explanation as to why this happens? If the backtester does
not pick what it had signaled, it is a grave situation because you
can't really follow with the system no matter how good it is.
Thank you in advance,
intermilan04
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
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
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
<http://groups.yahoo.com/gads?t=ms&k=Investment+management+software&w1=I
nvestment+management+software&w2=Real+estate+investment+software&w3=Inve
stment+property+software&w4=Software+support&w5=Real+estate+investment+a
nalysis+software&w6=Investment+software&c=6&s=200&.sig=_XXUzbE9l5lGlZNcM
u4KNQ> management software
Real
<http://groups.yahoo.com/gads?t=ms&k=Real+estate+investment+software&w1=
Investment+management+software&w2=Real+estate+investment+software&w3=Inv
estment+property+software&w4=Software+support&w5=Real+estate+investment+
analysis+software&w6=Investment+software&c=6&s=200&.sig=5_sgDczz3ArKGMtJ
9tFSJA> estate investment software
Investment
<http://groups.yahoo.com/gads?t=ms&k=Investment+property+software&w1=Inv
estment+management+software&w2=Real+estate+investment+software&w3=Invest
ment+property+software&w4=Software+support&w5=Real+estate+investment+ana
lysis+software&w6=Investment+software&c=6&s=200&.sig=_N6zcwefgp4eg5n6oX5
WZw> property software
Software
<http://groups.yahoo.com/gads?t=ms&k=Software+support&w1=Investment+mana
gement+software&w2=Real+estate+investment+software&w3=Investment+propert
y+software&w4=Software+support&w5=Real+estate+investment+analysis+softwa
re&w6=Investment+software&c=6&s=200&.sig=MJ2jP31F3n64RDZkDadU8w>
support
Real
<http://groups.yahoo.com/gads?t=ms&k=Real+estate+investment+analysis+sof
tware&w1=Investment+management+software&w2=Real+estate+investment+softwa
re&w3=Investment+property+software&w4=Software+support&w5=Real+estate+in
vestment+analysis+software&w6=Investment+software&c=6&s=200&.sig=GmF8PlA
JASx0wrSaX5-Zlw> estate investment analysis software
Investment
<http://groups.yahoo.com/gads?t=ms&k=Investment+software&w1=Investment+m
anagement+software&w2=Real+estate+investment+software&w3=Investment+prop
erty+software&w4=Software+support&w5=Real+estate+investment+analysis+sof
tware&w6=Investment+software&c=6&s=200&.sig=aMgGsKT4w29dMAYUzQUKzg>
software
_____
YAHOO! GROUPS LINKS
* Visit your group "amibroker
<http://groups.yahoo.com/group/amibroker> " on the web.
* To unsubscribe from this group, send an email to:
amibroker-unsubscribe@xxxxxxxxxxxxxxx
<mailto:amibroker-unsubscribe@xxxxxxxxxxxxxxx?subject=Unsubscribe>
* Your use of Yahoo! Groups is subject to the Yahoo!
<http://docs.yahoo.com/info/terms/> Terms of Service.
_____
|