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

[amibroker] Re: Are multiple trades per signal possible via the CBT?



PureBytes Links

Trading Reference Links

I have seen the code below suggested for pair trading in "normal"
mode, but I don't think it it will actually work for hedging or even
most pair trading systems.  I believe this type of code would only
work if the system does not use any test conditions based on the
specific security being traded (i.e any price, volume, or indicators).

My understanding is that AA operates one symbol at a time in normal
mode.   So if i want to buy a security when its MACD crosses the
Signal, AA will iterate through each security, test for that
condition, then enter (or not enter) a trade on that security.  What I
cannot do is test for conditions on one security and then enter a
trade on a *different* security. (The Foreign function is not much
help, because there will be many securities that generate a trade
signal, but we don't yet know which securities they will be.)

So the code might work for a very simple pair trading system that is
run against two specific securities, where the only test condition is
the based on value of the spread between the two -- since that value
will be the same for each iteration of the code.  But as soon as you
include any security specific entry conditions then I don't believe
the code will work.    

--- In amibroker@xxxxxxxxxxxxxxx, "Tomasz Janeczko" <groups@xxx> wrote:
>
> Yes of course. With custom backtester you can enter / exit / scale
> any number of trades per signal.
> 
> But "normal" mode does that as well:
> 
> YourEntrySignal = ..... your code here
> YourExitSignal = ..... your code here
> 
> if( Name() == "SYMBOL1" )
> {
>   buy = YourEntrySignal;
>   sell = YourExitSignal;
> }
> 
> if( Name() == "SYMBOL2" )
> {
>   Short= YourEntrySignal;
>   Cover = YourExitSignal;
> }
> 
> Best regards,
> Tomasz Janeczko
> amibroker.com
> ----- Original Message ----- 
> From: "trustdnb" <trustdnb@xxx>
> To: <amibroker@xxxxxxxxxxxxxxx>
> Sent: Monday, September 10, 2007 5:53 AM
> Subject: [amibroker] Are multiple trades per signal possible via the
CBT?
> 
> 
> > Is it possible to generate multiple trades per signal using the custom
> > backtester?  I am working on a long only system that is sensitive to
> > the direction the broad market and want to see how the system performs
> > while hedging market risk.  
> > 
> > Logically, what I want to happen is that when the system receives a
> > buy signal it simultaneously (1) enters a long trade on the stock and
> > (2) shorts an equal dollar amount the market.  Upon exiting the long
> > trade (via sell signal or via stop loss), the system will
> > simultaneously cover the market short.  
> > 
> > The "normal" mode wont allow you to generate trades on two different
> > systems at the same time, but can this be done via the CBT?  If this
> > sort of thing can be done, it could also be useful for pair trading
> > strategies.  Is there any example code around that might be helpful?  
> > 
> > 
> > 
> > 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
> > 
> > 
> > 
> > 
> >
>




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/