Hello, i've had exactly the same issue, i even contacted AB support. My results were to good to be true :-). What i did do "simulate" realistic results using the open of tomorrow. SetTradeDelays to 0 Reference into future by using Ref, e.g. Ref(open,1) You will probably notice that you get a significant number of fewer trades. In my case the backtester added a lot of very good 1 day trades.
Bellow you find response from AB support. Frank ------------------------------ Exact behaviour in such cases depends on "ALLOW SAME BAR EXIT (SINGLE BAR TRADE)" setting. There are 4 cases: When it is ON, then single bar trades are allowed. When a) the flag is ON and b) Buy and Sell occurs at the same bar c) and there is NO already open LONG trade then new long position will be open and then closed the same day When a) the flag is OFF and b) Buy and Sell occurs at the same bar c) and there is NO already open LONG trade then new long position will be open and will NOT be closed the same day - but rather on NEXT sell signal. When a) the flag is OFF and b) Buy and Sell occurs at the same bar c) and there IS already open LONG trade then already open long position will be closed and new position will NOT be open When a) the flag is ON and b) Buy and Sell occurs at the same bar c) and there IS already open LONG trade then already open long position will be closed and new position will be open As you can see - BuyPrice / SellPrice variables do not matter in this case. So - instead of changing the trading prices - you should rather disable same bar trades, or alternatively - remove BUY signal on bars where you have SELL signal: --- In [email protected], "Mike" <sfclimb...@...> wrote: > > The Close can be approximated towards the end of the trading day in order to calculate the PositionScore. Once calculated, many brokers offer Market On Close (MOC) trade support. > > http://www.interactivebrokers.com/en/trading/orders/moc.php > > Mike > > --- In [email protected], "mkecera" mkecera@ wrote: > > > > One reason for the inflated performance might be the following: How exactly do you want to cover on close? If it is a daily time-frame you hardly will be able to do it. You will know the PositionScore after the close, but wont be able to cover on those prices. > > > > --- In [email protected], Tony M <pqj100@> wrote: > > > > > > Need to corrected a typo in my earlier email: > > > > > > > > > Here's my code structure: > > > Condition1=. ..; > > > Condition2=. .., > > > SetTradeDelays( 0,0,1,0); > > > SetOption("AllowSam eBarExit" ,True); > > > SetOption("MaxOpenP ositions" , 4); > > > PositionSize = -100/4; > > > BUY=0; > > > SELL=0; > > > SHORT=condition1 and condition2; > > > Shortprice=open; > > > Cover=1; > > > Coverprice=close; > > > PositionScore= 100-RSI(14) ; > > > > > > > > > > > > ________________________________ > > > From: Tony M <pqj100@> > > > To: [email protected] > > > Sent: Fri, April 16, 2010 3:39:30 PM > > > Subject: Re: [amibroker] Re: Question about SetTradeDelays > > > > > >  > > > Because the backtest result is too good to be true, so I try to find out how the stocks are picked during backtest. What I find so far is that the result is strongly related to how PositionScore is constructed. The backtest result is not very good if PositionScore is not used. Unless PositionScore= 100-RSI(14) is looking into the next day, how does the backtest cherry picking the winning stocks based on the PositionScore? > > > > > > Here's my code structure: > > > Condition1=. ..; > > > Condition2=. .., > > > SetTradeDelays( 0,0,1,0); > > > SetOption("AllowSam eBarExit" ,True); > > > SetOption("MaxOpenP ositions" , 4); > > > PositionSize = -100/PosQty; > > > BUY=0; > > > SELL=0; > > > SHORT=condition1 and condition2; > > > Shortprice=open; > > > Cover=1; > > > Coverprice=close; > > > PositionScore= 100-RSI(14) ; > > > > > > I really appreciate if anybody can help me solve this problem. > > > Thanks, > > > TM > > > > > > > > > > > > ________________________________ > > > From: bistrader bistra...@yahoo. com> > > > To: amibro...@yahoogrou ps.com > > > Sent: Fri, April 16, 2010 12:47:42 PM > > > Subject: [amibroker] Re: Question about SetTradeDelays > > > > > >  > > > PositionScore= 100-RSI(14) provides the score for the day in question. No delay. SetTradeDelays( 1,1,1,1) would delay the buys, sells, shorts and covers by 1 day. > > > > > > --- In amibro...@yahoogrou ps.com, Tony M <pqj100@> wrote: > > > > > > > > I have a question when use both SetTradeDelays and PositionScore. > > > > > > > > When I use SetTradeDelays( 1,0,0,0), should I use PositionScore= 100-RSI(14) or should I use PositionScore= 100-Ref(RSI( 14),-1)? > > > > > > > > Using PositionScore= 100-RSI(14) , the profit from my backtest is huge, but when I use PositionScore= 100-Ref(RSI( 14),-1), the profit becomes quite small. Does PositionScore= 100-RSI(14) rank stocks on the next day because of SetTradeDelays( 1,0,0,0)? I use SetTradeDelays( 1,0,0,0) to buy at the open the next day. > > > > > > > > Thanks in advance, > > > > TM > > > > > > > > > >
