Hello, I was wondering if anyone here could help me with some simple coding in Visual Basic.net.
I would like to get the formulation of Larry Williams A/D indicator in VB.net.
Right below I will give you a description of what the indicator is and will also include the code for Amibroker.
If some one could please get this translated to VB.net or preferebly RealCode I would greatly appreciate it.
Thanks
----------------------------------------------------------
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.";
I would like to get the formulation of Larry Williams A/D indicator in VB.net.
Right below I will give you a description of what the indicator is and will also include the code for Amibroker.
If some one could please get this translated to VB.net or preferebly RealCode I would greatly appreciate it.
Thanks
----------------------------------------------------------
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.";