Hi Mike.
This is the script.
Range1=Optimize("range1",3,3,100,1);
Range2=Optimize("range2",6,6,100,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;
As you can see in the picture 1.gif, we've all 2008. In the blue line we've
the Sep/23 where we should have a "position close" that was openned at
Sep/18, but also we should have a SELL ( BIG SELL ) and this sell finish
only Oct/13
What I'm trying to say is: AMI is right when close the "buy position", but
AMI should also open a new "SELL position" closing this one only few days
after.
On Mon, May 10, 2010 at 2:42 AM, Mike <[email protected]> wrote:
>
>
> Ricardo,
>
> 1. You haven't shown the source that produced the chart. So I can't say
> anything about that.
>
> 2. It might be helpful to provide an image of your backtest results page to
> prove that you don't have a Sell. Are you saying that you are left with a
> row in the results page that says "Long Open"?
>
> 3. The backtest will be the "true" description of whether or not you
> entered/exited a trade. The backtester takes into consideration such things
> as available funds, maximum positions, redundant entries, etc. None of those
> things would appear on a chart and could cause the chart to show trades that
> would not take place in reality.
>
>
> Mike
>
> --- In [email protected] <amibroker%40yahoogroups.com>, Ricardo
> Ribeiro Romero <listaora...@...> wrote:
> >
> > 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 <sfclimb...@...> 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><amibroker%
> 40yahoogroups.com>, Ricardo
> > > Ribeiro Romero <listaoracle@> 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 <sfclimbers@> 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><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.
> > > > > >
> > > > >
> > > > >
> > > > >
> > > >
> > >
> > >
> > >
> >
>
>
>