PureBytes Links
Trading Reference Links
|
Thanks Graham - appreciated.
It would appear to be but is there a connection between between
MaxLossPointStop and the calculation of position size. I presume you
would use the SetPositionSize but I don't know how you would code it.
MaxStopLossPoint relates to the first pass - how do you bring it into
the calculation inside the loop which is used in the second pass. Is
there an example anywhere ?
Also is there an example of how to trigger a trade inside the second
pass loop ? And an example of how to pick only the highest ranked
trade according to a criteria you set ?
I've looked through PBI Collected documentation but can't see any
examples.
Geoff
--- In amibroker@xxxxxxxxxxxxxxx, Graham <kavemanperth@xxx> wrote:
>
> Is this it?
>
> Risk = 0.01 * EquityAtEntry ; //risk is defined as a constant
> 1% of current equity.
>
> --
> Cheers
> Graham
> AB-Write >< Professional AFL Writing Service
> Yes, I write AFL code to your requirements
> http://e-wire.net.au/~eb_kavan/ab_write.htm
>
>
> On 3/13/06, Geoff Mulhall <geoffmulhall@xxx> wrote:
> > Hi,
> >
> > In the example provided by Tomasz below I do't see how the risk
> > relates to the position size.
> >
> > When I enter a trade my position size in number of shares is
> > calculated as $ to Risk /(entry price - stop price)
> > and I want my $ to risk on the trade to be a % of my currect
equity.
> >
> > I was expecting to see the SetPositionSize used in the example
below
> > but it does not appear - so I'm wondering how the Risk value in
the
> > example below is used to set the position size in the trade.
> >
> > Any help appreciated.
> >
> > Geoff
> >
> > Example follows ->
> >
> > SetCustomBacktestProc("");
> > MaxLossPointStop = 2*ATR(10); // dynamic volatility stoploss, 1st
> > modification
> >
> > function FindEquityAtDateTime( eq, dt, Value )
> > {
> > found = -1;
> > for( i = 0; i < BarCount AND found == -1; i++ )
> > {
> > if( dt[ i ] == Value ) found = i;
> > }
> > return IIf( found != -1, eq[ found - 1 ], Null );
> > }
> > if( Status("action") == actionPortfolio )
> > {
> > bo = GetBacktesterObject();
> > bo.Backtest(1); // run default backtest procedure
> > SumProfitPerRisk = 0;
> > NumTrades = 0;
> > dt = DateTime();
> > eq = Foreign("~~~EQUITY", "C" );
> >
> > for( trade = bo.GetFirstTrade(); trade; trade = bo.GetNextTrade
> > () )
> > {
> > EquityAtEntry = FindEquityAtDateTime( eq, dt,
> > trade.EntryDateTime );
> >
> > Risk = 0.01 * EquityAtEntry ; //risk is defined as a constant
> > 1% of current equity.
> >
> > RiskAsPecentOfCurrentEquity = 100 * Risk / EquityAtEntry;
> > RMultiple = trade.GetProfit()/Risk;
> > trade.AddCustomMetric("Initial risk $", Risk );
> > trade.AddCustomMetric("Equity at entry", EquityAtEntry );
> > trade.AddCustomMetric("Risk as % of Eq.",
> > RiskAsPecentOfCurrentEquity );
> >
> > trade.AddCustomMetric("R-Multiple", RMultiple );
> > SumProfitPerRisk = SumProfitPerRisk + RMultiple;
> > NumTrades++;
> > }
> > Expectancy3 = SumProfitPerRisk / NumTrades;
> > bo.AddCustomMetric( "Expectancy (per risk)", Expectancy3 );
> > bo.ListTrades();
> > }
> > // your trading system here
> >
> > ApplyStop( stopTypeLoss, stopModePoint, MaxLossPointStop );
> >
> >
> >
> >
> >
> >
> >
> >
> > 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
> >
> >
> >
> >
> >
> >
> >
> >
>
------------------------ 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/
|