Evo, in my opinion if you were backtesting in weekly only, expandfirst
would be no problem. Expandfirst starts with Monday's data and changes
as each day passes, so by Friday that weekly value represents the week
just gone. Unfortunately in backtesting you are only seeing the end
result of the weekly calculation. OK if you have a condition in your
trade signals to only use Fridays results. Otherwise you are looking
into the future during the backtest for each day except Friday.
So generaly you must use expandlast, consider like doing a scan on Eod
data, you do not use data colected at 2pm as substitute for data at
4pm close.
--
Cheers
Graham
AB-Write >< Professional AFL Writing Service
Yes, I write AFL code to your requirements
http://e-wire.net.au/~eb_kavan/ab_write.htm
On 1/7/06, Evo1 <Evo1@xxxxxxxxxxx> wrote:
Hi Graham,
Many thanks for your valuable help, I really appreciate it !
So the right code would be :
TimeFrameSet( inWeekly );
myavg = (H+L+C)/3;
BwiH = ( (BBandTop( myavg, 20 ,2 )- BBandBot( myavg, 20 , 2 )) / MA( myavg,
20 ) )*100;
LLVBwiH = LLV(BwiH, 120) ;
NivH = BwiH < Ref(LLVBwiH,-1) ;
TimeFrameRestore();
Essai = TimeFrameExpand( NivH , inWeekly,expandFirst ) ;
One question Graham about the use of the Expandfirst.
Excerpt from the AB Help file : "Caveat : expandFirst used on price
different than open may look into the future. For example if you create
weekly HIGH series, expanding it to daily interval using expandFirst will
enable you to know on MONDAY what was the high for entire week."
Do you think I can accurately backtest a trading system with the code above
?
Tia
Regards,
Evo1
Graham a écrit :
I get the same values for daily-weekly timeframe and straight weekly
The
code is expandlast so the relevant values for the week are the
Friday at the
end of that week, and the dots continue until the
following Thursday when
this weeks values are changed.
If you make it expanfirst for the chart you
should get things matching
as the valu for that whole week are displayed
from the beginning of
that week
--
Cheers
Graham
AB-Write >< Professional
AFL Writing Service
Yes, I write AFL code to your
requirements
http://e-wire.net.au/~eb_kavan/ab_write.htm
On
1/7/06, Evo1 <Evo1@xxxxxxxxxxx> wrote:
Hi Graham,
I replace AVG with (H+L+C)/3 but the results are still
wrong...
Do you have the same issue ?
Tia
Regards,
Evo1
Graham a écrit
:
Evo I have run a test myself and agree that the actual weekly and
timeframe inweekly are giving different results, not just more weeks
showing
crossed but totally different values of the indicator for the
same period
I
did a test and found that the value of Avg is not correct for your
use.
replace it with calculated value and the dots line up, at least
as far as
using expandlast allows
myavg = (H+L+C)/3;
Va2 =
((BBandTop(myAvg,20,2)-BBandBot(myAvg,20,2))/MA(myAvg,20))*100;
I
suggest you advise AAB support of this discrepancy in calculation of
Avg
--
Cheers
Graham
AB-Write >< Professional AFL Writing Service
Yes, I
write AFL code to your
requirements
http://e-wire.net.au/~eb_kavan/ab_write.htm
On
1/6/06, Evo1 <Evo1@xxxxxxxxxxx> wrote:
Hi Steve,
1) I want to display on a daily chart the lowest level of the
weekly
bandwidth (over 120 periods). On the weekly chart, it corresponds to
the
green candle (see screenshot below)
Its code is :
BwiH = ( (BBandTop(
Avg, 20 ,2 )- BBandBot( Avg, 20 , 2 )) / MA( Avg, 20 )
)*100 ;
LLVBwiH =
Ref( LLV( BwiH, 120) ,-1 ) ;
Lowestlevel = BwiH < LLVBwiH ;
2) In order to
check the sync on the daily chart, I use the following code :
TimeFrameSet(
inWeekly );
BwiH = ( (BBandTop( Avg, 20 ,2 )- BBandBot( Avg, 20 , 2 )) / MA(
Avg, 20 )
)*100;
LLVBwiH = Ref(LLV(BwiH, 120),-1) ;
NivH = BwiH <
LLVBwiH;
TimeFrameRestore();
NivH = TimeFrameExpand( NivH , inWeekly );
In
the screenshot, you can clearly see that the result is false : the
green
arrows (daily chart) are not in sync with the green candle (weekly
chart).
You can check it by yourself : in my example, I used Tektronix,
ticker TEK,
market SP 500.
Thanks for your valuable
help
Regards,
Evo1
Steve Dugas a écrit :
Sorry Evo, guess I
misunderstood...
Looks like your trouble may be use of Ref() function? I
think it will shift
the array by one bar in both timeframes, removing a
week's worth of data in
one case but only a day's worth in the other,
causing loss of sync. You
could try using Ref( ...,-5 ), but then there are
the 4-day weeks... Or
you could try expanding the weekly bars before
operating on them.... What
exactly are you looking to do?
Steve
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 other support material please check
also:
http://www.amibroker.com/support.html
________________________________
YAHOO!
GROUPS LINKS
Visit your group "amibroker" on the web.
To unsubscribe
from this group, send an email to:
amibroker-unsubscribe@xxxxxxxxxxxxxxx
Your use of Yahoo!
Groups is subject to the Yahoo! Terms of Service.
To unsubscribe from this
group, send an email to:
amibroker-unsubscribe@xxxxxxxxxxxxxxx
Your use of Yahoo!
Groups is subject to the Yahoo! Terms of Service.
Your use of Yahoo! Groups
is subject to the Yahoo! Terms of
Service.
________________________________
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
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 other support material please check
also:
http://www.amibroker.com/support.html
SPONSORED
LINKS
Investment management software Real estate investment software
Investment property software
Software support Real estate investment
analysis software Investment
software
________________________________
YAHOO! GROUPS LINKS
Visit your group "amibroker" on the web.
To unsubscribe from this group,
send an email to:
amibroker-unsubscribe@xxxxxxxxxxxxxxx
Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
To
unsubscribe from this group, send an email to:
amibroker-unsubscribe@xxxxxxxxxxxxxxx
Your use of Yahoo!
Groups is subject to the Yahoo! Terms of Service.
Your use of Yahoo! Groups
is subject to the Yahoo! Terms of
Service.
________________________________
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 other support material please check
also:
http://www.amibroker.com/support.html
Yahoo!
Groups Links
amibroker-unsubscribe@xxxxxxxxxxxxxxx
http://docs.yahoo.com/info/terms/
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 other support material please check also:
http://www.amibroker.com/support.html
________________________________
YAHOO! GROUPS LINKS
Visit your group "amibroker" on the web.
To unsubscribe from this group, send an email to:
amibroker-unsubscribe@xxxxxxxxxxxxxxx
Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
To unsubscribe from this group, send an email to:
amibroker-unsubscribe@xxxxxxxxxxxxxxx
Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
________________________________
------------------------ Yahoo! Groups Sponsor --------------------~-->
Try Online Currency Trading with GFT. Free 50K Demo. Trade
24 Hours. Commission-Free.
http://us.click.yahoo.com/RvFikB/9M2KAA/U1CZAA/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 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/
<*> 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/