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

[amibroker] Weird behavior



PureBytes Links

Trading Reference Links

Hello,

i just set up a code for two exponential moving averages by using loop
function. I want to find out where these two EMA´s (15 and 150 days of
length) intersect:

ExpLag150[0]=Close[0]; 
ExpLag15[0]=Close[0];

for( i = 1; i < BarCount; i++ ) 

{ ExpLag150[i]=ExpLag150[i-1]+(Close[i]-ExpLag150[i-1])/150;
    ExpLag15[i]=ExpLag15[i-1]+(Close[i]-ExpLag15[i-1])/15;
} 


Plot(ExpLag150, "My expon. Lag 150", colorGreen, styleLine);
Plot(ExpLag15, "My expon. Lag 15", colorRed, styleLine);

Plot (Close, "Bar Chart", colorBlue, styleBar);

But when I scroll thru the chart the intersecting points change place
as if AB calculated the two expon. MA´s with each new bar appearing on
the screen anew.

When I use regular MA´s (by using the array-based MA function thru AFL
command), this doesn´t happen - the intersecting point stay always at
the same spot?

Why is that and how can I get rid of this?

Incidentally, i was told that AB retrieves differeing values from an
array-based expon. MA and a loop-based MA as i used it above. This is
why I used the loops...

Thanks many times for clarifying this to a rookie!

Markus


------------------------------------

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/