PureBytes Links
Trading Reference Links
|
Because your "~~~EQUITY" is being recalculated while your
backtesting, so you have a kind of circular reference in there.
Alternative would be to rename the initial "~~~EQUITY" and
positionsize of from that one. However, I suspect you will need to
use the custom backtester to do what you require, namely to
dynamically reposition sizes according to the devlopment of your
equity.
PS
--- In amibroker@xxxxxxxxxxxxxxx, Andrew Z <wizard@xxxx> wrote:
>
> G'day all,
>
> I'm trying to write a positionsize element into my code. After a
bit of
> searching and tweaking I've come up with this:
>
> eq = Foreign("~~~EQUITY", "C");
> size = eq * 0.02; // work out 2% of total equity
> PositionSize = size / 40; // numbers of lots to buy/sell
>
> What I'm trying to do is work out my 2% risk (of total Equity) and
use
> that value to work out my positionsize (how many lots I can
buy/sell).
>
> On an exploration all data seems to behave correctly. size changes
as
> equity rises and falls and, consequently, my position size follows
suit.
>
> However, when I backtest my code with the Foreign line above I get
0
> results.
>
> Can any shed some light on this please?
>
> Thanks,
> Andrew.
>
------------------------ Yahoo! Groups Sponsor --------------------~-->
Try Online Currency Trading with GFT. Free 50K Demo. Trade
24 Hours. Commission-Free.
http://us.click.yahoo.com/RvFikB/9M2KAA/U1CZAA/GHeqlB/TM
--------------------------------------------------------------------~->
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
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/amibroker/
<*> To unsubscribe from this group, send an email to:
amibroker-unsubscribe@xxxxxxxxxxxxxxx
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
|