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

[amibroker] Re: Backtesting Calculation not Real Time 'state' information.



PureBytes Links

Trading Reference Links

 The issue stated by Wes is something that I had already thought
previously.
"Take a simple MA cross over system using 5 minute bars.   That MA can
cross/retreat/re-cross many times during that 5 minute bar as
real-time data streams in and changes.      
Take a read of the thread over in the amibroker-at forum."

 The only way to overcome this problem and back test one strategy like
this would be to have data in ticks, in a way that the
cross/retreat/re-cross would be treated as trades in the back testing
results.
Do you agree?
Where can i read more about this?

 thanks again,  


--- In amibroker@xxxxxxxxxxxxxxx, "Paul Ho" <paultsho@xxx> wrote:
>
> As pmxps asked " imagine that my trading system evaluates daily bars and
> has a limit take profit order for a stock at $50 and a stop loss
> order at $46. This bar opened and closed at $48 with high at 51 and
> low at 45.
> How does amibroker know which one was hit first. The high or the low?"
> As pmxgs already know the close, this is not real time trading. As in
> Tradestation, you need
> intraday bars (one bar is not enough) all it involved is a few lines
of afl
>  
> TimeFrameSet(inDaily);
> 
> // search for close == open and high <> low
> 
> Candidate = Close == Open AND High > Low AND High > Close AND Close
> Low;
> 
> TimeFrameRestore();
> 
> icandidate = TimeFrameExpand(Candidate, inDaily, expandFirst);
> 
> fbar = DateNum() > Ref(DateNum(), -1);
> 
> Lastbar = DateNum() < Ref(DateNum(), 1) OR BarIndex() ==
> LastValue(BarIndex());
> 
> Lowbeforehigh = iCandidate AND LowestSinceBars(fbar, Low, 1) >
> HighestSinceBars(fbar, High, 1);
> 
> Buy = Lowbeforehigh AND Lastbar;
> 
> This code can be used to scan for crosses that has its low reached
first.
> this does, to the best of my knowledge,
> the same as "look inside a bar" feature of tradestation.
> 
> 
> 
>   _____  
> 
> From: amibroker@xxxxxxxxxxxxxxx [mailto:amibroker@xxxxxxxxxxxxxxx]
On Behalf
> Of Wes Smith
> Sent: Tuesday, 20 February 2007 12:10 PM
> To: amibroker@xxxxxxxxxxxxxxx
> Subject: Re: [amibroker] Backtesting Calculation - Real Time 'state'
> information.
> 
> 
> 
> 
> Ah .. but lowestsincebars  implies multiple bars.  But we're talking
about
> which came 1st within a single bar...   
> So I don't think those functions will work either.
> 
> fwiw .. the high/low test was just an example.  In an intraday
system, you
> can have many events happen during the life of just a single bar. 
> Take a simple MA cross over system using 5 minute bars.   That MA can
> cross/retreat/re-cross many times during that 5 minute bar as
real-time data
> streams in and changes.       
> 
> Take a read of the thread over in the amibroker-at forum.
> 
> 
> 
> 
> ----- Original Message ----
> From: Paul Ho <paultsho@xxx>
> To: amibroker@xxxxxxxxxxxxxxx
> Sent: Monday, February 19, 2007 7:31:43 PM
> Subject: RE: [amibroker] Backtesting Calculation - Real Time 'state'
> information.
> 
> 
> nothing complicated about this in backtesting
> use the lowestsincebars and highestsincebars functions in intraday
and you
> know whether the low or the high comes first.
> i think you're making too complicated yourself.
> 
>   _____  
> 
> From: amibroker@xxxxxxxxxxxxxxx [mailto:amibroker@xxxxxxxxxxxxxxx]
On Behalf
> Of Wes Smith
> Sent: Tuesday, 20 February 2007 10:51 AM
> To: amibroker@xxxxxxxxxxxxxxx
> Subject: Re: [amibroker] Backtesting Calculation - Real Time 'state'
> information.
> 
> 
> 
> Actually, I do not think you can do what pmxgs wants in AFL.   
> 
> AFL recalculates all variables on every tick/pass thru the formula. This
> happens with every new 'tick' when using a Real/Time data source.
> 
> This isn't an issue with an EOD strategy, but in RealTime.. it's a huge
> issue.  
> 
> For example .. if you need to know if the LOW or HIGH happens first,
then
> you would need to record or 'latch' this event and have it available
to your
> formula on the next intraday 'tick'.  You can't just set a variable for
> this. The next intraday data tic.every tick will reset/recalc all
variables.
> .. effectively  erasing our knowledge that the LOW-Hit event
happened first.
> 
> You might think that the flip() function would do the job .. but it
suffers
> from the same problem.  It's only valid on bar close.
> The only way I know of to do this is with a staticvar.. and that's
pretty
> cumbersome.    And I'm not sure if they are even evaluated during a
> backtest.
> 
> There's a long chain of posts over in the amibroker-at group about this
> problem.  
> http://finance. groups.yahoo. com/group/ AmiBroker-
> <http://finance.groups.yahoo.com/group/AmiBroker-at/message/2191>
> at/message/ 2191
> 
> I'd love to be wrong about this.. so please chime in and correct me
if you
> have a solution !
> (And fwiw, a solution/fix for this problem  would go to the very top
of my
> list vs any new charting features!!!) 
> 
> ----- Original Message ----
> From: dingo <dingo@xxxxxxxx com>
> To: amibroker@xxxxxxxxx ps.com
> Sent: Monday, February 19, 2007 8:41:42 AM
> Subject: RE: [amibroker] Backtesting Calculation
> 
> 
> The only way Tradestation can do this accurately is by use of
intraday data.
> Using EOD data its only a guess.  If you use intraday data then
Amibroker
> can do it as well.
> 
> d 
> 
> > -----Original Message-----
> > From: amibroker@xxxxxxxxx ps.com 
> > [mailto:amibroker@ yahoogroups. com] On Behalf Of pmxgs
> > Sent: Saturday, February 17, 2007 8:26 PM
> > To: amibroker@xxxxxxxxx ps.com
> > Subject: [amibroker] Backtesting Calculation
> > 
> > Hi,
> > 
> >  I'm searching for a back testing software and I'm positively
> > impressed with amibroker. 
> >   But there's one thing that i would like to know.
> >  When amibroker back tests some strategy can we select if inside bar
> > data is evaluated? 
> >  For example , imagine that my trading system evaluates daily bars and
> >  has a limit take profit order for a stock at $50 and a stop loss
> > order at $46. This bar opened and closed at $48 with high at 51 and
> > low at 45.
> > How does amibroker know which one was hit first. The high or the low?
> >  As long as there is intrabar data available this should be considered
> > when back testing results are being calculated, otherwise the results
> > will not be correct.
> >   Tradestation has this feature (look inside bar feature), have a look
> > here: www.adest.com. au/software/ tradestation% 202000i.htm
> <http://www.adest.com.au/software/tradestation%202000i.htm> 
> > 
> >  Hope someone can answer me,
> >  thanks
> > 
> > 
> > 
> > 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.amibroke r.com/devlog/ <http://www.amibroker.com/devlog/> 
> > 
> > For other support material please check also:
> > http://www.amibroke r.com/support.
> <http://www.amibroker.com/support.html> 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.amibroke r.com/devlog/ <http://www.amibroker.com/devlog/> 
> 
> For other support material please check also:
> http://www.amibroke r.com/support. 
<http://www.amibroker.com/support.html>
> html
> 
> Yahoo! Groups Links
> 
> 
>     (Yahoo! ID required)
>




------------------------ Yahoo! Groups Sponsor --------------------~--> 
Transfer from your equities account.  
Receive up to $1,000 from GFT. Click here to learn more.
http://us.click.yahoo.com/aZttyC/X_xQAA/cosFAA/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 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/