[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[amibroker] Re: How to get "total net position value" in backtester for market neutral syste



PureBytes Links

Trading Reference Links

Hello Tomasz,

I coded my system with the low level bactester. They are a couple of 
things I would like to do in the low level backtester:

1- how can I deactivate stops on one stock symbol?
I set up a trailing stops but I would like to de-activate it on one 
stock. How can I do that? I tried with :
StopPoint = IIf (Name()=="Name",1000,MyNormalStop);
but it does not work.

2- How can I cancel a signal?
To cancel a signal I exit at the entry with:
if ( sig.IsEntry() ) bo.exitTrade( bar, sig.Symbol, sig.Price,0);
but I fear with this method I gat commission costs. Is there another 
way to cancel a signal?

Regards,
Olivier









--- In amibroker@xxxxxxxxxxxxxxx, "Tomasz Janeczko" <groups@xxx> 
wrote:
>
> As many signals will be processed as there is enough cash to open 
positions.
> Also market neutral portfolios are supported directly without 
custom backtester,
> thanks to new feature MaxOpenLong/MaxOpenShort.
> 
> See this:
> http://www.amibroker.com/devlog/wp-
content/uploads/2008/10/readme5190.html
> 
> Scroll down the document to this part:
> 
> CHANGES FOR VERSION 5.11.0 (as compared to 5.10.1)
> Backtester: Implemented SeparateLongShortRank
> 
> To enable separate long/short ranking use:
> SetOption("SeparateLongShortRank", True );
> 
> When separate long/short ranking is enabled, the backtester 
maintains TWO separate "top-ranked" signal lists, one
> for long signals and one for short signals. This ensures that long 
and short candidates are independently even if position score
> is not symetrical (for example when long candidates have very high 
positive scores while short candidates have only fractional 
> negative scores).
> That contrasts with the default mode where only absolute value of 
position score matters, therefore one side (long/short) may 
> completely dominate ranking if score values are asymetrical.
> 
> When SeparateLongShortRank is enabled, in the second phase of 
backtest, two separate ranking lists are interleaved to form final 
> signal list by
> first taking top ranked long, then top ranked short, then 2nd top 
ranked long, then 2nd top ranked short, then 3rd top ranked long
> and 3rd top ranked short, and so on... (as long as signals exist in 
BOTH long/short lists, if there is no more signals of given 
> kind, then
> remaining signals from either long or short lists are appended)
> 
> For example:
> Entry signals(score):ESRX=Buy(60.93), GILD=Short(-47.56), CELG=Buy
(57.68), MRVL=Short(-10.75), ADBE=Buy(34.75), VRTX=Buy(15.55), 
> SIRI=Buy(2.79),
> 
> As you can see Short signals get interleaved between Long signals 
even though their absolute values of scores are smaller than 
> corresponding scores of long signals. Also there were only 2 short 
signals for that particular bar so, the rest of the list shows 
> long signals in order of position score
> 
> Although this feature can be used independently, it is intended to 
be used in combination with MaxOpenLong and MaxOpenShort options.
> Backtester: MaxOpenLong/MaxOpenShort implemented
> 
> MaxOpenLong - limits the number of LONG positions that can be open 
simultaneously
> MaxOpenShort - limits the number of SHORT positions that can be 
open simultaneously
> 
> Example:
> SetOption("MaxOpenPositions", 15 );
> SetOption("MaxOpenLong", 11 );
> SetOption("MaxOpenShort", 7 );
> 
> The value of ZERO (default) means NO LIMIT. If both MaxOpenLong and 
MaxOpenShort are set to zero (
> or not defined at all) the backtester works old way - there is only 
global limit active (MaxOpenPositions) regardless of type of 
> trade.
> 
> Note that these limits are independent from global limit 
(MaxOpenPositions).
> This means that MaxOpenLong + MaxOpenShort may or may not be equal 
to MaxOpenPositions.
> 
> If MaxOpenLong + MaxOpenShort is greater than MaxOpenPositions
> then total number of positions allowed will not exceed 
MaxOpenPositions, and individual long/short limits will apply too.
> For example if your system MaxOpenLong is set to 7 and maxOpenShort 
is set to 7 and MaxOpenPositions is set to 10
> and your system generated 20 signals: 9 long (highest ranked) and 
11 short, it will open 7 long and 3 shorts.
> 
> If MaxOpenLong + MaxOpenShort is smaller than MaxOpenPositions (but 
greater than zero), the system won't be able to
> open more than (MaxOpenLong+MaxOpenShort).
> 
> Please also note that MaxOpenLong and MaxOpenShort only cap the 
number of open positions of given type (long/short).
> They do NOT affect the way ranking is made. I.e. by default ranking 
is performed using ABSOLUTE value of positionscore.
> 
> If your position score is NOT symetrical, this may mean that you 
are not getting desired top-ranked signals from one side.
> Therefore, to fully utilise MaxOpenLong and MaxOpenShort in 
rotational balanced ("market neutral") long/short systems
> it is desired to perform SEPARATE ranking for long signals and 
short signals.
> To enable separate long/short ranking use:
> SetOption("SeparateLongShortRank", True );
> 
> Best regards,
> Tomasz Janeczko
> amibroker.com
> ----- Original Message ----- 
> From: "Steve Davis" <_sdavis@xxx>
> To: <amibroker@xxxxxxxxxxxxxxx>
> Sent: Monday, October 27, 2008 12:08 PM
> Subject: [amibroker] Re: How to get "total net position value" in 
backtester for market neutral syste
> 
> 
> > How will the updated signal scores be processed? Aren't, the 
signals
> > already sorted by score upon entry to the custom backtester?
> >
> > --- In amibroker@xxxxxxxxxxxxxxx, "Mike" <sfclimbers@> wrote:
> >>
> >> Have a look at the file "AmiBroker Custom Backtester 
Interface.pdf
> >> " posted by gp_sydney in the Files section of this group.
> >>
> >> Within your own custom backtest code, you can iterate through 
your
> >> open positions on a bar by bar basis. Gather the necessary
> >> statistics, then iterate through the signals for that bar and 
adjust
> >> the positon score property as needed.
> >>
> >> Mike
> >>
> >> --- In amibroker@xxxxxxxxxxxxxxx, "olivier_molongo"
> >> <olivier_molongo@> wrote:
> >> >
> >> > Hello,
> >> >
> >> > How can I get "total net position value" in backtester?
> >> >
> >> > My system gives buy and sell signal with positionScore but I 
would
> >> like
> >> > to backtest a market neutral system. One idea I have is to 
adjust
> >> > position score to favor long trades when I am net short and 
short
> >> > trades when I am net long.
> >> >
> >> > But how can I get the net position in AB? which is the sum of
> >> position
> >> > value of open trades.
> >> >
> >> > Regards,
> >> > Olivier
> >> >
> >>
> >
> >
> >
> > ------------------------------------
> >
> > **** IMPORTANT ****
> > This group is for the discussion between users only.
> > This is *NOT* technical support channel.
> >
> > *********************
> > TO GET TECHNICAL 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
> >
> >
> >
>



------------------------------------

**** IMPORTANT ****
This group is for the discussion between users only.
This is *NOT* technical support channel.

*********************
TO GET TECHNICAL 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/