PureBytes Links
Trading Reference Links
|
I'm surprised that I haven't had a response. Whilst I haven't been
able to resolve it, I would have expected that it wasnn't a difficult
problem.
Graham
>
> Just starting to get my hands dirty in the Custom Backtester and
have
> read everything I can find.
>
> Some time ago I found some code on this forum for a custom metric
for
> Max Open Positions - it has worked fine on Long systems but when I
> try it on a Short system, it returns O max Open Trades. Have I
> missed something?
>
> Code follows.
>
> Graham
>
> SetOption("UseCustomBacktestProc", True);
> SetCustomBacktestProc("");
>
> //================== Open Position Count ==================
> vCounts = Cum( 0 );
> vMaxCount = 0;
>
> if ( Status( "action" ) == actionPortfolio )
> {
> vBO = GetBacktesterObject();
> vBO.PreProcess();
>
> for ( vBar = 0; vBar < BarCount; vBar++ )
> {
> vBO.ProcessTradeSignals( vBar );
> vCnt = 0;
>
> for ( vPos = vBO.getFirstOpenPos(); vPos; vPos =
> vBO.getNextOpenPos() )
> {
> vCnt++;
> _TRACE( "Count: " + vCnt );
> }
>
> vCounts[vBar] = vCnt;
>
> if ( vCnt > vMaxCount )
> {
> vMaxCount = vCnt;
> }
> }
>
> vBO.PostProcess();
>
> vBO.addCustomMetric( "Max Open Posn", vMaxCount );
>
> AddToComposite( vCounts, "~OpenPosCount", "V", atcFlagDefaults
|
> atcFlagEnableInBacktest | atcFlagEnableInPortfolio );
> }
>
------------------------------------
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 NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/
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/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/amibroker/join
(Yahoo! ID required)
<*> To change settings via email:
mailto:amibroker-digest@xxxxxxxxxxxxxxx
mailto:amibroker-fullfeatured@xxxxxxxxxxxxxxx
<*> 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/
|