| 
 PureBytes Links 
Trading Reference Links 
 | 
Thanks Steve.
Basically, what I am trying to do is get a value of my equity at a given 
point. Then, using this equity figure to determine my maximum position 
size allowable according to my MM rule of not risking more than 2% of my 
capital per trade.
I've managed to get it to work (in a round about way), but only after 
placing my position sizing equations AFTER the buy/sells. Interestingly, 
it seems that unless I have the same 2 lines of code before the 
buy/sells then the equations do not function correctly. To illustrate, I 
have the following ( the same lines of code are marked with <<<<<< ):
********************************************************
SetBarsRequired(500,5000);
SetTradeDelays( 1, 1, 1, 1 );
SetOption( "initialequity", 5000 );
SetOption( "PriceBoundChecking", 1 );
SetOption("FuturesMode", 1 );
SetOption("MaxOpenPositions", 1);
size=0;
PointValue = 10000;
MarginDeposit = 1;
size = Equity() * (2/100);   <<<<<<<<<<<<
PositionSize = size / 40;    <<<<<<<<<<<<
spread=0.0002;
stop_amount = Optimize("Default stop",0.0040,0.0010,0.0100,0.0005);
ApplyStop(stopTypeLoss,stopModePoint,stop_amount, exitatstop=1, volatile 
= False, ReEntryDelay = 0 ) ;
profit_amount = Optimize("Default profit",0.0210,0.0010,0.0500,0.0005);
ApplyStop(stopTypeProfit,stopModePoint,profit_amount, exitatstop=1, 
volatile = False, ReEntryDelay = 0 );
Buy = Buyconditions....
Short = Shortconditions...
Sell = Sellconditions...
Cover = Coverconditions...
BuyPrice = O + spread;
ShortPrice = O - spread;
size = Equity() * (2/100);     <<<<<<<<<<<<<<<<<
PositionSize = size / 40;      <<<<<<<<<<<<<<<<<
*********************************************************
The code appears to work ok, given me varying "size" and PositionSize 
variables according to the Equity at the given bars, but I do not 
understand why this code needs to appear twice.
Any ideas?
Andrew.
> Not sure what you are trying to do with it, but I think the main reason the
> Equity() function was introduced is to return an equity line as an aid to
> system development (allows you to visually see drawdowns, etc, when you are
> backtesting your systems and compare equity performance with price,
> indicators, etc  ). TJ describes it as a "backtester in a box". You need to
> define your buy/sell rules before calling it because it uses these rules
> internally to process your trades and return the corresponding equity line.
------------------------ 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/
 
 |