Update: Thinking the problem might be due to circularity involved between
~~~EQUITY and SetPositionSize, I tried putting the operative statements in a
loop:
for (i = 1; i < BarCount; i++)
{
Indicated_Shares[i] = TheEquity[i] / Open[i];
ThePosition[i] = Min(Indicated_Shares[i], MaxShares[i]);
}
Tested with and without the SetPositionSize inside of the loop - Still no
results in the backtest - TRACE reveals that TheEquity stays at it's initial
level throughout the entire loop
--- In [email protected], "spi_maker" <ja...@...> wrote:
>
> Thanks Graham - Yes I did have that setting ticked and turning it off solved
> the first problem. Now if I can just figure out what I am doing wrong in the
> second problem situation.
>
> Thanks again - Jim
>
> --- In [email protected], Graham <kavemanperth@> wrote:
> >
> > At a rough guess you have AllowPositionShrinking turned on
> >
> > --
> > Cheers
> > Graham Kav
> > AFL Writing Service
> > http://www.aflwriting.com
> >
> >
> >
> > 2009/5/22 spi_maker <jarea@>:
> > > I am trying to calculate a position size based on the current level of
> > > equity built up, but I not doing this properly.
> > >
> > > I set up a situation to limit trades to a percentage of recent average
> > > volume as:
> > >
> > > Vol_Limit = .05;
> > >
> > > MaxShares = MA(V, 10) * Vol_Limit * 1000;
> > >
> > > TheEquity = Foreign("~~~EQUITY", "C");
> > >
> > > Indicated_Shares = TheEquity / Open;
> > >
> > > The_Position = Min(MaxShares, Indicated_Shares);
> > >
> > > SetPositionSize(The_Position, spsShares);
> > >
> > >
> > >
> > > First Problem
> > >
> > > I was having difficulty getting working results so I set the position
> > > size to a fixed amount as:
> > >
> > > SetPositionSize(500, spsShares);
> > >
> > > When I ran the backtest, it dutifully set the shares to 500 except would
> > > randomly set the shares to 210, then 230, then 260, then 290 etc. in
> > > transactions 5, 16, 18, 30, etc. Throughout 600 trades, 99% of the share
> > > values are 500 and the rest are these odd values.
> > >
> > > I wonder if anyone has any idea what might be happening there.
> > >
> > >
> > >
> > > Second Problem is much simpler. When I use the
> > > SetPositionSize(The_Position, spsShares) in the backtester, I get no
> > > results at all. No trades, no nothing, which leads me to believe that I
> > > am not using the ~~~EQUITY properly.
> > >
> > > Any insights would be greatly appreciated.
> > >
> > > When I backtested this
> > >
> >
>