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

RE: [amibroker] ATR function & loops



PureBytes Links

Trading Reference Links

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: amibroker@xxxxxxxxxxxxxxx [mailto:amibroker@xxxxxxxxxxxxxxx] On
Behalf Of PKJR
Sent: Monday, August 14, 2006 12:30
To: amibroker@xxxxxxxxxxxxxxx
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