Experiments in Technical Analysis

Hi,

I have one problem in coding the larry williams's A/D flow line. If some expert can help me.

Basic equiation to find daily A/D value is this "(close-open/high-low)*volume".

Now if today's close > open then today'sadd daily A/D value to yeasterday's value and if close < open then substruct today's A/D value with yeasterday's value.

Upto this point I am able to code in metastock.

But problem is that this flow line has base starting figure of 5000 (suggested by larry williams) and then add or substruct daily A/D value to it. this is what I am not able to do???

Now any one can help me in coding for metastock.


One more thing Larry williams suggested to find divergence between security and index for stock selection. How to find this in metastock and If any one has used this method then please tell the result or experince of it.


Thanks,
Ashvin


Thanks Karthik, for the info.

I know a bit about the Chaikin MFI & Williams A/D. The latter builds upon the OBV (On Balance Volume) but i haven't found it any more useful than than the OBV which has a simpler construction.

As for the Elder Ray indicator i have no idea & will have to look up.

Actually, the failure of some MA crossovers is what makes me feel the need of an indicator which could indicate the strenth, the power of the move. The higher the strength the less the chances of failure. By applying the same to a MA differential we can gauge the strength of the crossover (even an impending crossover).

I want it to be as direct, as forthright as possible (hence the stress on the absolute). Not subtle clues like divergences etc. but a direct answer to whether the strength is there or not.

Off course, indicators of such 'direct' category tend to have sharp edges & zigzags. But even if the power is there for a short period after our entry and we mange to reap a small profit up & above our transaction costs, the move cannot said to have been failed.

But lemme first see what's already available.

Thanks Again.

Regards,
Kalyan.
 

asnavale

Well-Known Member
Hi,

I have one problem in coding the larry williams's A/D flow line. If some expert can help me.

Basic equiation to find daily A/D value is this "(close-open/high-low)*volume".

Now if today's close > open then today'sadd daily A/D value to yeasterday's value and if close < open then substruct today's A/D value with yeasterday's value.

Upto this point I am able to code in metastock.

But problem is that this flow line has base starting figure of 5000 (suggested by larry williams) and then add or substruct daily A/D value to it. this is what I am not able to do???

Now any one can help me in coding for metastock.


One more thing Larry williams suggested to find divergence between security and index for stock selection. How to find this in metastock and If any one has used this method then please tell the result or experince of it.


Thanks,
Ashvin

Hi Ashvin,

It is not necessary to add 5000 or any other number. Larry Williams suggested it because the value you get is a ratio which is initially small. In order to make it easier to plot it is suggested that you add a some number as a base. As you go on calculating the values daily and add you will find that the number becomes huge especially with stocks trading daily in several lakhs.

The A/D formula is not that simple. What happens if the stock hits upper or lower circuit right from opening. The denominator (High-Low) becomes zero and the net value is infinity. You have to take care of all such situations and modify the calculation accordingly.

When traded volumes are huge (several lakhs) it is necessary to reduce them to manageable levels by dividing with a sufficiently large factor.

As you are coding in Metastock I can not suggest how to do it. But I have coded the formula in AmiBroker AFL. If you can translate it into MS you can try. I will post the formula if you are interested.

The divergence between price and A/D line has to be ascertained by visually inspecting the charts. It easier to do visually. Not by writing a program.


Regards

-Anant
 
Hi Anant,

Thanks for your advice, I Think you post the formual for amibroker, I will try to convert it for MS.

Actually I want to make explorer(scanner) which scan for probable of stocks which are having divergence between price and indicator.

Have you used A/D flow line. please share your views on this.

As you know about Larry william's A/D flow line, You must know about the stock selection method he has suggested by checking divergence between stock and index. Have you tried it?? If yes how to do this and what about the result of this stock selction method.

Thanks,

Ashvin




Hi Ashvin,

It is not necessary to add 5000 or any other number. Larry Williams suggested it because the value you get is a ratio which is initially small. In order to make it easier to plot it is suggested that you add a some number as a base. As you go on calculating the values daily and add you will find that the number becomes huge especially with stocks trading daily in several lakhs.

The A/D formula is not that simple. What happens if the stock hits upper or lower circuit right from opening. The denominator (High-Low) becomes zero and the net value is infinity. You have to take care of all such situations and modify the calculation accordingly.

When traded volumes are huge (several lakhs) it is necessary to reduce them to manageable levels by dividing with a sufficiently large factor.

As you are coding in Metastock I can not suggest how to do it. But I have coded the formula in AmiBroker AFL. If you can translate it into MS you can try. I will post the formula if you are interested.

The divergence between price and A/D line has to be ascertained by visually inspecting the charts. It easier to do visually. Not by writing a program.


Regards

-Anant
 

rkgoyal_98

Well-Known Member
Dear Karthi

Hi,

Waiting for further update on Trading with MACD. What a good approach for us (New Comer in TA). I have one sugestion that kindly start a seperate thread so that we need not flip many posts. I have made PDF for the material from what ever u have posted till now I will uplad on my 4 shared once u have completed the discussion

Need your help

The AFL you have included in the discusion kindly give steps how to use it. ( Note I now nothing about AFL's yet)

Thanks

Rajeev
 

kkseal

Well-Known Member
...(here perhaps dividing by day's volume would provide a more appropriate factor - but one will have to make sure it doesn't distort the indicator itself!)

Yes it probably will. (Elder's indicator wasn't cumulative in nature) Better to stick to the fixed factor method (a factor of 5k or 10k?)

Here btw is some MS code i found on this indicator :-


Williams' Accumulation/Distribution

TrueRangeHigh:=Max( Ref(CLOSE,-1), HIGH );
TrueRangeLow:=Min( Ref(CLOSE,-1), LOW );
Cum(If(C > Ref(C,-1),C-TrueRangeLow, If(C < Ref(C,-1),C-TrueRangeHigh,0)))

The above is for Price based (only) A/D. For volume weighted the last line will probably change to

Cum(If(C > Ref(C,-1),(C-TrueRangeLow)*volume, If(C < Ref(C,-1),(C-TrueRangeHigh)*volume,0)))

And to reduce it by a fixed factor of 5k
Cum(If(C > Ref(C,-1),(C-TrueRangeLow)*volume/5000, If(C < Ref(C,-1),(C-TrueRangeHigh)*volume/5000,0)))

I've preferred to make the reduction at the A/D calculation stage itself rather than after the cumulation. (Please pardon any syntax errors as i'm no too familiar with FLs)

Regards,
Kalyan.
 
Last edited:
Hello,

Try this AFL for absolute strength. You can incorporate volume easily.


/*Developed by Tudor Marcelin - Art Invest*/

n=Optimize("period",10,1,100,1);/*period*/

A=0;
M=0;
D=0;

for( i = 0; i < n; i=i+1 )
{

A=IIf(Ref(Close, - i)>Ref(Close, - i-1), A+(Ref(Close, - i)/Ref(Close, -
i-1))-1,A);

M=IIf(Ref(Close, - i)==Ref(Close, - i-1), M+1/n,M);

D=IIf(Ref(Close, - i)<Ref(Close, - i-1), D+(Ref(Close, - i-1)/Ref(Close, -
i))-1,D);

}
ASI=IIf (D+M/2==0, 100, 100-100/(1+(A+M/2)/(D+M/2)));


Plot(ASI,"ASI10",colorDarkBlue);

Plot(50,"",colorBlack,styleLine);
Plot(70,"",colorRed,styleLine);
Plot(30,"",colorGreen,styleLine);

GraphXSpace = 3;

Regards
Saji
 

kkseal

Well-Known Member
Hello,

Try this AFL for absolute strength. You can incorporate volume easily.


/*Developed by Tudor Marcelin - Art Invest*/

n=Optimize("period",10,1,100,1);/*period*/

A=0;
M=0;
D=0;

for( i = 0; i < n; i=i+1 )
{

A=IIf(Ref(Close, - i)>Ref(Close, - i-1), A+(Ref(Close, - i)/Ref(Close, -
i-1))-1,A);

M=IIf(Ref(Close, - i)==Ref(Close, - i-1), M+1/n,M);

D=IIf(Ref(Close, - i)<Ref(Close, - i-1), D+(Ref(Close, - i-1)/Ref(Close, -
i))-1,D);

}
ASI=IIf (D+M/2==0, 100, 100-100/(1+(A+M/2)/(D+M/2)));


Plot(ASI,"ASI10",colorDarkBlue);

Plot(50,"",colorBlack,styleLine);
Plot(70,"",colorRed,styleLine);
Plot(30,"",colorGreen,styleLine);

GraphXSpace = 3;

Regards
Saji
I have come across that on the net but no explaination of the concept & construction. Will have to decipher the logic first.

Regards,
Kalyan.
 

Similar threads