Should work, but you are missing all the [subscript] values. EVERYTHING
that is ARRAY inside loop must be referred to as ATRStop[i] or Thigh[i],
etc. 

Further, I assume your ENTIRE if code is, in fact, inside a loop?
Also you have extraneous ) in your code.

I would also move the ATR outside the loop like this:

myATR = ATR(ATR_Period);

for (i = 1; i < barCount; i++)
{
//other code...
    if (PriceAtBuy[i] > 0)
    {
        THigh[i] = Max(High[i], THigh[i];
        ATRStop[i] = THigh[i] - ATR_Multiplier * myATR[i];
    }
}
--
Terry
-----Original Message-----
From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of PKJR
Sent: Monday, August 14, 2006 12:30
To: [email protected]
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/
 



Reply via email to