Yes it can but... you should move ATR call OUTSIDE of the loop
and use array subscript to get value at given bar
myatr = ATR( ATR_Period ) ; // call this once OUTSIDE the loop
for( ....
{
...
{
THigh=Max(High[i], THigh);
ATRStop=THigh-ATR_Multiplier* myatr[ i ]; // use VARIABLE here instead of ATR
...}
Best regards,
Tomasz Janeczko
amibroker.com
----- Original Message -----
From: "PKJR" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Monday, August 14, 2006 8:29 PM
Subject: [amibroker] ATR function & loops
> Can ATR function be used within loops?
>
>
> if (PriceAtBuy>0)
> {
> THigh=Max(High[i], THigh);
> ATRStop=THigh-ATR_Multiplier* ATR(ATR_Period));
>
> }
>
> tks/Paul
>
>
> 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
>
>
>
>
>
>
>
>
>
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:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/