PureBytes Links
Trading Reference Links
|
i see the difference between the code. i am trying to plot a border
around the weekly histo that you have coded, it only does it for the
last 2 bars. am i missing something here.
here is a screenshot.
http://screencast.com/t/oXJbAruyUQP
the code that i have used is adding 2 extra lines to differentiate
the color and plot the line. here is the one giving me trouble
Plot(TimeFrameExpand( weekhist, inWeekly, expandPoint ), "",
colorBlack, styleNoTitle|styleLine | styleThick | styleNoLabel );
the entire code is below for reference.
_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;
plotColor=IIf(weekhist > 0,colorGreen,colorRed);
TimeFrameRestore();
Plot( TimeFrameExpand( weekmacd, inWeekly ), "MACD", colorRed );
Plot( TimeFrameExpand( weeksig, inWeekly ), "Signal", colorBlue );
Plot( TimeFrameExpand( weekhist, inWeekly, expandPoint ), "Hist",
TimeFrameExpand( plotColor, inWeekly, expandPoint ),styleHistogram );
Plot(TimeFrameExpand( weekhist, inWeekly, expandPoint ), "",
colorBlack, styleNoTitle|styleLine | styleThick | styleNoLabel );
PlotGrid(0, colorBlack);
if( ParamToggle("Custom Title", "No|Yes", 0 ) ) // custom title
{
Title = Name() + " " + intname + " " + Date() + " MACD" +
_PARAM_VALUES();
}
_SECTION_END();
--- In amibroker@xxxxxxxxxxxxxxx, "Tomasz Janeczko" <groups@xxx>
wrote:
>
> > no. when you use timeframe set you dont need to do any expansion
at
> > all.
>
> Yes you do. See my other reply with the code.
>
> > why the title does not use the timeframeset timeframe is
something
> > that i cannot for life of me understand.
>
> Title variable has STRING type (so it has no "interval" concept).
> On the other hand Interval(2) would return name of selected
timeframe
> provided it is used INSIDE timeframeset block.
>
> You did not do that in your code. Again, see my other response for
> code how to do that properly
>
> http://finance.groups.yahoo.com/group/amibroker/message/129476
> http://finance.groups.yahoo.com/group/amibroker/message/129477
>
> Best regards,
> Tomasz Janeczko
> amibroker.com
> ----- Original Message -----
> From: "murthysuresh" <money@xxx>
> To: <amibroker@xxxxxxxxxxxxxxx>
> Sent: Monday, September 08, 2008 3:59 PM
> Subject: [amibroker] Re: stramge challenge with timeframes.
>
>
> > no. when you use timeframe set you dont need to do any expansion
at
> > all.
> > <quote documentation.>
> > Once you switch the time frame using TimeFrameSet , all AFL
functions
> > operate on this time frame until you switch back the time frame
to
> > original interval using TimeFrameRestore or set to different
interval
> > again using TimeFrameSet. It is good idea to ALWAYS call
> > TimeFrameRestore when you are done with processing in other time
> > frames.
> >
> > When time frame is switched to other than original interval the
> > results of all functions called since TimeFrameSet are time-
> > compressed too. If you want to display them in original time
frame
> > you would need to 'expand' them as described later. Variables
created
> > and assigned before call to TimeFrameSet() remain in the time
frame
> > they were created. This behaviour allows mixing unlimited
different
> > time frames in single formula.
> >
> > </quote>
> > why the title does not use the timeframeset timeframe is
something
> > that i cannot for life of me understand.
> >
> > --- In amibroker@xxxxxxxxxxxxxxx, "Ara Kaloustian" <ara1@> wrote:
> >>
> >> I think you need to use TimeFrameExpand(), to expand the
compressed
> > weekly
> >> data, before you can plot weekly data (or any longer time
frame)
> > onto a
> >> chart.
> >>
> >> Also about the title, you have a daily chart, so your data base
and
> > dates
> >> will be daily values.
> >>
> >> ----- Original Message -----
> >> From: "murthysuresh" <money@>
> >> To: <amibroker@xxxxxxxxxxxxxxx>
> >> Sent: Sunday, September 07, 2008 5:11 PM
> >> Subject: [amibroker] Re: stramge challenge with timeframes.
> >>
> >>
> >> > 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/
|