Tks a lot Mike. But I don´t think the script is ok, buying and selling, b/c
If you look at the attached picture, will see Jun/6/08 where should be a SELL, and in the report we don´t have this SELL. And the report says the same thing. Sorry for so many questions, but I´m learning a lot here. Thanks in advance, RR On Sun, May 9, 2010 at 1:54 AM, Mike <[email protected]> wrote: > > > Hi, > > Your code is showing all the entries and exits properly in the backtest > report. If you read each row, you will see: > > Ticker, Date, Price, Ex.date, Ex.Price, ... > > The Date/Price are for the entry (i.e. Buy, Short). The Ex.date/Ex.Price > are for the exit (i.e. Sell, Cover). > > Your code looks suspicious. You should make sure that you either set the AA > Window settings, else add code directly to set trade delays to all zero's, > and to set the ShortPrice and CoverPrice. > > e.g. > SetTradeDelays(0, 0, 0, 0); > ShortPrice = SellPrice; > CoverPrice = BuyPrice; > > The values you are using for BuyPrice and SellPrice are questionable. You > do not appear to be checking to verify that you don't end up with a value > that is greater than the High on Buy, or smaller than the Low on Sell. Also, > since you have no way of knowing whether the Cross will happen until the > Close, it is probably not correct to use any price other than the Close, > since only at the Close will your signal be generated. > > > Mike > > --- In [email protected] <amibroker%40yahoogroups.com>, Ricardo > Ribeiro Romero <listaora...@...> wrote: > > > > Sorry Mike. > > > > Here's the code. > > > > > > Range1=Optimize("range1",3,3,10,1); > > > > Range2=Optimize("range2",6,6,10,1); > > Buy = Cross((Close),(EMA(Close,range1))); > > Buystop = Ref(EMA(Close,range1),-1); > > BuyPrice = Max(Buystop,Close); > > Sell = Cross(EMA(Close,range2),(Close)); > > Sellstop = Ref(EMA(Close,range1),-1); > > SellPrice = Min(sellstop,Close); > > Short = Sell; > > Cover = Buy; > > > > > > On Sat, May 8, 2010 at 3:06 AM, Mike <sfclimb...@...> wrote: > > > > > > > > > > > Hi, > > > > > > Nobody can help you without seeing sample code. All anyone can say is > to > > > make sure that your code has an assignment for Sell in it. > > > > > > e.g. > > > > > > Sell = ... > > > > > > Mike > > > > > > > > > --- In [email protected] <amibroker%40yahoogroups.com><amibroker% > 40yahoogroups.com>, Ricardo > > > > Ribeiro Romero <listaoracle@> wrote: > > > > > > > > Hi ALL. > > > > > > > > I'm doing some BackTests but, in the report only appear the BUY, but > > > > graphically appear the arrow to SELL > > > > > > > > How can I change the program to sell a position when the signals > change. > > > > > > > > So, what I'm trying to do is. > > > > > > > > 1 - Sell the stocks > > > > 2 - Close the position and buy > > > > 3 - Close the position and sell > > > > 4 - Close and buy > > > > 5 - Close and Sell > > > > > > > > Please see the attached file as example. > > > > > > > > Thanks in advance, > > > > Ricardo. > > > > > > > > > > > > > > > > > >
