Mate,
If you think you're beaten, you are
I'll provide you with some suggestions below, but its up to you.
1. Problem with cash.
Once you have the cash balance at the beginning of a bar
You can do your own math for cash balance after each signal that you 're
taking a position.
ie. Cash = bo.Cash
for(bo...... )
{
cash = cash - cashyouusedinenteringtrades
}
2. yes scalein/scaleout doesnt provide ranking, you need to do some
workarounds, and do your own rotational trading.
suguest you use one of the signal properties to carry information whether
its scalein/scaleout, and use buy/sell arrays for scalein and scaleout.
e.g pointvalue, or roundlotsize,
_____
From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf
Of vlanschot
Sent: Saturday, 5 May 2007 12:44 AM
To: [email protected]
Subject: [amibroker] Re: CBT: Scaled trades
Paul, appreciate the feedback, but that's exactly where the
difficulty is. See below.
--- In [EMAIL PROTECTED] <mailto:amibroker%40yahoogroups.com> ps.com,
"Paul Ho" <[EMAIL PROTECTED]> wrote:
>
> 1. Cash is a property of the backtester
> so bo.Cash gives you the available cash at each bar;
I understand. This is the cash available at the end (start) of the
(next) bar. Say my scaling takes place at bar 2, assuming I get my
signals on the close of bar 1.
> 2. posize and poscore are properties of the signal object.
> if you want to you can do all your selling/scaleout first, and use
the
> available cash to do what you need.
With CBT & Rotational (see TJ's original code @
http://www.amibroke
<http://www.amibroker.com/kb/2006/03/06/re-balancing-open-positions/>
r.com/kb/2006/03/06/re-balancing-open-positions/),
I cannot get to the amount of cash generated by the ScaleOut-trades,
let alone allocate cash over the subsequent ScaleIn trades since
signal.Type cannot specify between the two. Also, the possize and
posscore in the rebalancing are different from those used for the
entry/exit trades, i.e. I have defined them within the pos =
GetFirstOpenPos loop.
> and use the bo.EntrerTrade or bo.ScaleTrade to do what you need.
My conclusion, and I hope I'm wrong: bo.ScaleTrade in rotational mode
cannot be ranked/get trade-specific cash allocations in case one uses
rebalancing criteria within the OpenPositions-list.
This strategy may sounds complicated, but isn't. As I've written
elsewhere, I simply want to hold all constituents of an index all the
time, but reweight (e.g. monthly) the positions based on stock-
specific arrays, 1 being my score, and the second the official
relative weight of the stock in the index, both of which obviously
change over time.
PS
>
>
> _____
>
> From: [EMAIL PROTECTED] <mailto:amibroker%40yahoogroups.com> ps.com
[mailto:[EMAIL PROTECTED] <mailto:amibroker%40yahoogroups.com> ps.com]
On Behalf
> Of vlanschot
> Sent: Thursday, 3 May 2007 11:00 PM
> To: [EMAIL PROTECTED] <mailto:amibroker%40yahoogroups.com> ps.com
> Subject: [amibroker] Re: CBT: Scaled trades
>
>
>
> Thanks mate, but forgot to mention: I use rotational mode in CBT
> which seems to complicate matters due to the fact that scaling is
> triggered by stock-specific variables (arrays) which relate to both
> (current vs. required) PositionSize and (previous vs. new)
> PositionScore.
> I have been unable to determine:
> 1) how much cash is available for all ScaleIns at each bar
> 2) how to allocate this cash according to a specific "ScaleIn"-rule.
>
> Support question, I suspect.
>
> PS
>
> --- In [EMAIL PROTECTED] <mailto:amibroker%40yahoogroups.com>
ps.com,
> "Paul Ho" <paultsho@> wrote:
> >
> > Mate
> > If you're using CBT, you can program the way you want it
> > just put scaleout before the others, they will be executed
first ;)
> >
> >
> > _____
> >
> > From: [EMAIL PROTECTED] <mailto:amibroker%40yahoogroups.com>
ps.com
> [mailto:[EMAIL PROTECTED] <mailto:amibroker%40yahoogroups.com>
ps.com]
> On Behalf
> > Of vlanschot
> > Sent: Thursday, 3 May 2007 9:01 PM
> > To: [EMAIL PROTECTED] <mailto:amibroker%40yahoogroups.com>
ps.com
> > Subject: [amibroker] CBT: Scaled trades
> >
> >
> >
> > Could anybody possibly confirm whether ScaleOut trades are
executed
> > FIRST, in order to release cash for the subsequent ScaleIn trades?
> >
> > And if so, is the only way to calculate the resulting amount of
> cash
> > available for the ScaleIn-trades to add (PosSize - Exit
> Commissions) of
> > each ScaleOut to the bo.Cash of the previous bar?
> >
> > Thx,
> >
> > PS
> >
>