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

[amibroker] Buying before selling



PureBytes Links

Trading Reference Links

Hi there,

A bit of a strange one, I have.

My buy is on the open at the opening price. My sell is equivalent to a
profit stop, selling when price exceeds a threshold price.

In backtesting, when a trade exits as a result of price exceeding the
threshold, if that bar also happens to be a candidate for a buy, the
backtester will assume the first trade has exited, and will report
another trade on that bar (at the open price) - which happens to exit
on the same bar, since  entry and exit criteria exist on the same bar.
This is skewing my results fairly significantly.

Has anyone had this issue, and is there a way around it?

There are alot of valid trades that are only 1 bar long, so I can't
simply uncheck "Allow same bar exit".

I need to be able to tell the backtester that there if there is a
trade that exists at the time of open, so ignore the trade for that
bar, if that existing trade exits later in the bar.... That sounded
horrible, but hopefully you will get my drift...

Perhaps if I could find a way to determine if I was in a trade on the
previous bar, I would be able to exclude any buys on the current bar?



snip___________

Forget the above, I have worked it out. I thought I should still post
so others might know how to do it, should they have the same problem.

I added the 'flip' function so AB would know if I was in a trade on
the previous bar:

InTrade = Flip( Buy, Sell ); 
InTrades = Flip( Short, Cover ); 

Buy = Buy AND NOT Ref(intrade,-1);
Short = Short AND NOT Ref(intrades,-1);






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/