Hi Kirk,
For some reason my reply didn't come back on my email
(tho it is on the website) so rather than waste bandwidth with a test message,
I'll waste it with a fast tweak to the code you asked about. This will
allow you to adjust the period for the comparison, as well as the color and
style of display. Enjoy.
per= Param("Change since X periods", 1,1,21,1);
Chg = C-Ref(C,-per);
Plot (Chg,
"Change over " +
WriteVal(per,2.0) + WriteIf(per==1," period", " periods"), ParamColor("Color"
,colorcycle), ParamStyle("Style",
styleLine, maskHistogram) ) ;
Peace and Justice ---
Patrick
----- Original Message -----
Sent: Friday, June 10, 2005 4:04 PM
Subject: [amibroker] Re: simple code
question
That worked perfectly, thank you! I guess I was just
trying to over- think it.
--- In amibroker@xxxxxxxxxxxxxxx, "CS"
<res1wgwl@x...> wrote: > For most
things, AB is way simpler that other languages out there. > Try (one
line): > > plot(C-ref(C,-1), " Change from Yesterdays Close
",colorred,1); > > -CS > ----- Original Message
----- > From: traderkirk7 > To:
amibroker@xxxxxxxxxxxxxxx > Sent: Friday, June 10, 2005
3:50 PM > Subject: [amibroker] simple code question >
> > I have had Amibroker for awhile now but
continued to use TradeStation > because that is what I
have been used to and it worked for most of > what I
needed. I decided to dust off Amibroker and see what it can
> do but I am having a coding problem. I want to plot
a simple > indicator that measures change. >
> In TS, the formula is a relatively simple: >
> Chg = Close - Close[1]; >
Plot1(Chg); > > In Amibroker what I have is: >
> for( i = 1; i < BarCount; i++ ) >
{ > Chg = Close[ BarCount - 1 ] - Close[ BarCount - 2
]; > } > Plot (Chg, "Change", colorBlue,
styleLine); > > The problem is that the indicator's
value is correct on the last bar > of the chart, but it
plots that same value on every bar preceding it, > so
all that results is a straight line. I tried it with the Plot
> statement inside the For loop but then all I get is a
straight line > with many instances of the same value
(obviously due to the loop). > > I figured I could
work it out from the code for Rate of Change, but >
that is simply coded with the 'ROC' function, and the code for the
> functions are not available to my knowledge. >
> Any help is appreciated, 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 other support material
please check also: > http://www.amibroker.com/support.html >
> > > > >
-------------------------------------------------------------------- ---------- >
Yahoo! Groups Links > > a.. To visit your
group on the web, go to: > http://groups.yahoo.com/group/amibroker/ >
> b.. To unsubscribe from this group, send an
email to: >
amibroker-unsubscribe@xxxxxxxxxxxxxxx >
> c.. 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
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
|