PureBytes Links
Trading Reference Links
|
You seem to misunderstand the purpose of TimeFrame functions.
They are provided to allow MIXING different timeframes
in single formula. Not for chaning base interval. The base chart interval is determined
by users' choice (View menu), and TimeFrame functions allow to create among other things overlays with different time frames that
are PERFECTLY ALIGNED with base interval. That's the purpose.
To have SYNCHRONIZED chart that can display say 1-minute, 3-minute and 5-minute charts in different/same panes perfectly aligned to
each other.
For that you must EXPAND arrays after using TimeFrameSet.
Here is example how you should do that properly in AFL,
including setting title:
_SECTION_BEGIN("Weekly MACD");
TimeFrameSet( inWeekly );
intname = Interval( 2 );
weekmacd = MACD( sh = Param("Short", 12, 1 ), lg = Param( "Long", 26, 1 ) );
weeksig = Signal( sh, Lg, Param("Signal", 9, 1 ) );
weekhist = weekmacd - weeksig;
TimeFrameRestore();
Plot( TimeFrameExpand( weekmacd, inWeekly ), _DEFAULT_NAME(), colorRed );
Plot( TimeFrameExpand( weeksig, inWeekly ), "Signal", colorBlue );
Plot( TimeFrameExpand( weekhist, inWeekly, expandPoint ), "Hist", colorBlack, styleHistogram );
Title = Name() + " " + intname + " " + Date() + " {{VALUES}}";
_SECTION_END();
Best regards,
Tomasz Janeczko
amibroker.com
----- Original Message -----
From: "murthysuresh" <money@xxxxxxxxxxxxxx>
To: <amibroker@xxxxxxxxxxxxxxx>
Sent: Monday, September 08, 2008 3:00 AM
Subject: [amibroker] Re: stramge challenge with timeframes.
> added comment supporting the suggestion.
>
> --- In amibroker@xxxxxxxxxxxxxxx, Dennis Brown <see3d@xxx> wrote:
>>
>> Suggestion #1117
>>
>> BR,
>> Dennis
>>
>> On Sep 7, 2008, at 8:11 PM, murthysuresh wrote:
>>
>> > correct url
>> > http://screencast.com/t/aB3AreAH9
>> >
>> > --- In amibroker@xxxxxxxxxxxxxxx, "murthysuresh" <money@> wrote:
>> >>
>> >> i have a Daily chart open with prices. i have programatically
>> > plotted
>> >> the weekly macd histo using the following formula. basically
> using
>> >> timeframeset and timeframerestore. pl note i have set the title
>> >> within the timeframe set block.
>> >>
>> >> however the title shows the daily data. the macd chart itself is
>> >> displaying weekly histo. i verified it. how do i trick the system
>> > to
>> >> show the correct bartime based on the actual plot data and in
> this
>> >> case weekly to be displayed.
>> >>
>> >> the screenshot shows the issue
>> >>
> http://www.screencast.com/users/junkone/folders/Jing/media/e8d2c670-
>> >> aac5-4e36-bfe2-98b2f5866aa5
>> >>
>> >>
>> >> if(getIntervalparam != "default"){
>> >>
>> >> TimeFrameSet( IntervaltoUse);
>> >>
>> >> }
>> >> _N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g,
> Hi %
>> >> g, Lo %g, Close %g (%.1f%%) Vol " +WriteVal( V, 1.0 ) +"
>> > {{VALUES}}",
>> >> O, H, L, C) ) ;
>> >>
>> >> //MACD - Moving Average Convergence Divergence v1
>> >> //adapted from code by Tomasz Janeczko
>> >> //ideas by Graham Kavanagh and Terry Magic
>> >> r1 = Param( "Fast avg", 12, 2, 200, 1 );
>> >> r2 = Param( "Slow avg", 26, 2, 200, 1 );
>> >> r3 = Param( "Signal avg", 9, 2, 200, 1 );
>> >> m1 = MACD(r1, r2);
>> >> s1 = Signal(r1,r2,r3);
>> >> difference = m1-s1;
>> >> Plot( m1, StrFormat(_SECTION_NAME()+"(%g,%g)", r1, r2),
> ParamColor
>> >> ("MACD color", colorRed ), ParamStyle("MACD style") );
>> >> Plot( s1, "Signal" + _PARAM_VALUES(), ParamColor("Signal color",
>> >> colorBlue ), ParamStyle("Signal style") );
>> >> Plot( difference,"MACD", colorBlack, styleLine | styleThick);
>> >>
>> >> Color=IIf(difference > 0,colorGreen,colorRed);
>> >> Plot(difference, "MACD Histogram", Color, styleNoTitle |
> ParamStyle
>> >> ("Histogram style", styleHistogram | styleThick | styleNoLabel,
>> >> maskHistogram ) );
>> >> Plot(difference, "", colorBlack, styleNoTitle|styleLine |
>> > styleThick
>> >> | styleNoLabel );
>> >> PlotGrid(0, colorBlack);//, styleNoTitle|styleLine | styleThick
> |
>> >> styleNoLabel );
>> >> width=Status("pxchartwidth" ) ;
>> >> Height=Status("pxchartheight" ) ;
>> >>
>> >> GfxSelectPen( colorRed, 1 );
>> >> GfxSelectSolidBrush( colorCustom1 );
>> >>
>> >> GfxSelectFont("Tahoma",15, 700 );
>> >> GfxSetBkMode(1);
>> >> GfxSetTextColor(colorGreen);
>> >> //GfxTextOut(Name() + " Close " + NumToStr(LastValue(C)) , x,
>> > y) ;
>> >> GfxTextOut( "Current MACD INTERVAL SHOWN" +
> getIntervalparam ,
>> >> width/2, Height/2);
>> >>
>> >>
>> >> if(getIntervalparam != "default"){
>> >>
>> >> TimeFrameRestore() ;
>> >>
>> >
>> >
>> >
>> > ------------------------------------
>> >
>> > 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
>
>
>
------------------------------------
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/
|