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

[amibroker] Re: Help with AFL, calculating two different ATR



PureBytes Links

Trading Reference Links

Use 0 not null, change the atr period to 3. Null seems to have a 
value of - 4 billion, at least that is what I saw when I put the 
cursor on the null part of the chart.

First3=IIF(hour()<10, atr(3),0); // this array holds the atr of the 
first three hours
Restofday=IIF(hour()>=10,atr(3),0); // this array holds the atr of 
rest of the hours
atravg3=ma(First3,30); //calculates the 30 period average of the atr 
obtained during the first three hours
atrmovaveragerR=ma(restofday,30);
plot(First3, "First3", colorblue);
plot(atravg3, "atravg3", colorred);
plot(Restofday, "Restofday", colorgreen);
plot(atrmovaveragerR, "atrmovaveragerR", colorblack);

Barry

--- In amibroker@xxxxxxxxxxxxxxx, "Ara Kaloustian" <ara1@xxx> wrote:
>
> Value = iif(Timenum() <time criteria,MA(x),MA(y));
> 
> ----- Original Message ----- 
> From: "pmxgs" <pmxgs@xxx>
> To: <amibroker@xxxxxxxxxxxxxxx>
> Sent: Thursday, July 24, 2008 9:50 AM
> Subject: [amibroker] Help with AFL, calculating two different ATR
> 
> 
> > Hi,
> > 
> > I'm trying to build two indicators which calculate the 30 period 
MA
> > of the (1)ATR of the first 3 hours of the trading day and then 
the 
> > (2)ATR of the rest of the hours of the trading day.
> > I'm using hourly bars.
> > 
> > 
> > Can I do this without loops?
> > 
> > I was thinking in using something like (assuming market opens at 
7):
> > 
> > 
> > First3=IIF(hour()<10, atr(1),null); // this array holds the atr 
of 
> > the first three hours
> > Restofday=IIF(hour()>=10,atr(1),null); // this array holds the 
atr 
> > of rest of the hours
> > 
> > atravg3=ma(firsttwoh,30); //calculates the 30 period average of 
the 
> > atr obtained during the first three hours
> > atrmovaveragerR=ma(restofday,30);
> > 
> > The problem with this approach is that the first3 array is filled 
> > with numbers (atr) when I'm at the first three hours of the 
trading 
> > day, and nulls after that.
> > Then the moving average will be calculated on both the numbers 
and 
> > the nulls.
> > Is there any way to change this, so that the average uses only 
the 
> > number, and discards the nulls.
> > 
> > thanks very much
> > 
> > 
> > 
> > ------------------------------------
> > 
> > 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/