Hi Barry, Thanks for your help and the explanation. I do not code much so it was a not easy for me to put it all together. I was wondering how to code the cumulative bit and not knowing there was a "cum" function. Stupid me. I greatly appreciate your help.
John S ----- Original Message ---- From: Barry Scarborough <[EMAIL PROTECTED]> To: [email protected] Sent: Tuesday, 10 July, 2007 12:31:02 AM Subject: [amibroker] Re: Larry Williams A/D indicator I din't have it but the coding of this indicator would not be hard. This is the formula for it: To calculate the Williams' Accumulation/ Distribution indicator, determine: True Range High (TRH) = Yesterday's close or today's high whichever is greater True Range Low (TRL) = Yesterday's close or today's low whichever is less The day's accumulation/ distribution is then calculated by comparing today's closing price to yesterday's closing price. If today's close is greater than yesterday's close: Today's A/D = today's close - TRL If today's close is less than yesterday's close: Today's A/D = today's close - TRH If today's close is the same as yesterday's close then the A/D is zero. The Williams' Accumulation/ Distribution indicator is a cumulative total of the daily values: Williams A/D = Today's A/D + Yesterday's Williams A/D Thus, the Williams' Accumulation/ Distribution indicator is used to determine if the Forex market is controlled by buyers (accumulation) or by sellers (distribution) ; and trading when there is divergence between price and the A/D indicator. The Williams A/D indicator recommends buying when prices fall to a new low, yet the A/D indicator fails to reach a new low. Likewise, sell when the price makes a new high and the indicator fails to follow suit. The code follows: Barry // Larry Williams' Accumulation/ Distribution indicator /*To calculate the Williams' Accumulation/ Distribution indicator, determine: True Range High (TRH) = Yesterday's Close OR today's High whichever is greater True Range Low (TRL) = Yesterday's Close OR today's Low whichever is less The Day's accumulation/ distribution is then calculated by comparing today's closing price to yesterday's closing price. if today's Close is greater than yesterday's Close: Today's A/D = today's Close - TRL if today's Close is less than yesterday's Close: Today's A/D = today's Close - TRH if today's Close is the same as yesterday's Close then the A/D is zero. The Williams' Accumulation/ Distribution indicator is a cumulative total of the daily values: Williams A/D = Today's A/D + Yesterday's Williams A/D */ TRH = IIf(Ref(C, -1) > H, Ref(C, -1), H); TRL = IIf(Ref(C, -1) < L, Ref(C, -1), L); ad = IIf(C > Ref(C, -1), C - TRL, IIf(C < Ref(C, -1), C - TRH, 0)); WAD = Cum(ad); Plot(WAD, "Williams AD", colorBlue); Plot(ad, "AD daily", colorRed, styleOwnScale | styleNoLine | styleNoLabel ); AddColumn(ad, "AD"); AddColumn(wad, "WAD"); Buy = Sell = C; Filter = Buy OR Sell; "Williams' Accumulation/ Distribution indicator is used to determine if the Forex market is controlled by buyers (accumulation) OR by sellers (distribution) . \n\nTrade when there is Divergence between price AND the A/D indicator.\n\ nThe Williams A/D indicator recommends buying when prices fall to a new Low, yet the A/D indicator fails to reach a new Low. \n\nLikewise, Sell when the price makes a new High AND the indicator fails to follow suit."; --- In [EMAIL PROTECTED] ps.com, "johnsyska" <[EMAIL PROTECTED] ..> wrote: > > Hi All, > I need your help. Has anybody coded or could share with me the Larry > Williams' Accumulation and Distribution Indicator? I know that > standard A/D for AB is very simmilar but I would like to experiment > with the other one. Thank you in advance. > > John S > ____________________________________________________________________________________ Yahoo!7 Mail has just got even bigger and better with unlimited storage on all webmail accounts. http://au.docs.yahoo.com/mail/unlimitedstorage.html
