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

Re: [amibroker] simple code question



PureBytes Links

Trading Reference Links

You can just use this:

Chg = Close - Ref( Close, -1 );

It is usually easier to just let AB process the whole array at once - see 
"Understanding how AFL works" in the helpsection for more info.

Steve

----- Original Message ----- 
From: "traderkirk7" <traderkirk@xxxxxxxxxxx>
To: <amibroker@xxxxxxxxxxxxxxx>
Sent: Friday, June 10, 2005 6: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
>
>
>
>
>
>
> 




------------------------ Yahoo! Groups Sponsor --------------------~--> 
In low income neighborhoods, 84% do not own computers.
At Network for Good, help bridge the Digital Divide!
http://us.click.yahoo.com/EpW3eD/3MnJAA/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 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/