Hi BB --
You might consider using an Exploration instead of a Backtest to generate
the statistics you are looking for.
In the Exploration, look ahead to see what the conditions will be. You
can't do that in a trading system, but you can in an exploration.
For example:
///////////////////////////////////////////////////////
// SampleExploration.afl
//
// Howard Bandy
// September 2008
SetTradeDelays(0,0,0,0);
// Set up the conditions you are interested in.
RSILevel = Optimize("RSILevel",20,1,100,1);
// If the RSI rose through the indicated level yesterday,
// Buy this morning's Open
Buy = Ref(Cross(RSI(),RSILevel),-1);
BuyPrice = Open;
// Look ahead to see what the profit potential is
HHVAhead = Ref(HHV(H,5),5);
ProfitPotential = (HHVAhead - BuyPrice) / BuyPrice;
// Keep track of when the Buy occurred.
// If you have multiple Buys before the first Sell,
// this will pick up the most recent Buy, which is incorrect.
// In that case, you might want to write a loop
// to control the prices more exactly.
BuyAgo = BarsSince(Buy);
// Sell at the ideal time and price
Sell = H == Ref(HHVAhead,-BuyAgo);
SellPrice = H;
// Show only those days with the Buy signal
Filter = Buy;
// Display figures of interest
AddColumn(Buy,"Buy",4.0);
AddColumn(BuyPrice,"BuyPrice",10.4);
AddColumn(Close, "Close", 10.4);
AddColumn(ProfitPotential,"Profit P",10.4);
AddColumn(HHVAhead,"HHVAhead",10.4);
AddColumn(Ref(RSI(),-2),"RSI 2 ago",1.4);
AddColumn(Ref(RSI(),-1),"RSI Yest",1.4);
AddColumn(RSI(),"RSI",1.4);
/////////////////////////////////////////////////////
Thanks,
Howard
On Mon, Sep 29, 2008 at 5:30 AM, bimbo2blond <[EMAIL PROTECTED]> wrote:
> Hello Howard,
>
> Thanks for your reply.
> The daily buying is clear. The other answer makes at least clear
> that what I want is a bit more complicated as I thought.
>
> Basicly I want to test entry and exit strategies independently. To
> see only the effects of the exit strategy I need a 'random' entry.
> By buying on every open I have a random entry and a lot of data to
> give the results of the exit strategy statistical relevance. If the
> entries generated when already in the market are ignored certain
> types of markets will be filtered out. Consequently the results may
> become skewed.
>
> I need a way to compound on every entry signal generated and then
> link every entry signal with it's own exit price generated by the
> exit algorithm. As long as the exit strategy is no function of the
> entryprice fifo will lead to correct trade reports. I guess this
> shouldn't be to hard to accomplish? However when entryprice effects
> the exitstrategy (e.g. you pull up the stopprice asap to break even)
> fifo will give incorrect trade reports as later entries may exit
> earlier. The stop is pulled up to breakeven and gives the position
> less freedom to move before hitting the stop.
>
> Thanks
> BB
>
> --- In [email protected] <amibroker%40yahoogroups.com>, "Howard B"
> <[EMAIL PROTECTED]> wrote:
> >
> > Hi Bimbo --
> >
> > You want to buy on the open every day? If you are using end-of-
> day data:
> >
> > Buy = 1;
> > BuyPrice = Open;
> >
> >
> > If you are using the ordinary capabilities of AmiBroker (which I
> assume you
> > are since you are just starting), you will have only one position
> open for a
> > given symbol. Until you exit the first trade, all succeeding Buy
> signals
> > for that symbol will be ignored. If you are running a portfolio,
> AmiBroker
> > keeps track of the Buy and Sell according to the symbol, so there
> is no
> > confusion in the report.
> >
> > Thanks,
> > Howard
> >
> >
> > On Sat, Sep 27, 2008 at 3:59 PM, bimbo2blond <[EMAIL PROTECTED]>
> wrote:
> >
> > > Hello,
> > >
> > > I'm just starting with amibroker and have two questions.
> > >
> > > - How do I program that every day on the open a position is
> opened?
> > > Will 'Buy = Open' do the job?
> > >
> > > - How do I link a buying signal with a sell signal? E.g. I use an
> > > exitstrategy that is a function of the entryprice. Then it is
> possible
> > > that the exit signals appear in a different order then the
> > > entrysignals. How do I make sure that the entry and exit signal
> are
> > > linked so that the report produces correct trade to trade
> results? (If
> > > entry and exit are not linked correctly I may get an incorrect
> > > assesment of the stability of the system)
> > >
> > > Thanks
> > > BB
> > >
> > >
> > >
> >
>
>
>