PureBytes Links
Trading Reference Links
|
If you are trading a daily system and basing your entry on yesterday's
OHLC then you can code your system to take the trade the NEXT day with
your limits. The problem is, there is no way to know if it opened, then
hit the high first or the low first or did whatever else. You can only
trade if the OPEN meets your limits or you could trade at the END of the
day based on any of the OHLC values. This only makes sense, right? The
system cannot possibly know what the 7:45 price is without some
intra-day data.
As to the ranking, this can be done based on any formula/indicators you
can come up with and assign to the built-in variable /*PositionScore*/.
The backtester will take the highest scores up to the MaxPositions you
have allowed, given you have enough money and also set your positionSize
appropriately. (Note that a negative value of PositionScore will never
be taken.)
--
Terry
-----Original Message-----
From: amibroker@xxxxxxxxxxxxxxx [mailto:amibroker@xxxxxxxxxxxxxxx] On
Behalf Of mikervalley
Sent: Tuesday, August 22, 2006 18:25
To: amibroker@xxxxxxxxxxxxxxx
Subject: [amibroker] Simpler example...Re: I'm having a hard time
explaining this
Has any been able to get this to work?
I too have the same thing that bases a limit order on the previous
day's data.
I'd like AMI to ONLY enter the trade if that price was hit.
Any way to do this without using RT data?
-Mike
--- In amibroker@xxxxxxxxxxxxxxx, "techsmart" <mric@xxx> wrote:
>
>
> No, Bob, this is not a problem really. The systems work well. I've
> been using them for two years. I would just like to be able to use
> the backtester to accurately simulate the systems and be able to test
> various filters.
>
> Basically, I get a list of symbols that are potential trades. I then
> use limit orders the NEXT DAY to enter the trades. This all works
> fine and I can roughly control the number of entries by only using a
> subset of the possible signals. And by watching the market intraday
> when I can.
>
> It all works just fine.
>
> All I'm trying to do is get the backtester to help me out a little
> and give me more accurate test results by RANKING the potential
> signals and trading only the top 'x' hits.
>
> I'm sure this can be done in AB.
>
> ts
>
>
> --- In amibroker@xxxxxxxxxxxxxxx, "Bob Jagow" <bjagow@xxxx> wrote:
> > Your difficulty lies in trying to trade intraday using EOD data.
> >
> > Bob
> > -----Original Message-----
> > From: techsmart [mailto:mric@xxxx]
> > Sent: Sunday, December 19, 2004 8:00 PM
> > To: amibroker@xxxxxxxxxxxxxxx
> > Subject: [amibroker] Simpler example...Re: I'm having a hard time
> > explaining this
> >
> >
> >
> >
> > <groan> I clearly am not doing well at explaining what I want.
> >
> > This has nothing to do with predicting tomorrow's prices. Just the
> > opposite in a way. If I use PositionScore with this system and rank
> > on ROC(C,20), then.... if there were 20 signals that were entered as
> > limit orders and .... 10 of those got hit and I've got MaxPositions
> > set at 3, then the backtester will take 3 of those 10 entries with
> > the highest ROC(C,20) and use those as the entries.
> >
> > Obviously, I can't know in advance which limit orders will get hit
> > during the day, so can't do the same thing.
> >
> > HOWEVER, it should be possible to limit the number of signals by
> > RANKING them EOD the day BEFORE the entry day and then taking just a
> > certain number of the signals to enter as limit orders for the
> > backtester.
> >
> > I feel sure this is something that AB can do, I'm just not well-
> > versed enough with AFL and programming in general to figure it out.
> > And apparently not good at explaining what it is I'm wanting to do.
> >
> > But, no, I have no illusions about predicting tomorrow's
> prices. : )
> >
> > ts
> >
> >
> >
> > --- In amibroker@xxxxxxxxxxxxxxx, "Graham" <gkavanagh@xxxx> wrote:
> > > If anyone can come up with a system that can predict tomorrows
> > prices then
> > > they will make their fortune twice. First by trading it, then by
> > selling it
> > > :)
> > >
> > > All I can suggest is you keep plugging away at all the
> > possibilities until
> > > you find something that works
> > >
> > > Cheers,
> > > Graham
> > > http://e-wire.net.au/~eb_kavan/
> > >
> > > -----Original Message-----
> > > From: techsmart [mailto:mric@xxxx]
> > > Sent: Monday, December 20, 2004 11:41 AM
> > > To: amibroker@xxxxxxxxxxxxxxx
> > > Subject: [amibroker] Simpler example...Re: I'm having a hard time
> > explaining
> > > this
> > >
> > >
> > >
> > > OK, let me make a simple example and see if it makes sense...
> > >
> > > Let's say I've got a basket trading system. At EOD I run a scan
> to
> > > get potential signals. I daily end up with 20 to 50 signals.
> > > BECAUSE I am entering limit orders on these signals at 5% below
> > > today's close, I can't be sure how many of the signals will get
> hit.
> > >
> > > I don't want to have 20 or 50 trades on, but I know that certain
> > > filters will improve results. I cannot predict when the limit
> > orders
> > > will get hit intraday, so backtesting with PositionScore does not
> > > work. It will rank the trades on the entry day, based on the
> score
> > > at EOD THAT DAY.
> > >
> > > What I need is a way to rank all the signals the day before entry
> > day
> > > and then keep a certain number, say 5 to 10. I still don't know
> > how
> > > many limit orders will get hit the next day, but I DO know the
> > upper
> > > limit AND I also have a rank-ordered list that produces better
> > > results.
> > >
> > > So... how can I take the signals from EOD on the day before entry
> > and
> > > rank them by some factor such as ROC(C,20) and keep only a certain
> > > number for the backtester to use in the simulation of the next
> > day's
> > > trading.
> > >
> > > I have several basket type systems where this technique would be
> > very
> > > handy to be able to use in the backtester.
> > >
> > > Thanks for any help.
> > >
> > > TS
> > >
> > > --- In amibroker@xxxxxxxxxxxxxxx, "techsmart" <mric@xxxx> wrote:
> > > >
> > > > Maybe someone here can help.
> > > >
> > > > PositionScore alone will not do what I want.
> > > >
> > > > The day before trade entry I scan for POTENTIAL entries. I get
> > up
> > > to
> > > > 40 or 50 signals. On the next day I use a limit order a certain
> > > > percentage below the prior day close as an entry. However, I do
> > > not
> > > > want to end up with too many buys, so I rank the potential
> > entries
> > > by
> > > > ROC(C,40) and take the top 'x'(usually about 5 to 10) number of
> > > > signals and enter them as limit orders. This way I can be sure
> > to
> > > > not overextend my equity. Of those limit orders I can have
> > > anywhere
> > > > from 0 to all filled.
> > > >
> > > > I have the system worked out in the AB backtester except that
> > > > PositionScore and MaxPositions does not accurately simulate what
> > > > really happens. Using these filters, will result in the system
> > > > taking the 'x' number of entries with the highest ROC amongst
> all
> > > > those that got hit. This is not reality, but based on the EOD
> > data
> > > > on the day of entry.
> > > >
> > > > What I need is to have the backtester take all the signals and
> > then
> > > > RANK them by ROC(C,40) and then take the top 'x' (say 5 or 10)
> > and
> > > > use those as the basket to trade the next day. Of those 'x'
> > number
> > > > of signals, anywhere from 0 to x may be entered, but this will
> be
> > a
> > > > realistic backtest...just as I trade the system.
> > > >
> > > > Below is an exchange with AB support. I have not made clear
> what
> > I
> > > > am trying to do, but maybe it will help explain it.
> > > >
> > > > In sum: I want to rank all signals by some filter factor and
> > then
> > > > take the top 'x' number to use as potential buys the next day,
> > > > discarding all those that fall below a certain RANK. Hard
> > cutoffs
> > > > will not give me a specific number of signals. For instance, if
> > I
> > > > used ROC(C,40) > 20, some days I would get no signals and other
> > > days
> > > > I might get 30.
> > > >
> > > > Anyone know how this might be done?
> > > >
> > > > I think the 'for' loop might do, but not sure.
> > > >
> > > > ts
> > > >
> > > > ---------------------------
> > > > Marcin,
> > > >
> > > > I did not make myself clear.
> > > >
> > > > If you have signals the day before and a group of possible
> > entries
> > > > that are
> > > > entered intraday THE NEXT DAY with a limit order, using
> > > PositionScore
> > > > and
> > > > MaxPositions does not simulate reality. Using that method, the
> > > > backtester
> > > > will take the top x number of trades based on PositionScore, but
> > in
> > > > reality
> > > > you would have no idea which trades would hit their limit order
> > > > first, so
> > > > would not know until EOD which of the PositionScore ranked
> trades
> > > you
> > > > would
> > > > take.
> > > >
> > > > SO... the point is...
> > > >
> > > > I need a method to rank all the potential signals on the day
> > PRIOR
> > > to
> > > > entry.
> > > > Then take x number of them (say 10) and only use those as
> entries
> > > on
> > > > the
> > > > next day.
> > > >
> > > > Can I do this: Take a list of symbols that pass a filter....
> say
> > > > perhaps 40
> > > > symbols, then rank them by some factor, such as ROC(C,40), then
> > use
> > > > only the
> > > > top 10 (for example) as potential trades the next day. Of those
> > > 10,
> > > > only
> > > > the ones that hit a certain limit order would be bought.
> > > >
> > > > I need a way to rank and filter the signals from the day before
> > and
> > > > then
> > > > strip off those below a certain rank. PositionScore does this
> > > after
> > > > the
> > > > fact...EOD on the entry day and this is not the way the system
> > > really
> > > > works.
> > > >
> > > > Hope I am expressing myself clearly. I know it is confusing.
> > > >
> > > >
> > > >
> > > > Subject: Re: [#16654] Ranking signals for possible entry the day
> > > > before
> > > >
> > > >
> > > > > Helo,
> > > > >
> > > > > You can use PositionScore variable in your formula and define
> > the
> > > > criteria
> > > > > you use.
> > > > > (and combine it with the Maximum open positions limit)
> > > > >
> > > > > See:
> > > > > http://www.amibroker.com/guide/h_portfolio.html
> > > > >
> > > > >
> > > > > Best regards
> > > > >
> > > > > Marcin Gorzynski
> > > > > Amibroker.com Technical Support
> > > > >
> > > > > Subject: [#16654] Ranking signals for possible entry the day
> > > before
> > > > >
> > > > >
> > > > > First let me say that Amibroker is a wonderful tool for system
> > > > development
> > > > > and backtesting. I've used many others and find that
> Amibroker
> > > has
> > > > all
> > > > > the
> > > > > capabilities I've been looking for. I've already given you a
> > > > favorable
> > > > > review on the Elite Trader message board and will continue to
> > > > recommend
> > > > > your
> > > > > software to others. It's very capable and FAST! Thanks!
> > > > >
> > > > >
> > > > > V. 4.65.2
> > > > >
> > > > > My question:
> > > > >
> > > > > My system finds potential signals on the day before entry.
> > There
> > > > may be
> > > > > anywhere from 0 to 50 potential signals on any one day.
> > > > >
> > > > > Entries are made the NEXT day on a limit order. So, I cannot
> > be
> > > > sure how
> > > > > many of those limit orders will be hit. I can simply limit
> the
> > > > number of
> > > > > orders I submit, but this does not seem to be a very good way
> > to
> > > > backtest
> > > > > and does not simulate what I do in reality. In testing I have
> > > > found that
> > > > > filtering on certain parameters can improve results (such as
> > > taking
> > > > those
> > > > > signals for stocks with the greatest 40 day ROC). I can test
> > > this
> > > > in the
> > > > > backtester with the portfolio option using positionscore, but
> > > this
> > > > is
> > > > > unrealistic, because there might have been 20 limit orders hit
> > > > intraday
> > > > > and
> > > > > the backtester will take the 2 (or whatever MaxOpenPositions
> > > number
> > > > I have
> > > > > specified) with the best ROC, something I would not have been
> > > able
> > > > to
> > > > > predict intraday when limit orders are getting hit at various
> > > > different
> > > > > times.
> > > > >
> > > > > What I would like to do is this: On the day before entry (the
> > > > signal
> > > > > day),
> > > > > I would like to be able to rank all the possible signals by
> > some
> > > > factor,
> > > > > such as 40 day ROC. This still leaves some uncertainty about
> > how
> > > > many
> > > > > actual entries you'll get, but it would prevent the backtester
> > > from
> > > > doing
> > > > > something that couldn't be done in reality and would put an
> > upper
> > > > limit on
> > > > > the number of trades taken.
> > > > >
> > > > > So...to summarize:
> > > > >
> > > > > Can the backtester take all the potential signals on day -1
> and
> > > > rank them
> > > > > according to some factor (say, ROC(C,40)) and then just use a
> > > > limited
> > > > > subset
> > > > > of all the signals to use as actual limit orders on the next
> > > day.
> > > > Hard
> > > > > cut-offs, like ROC(C,40) > 20, don't work because that can
> give
> > > you
> > > > many
> > > > > signals one day and none the next. What is needed is a
> > relative
> > > > ranking
> > > > > or
> > > > > scoring, so that the backtester will only take, for example,
> > the
> > > 5
> > > > stocks
> > > > > with the highest ROC40, all the others being discarded.
> > > > >
> > > > > I think the 'for loop' may be the way to do this, but I'm not
> > > > skilled
> > > > > enough
> > > > > to be able to sort it out.
> > > > >
> > > > > Thanks very much for your help and for a great trading tool.
> > > > >
> > > >
> > > > >
> > > > >
> > >
> > >
> > >
> > >
> > >
> > >
> > > Check AmiBroker web page at:
> > > http://www.amibroker.com/
> > >
> > > Check group FAQ at:
> > > http://groups.yahoo.com/group/amibroker/files/groupfaq.html
> > > Yahoo! Groups Links
> >
> >
> >
> >
> >
> >
> > Check AmiBroker web page at:
> > http://www.amibroker.com/
> >
> > Check group FAQ at:
> > http://groups.yahoo.com/group/amibroker/files/groupfaq.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
|