Thanks Graham - I'll look into the custom backtest code.
--- In [email protected], Graham <kavemanpe...@...> wrote: > > "~~~EQUITY" is only produced after the backtest is complete so cannot > be used in the main AFL. > You can only address this as % of equity in the AFL either using > positionsize = -10; or setpositionszie(10,spsequity), these only give > basic instructions and will not change the trade size as you wish to. > To change the size you need to use the custom backtest code, there are > various example of this in the help files and the various internet > locations, eg AB knowledge base etc. > > > -- > Cheers > Graham Kav > AFL Writing Service > http://www.aflwriting.com > > > > > > 2009/5/22 spi_maker <ja...@...>: > > 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" <jarea@> 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 > >> > > > >> > > >> > > > > > > > > > > ------------------------------------ > > > > **** IMPORTANT PLEASE READ **** > > This group is for the discussion between users only. > > This is *NOT* technical support channel. > > > > TO GET TECHNICAL SUPPORT send an e-mail directly to > > SUPPORT {at} amibroker.com > > > > TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at > > http://www.amibroker.com/feedback/ > > (submissions sent via other channels won't be considered) > > > > For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG: > > http://www.amibroker.com/devlog/ > > > > Yahoo! Groups Links > > > > > > > > >
