Rank: Member
Groups: Registered, Registered Users, Subscribers Joined: 11/5/2005(UTC) Posts: 22
|
Hi forum..
I’m trying to create a breadth index using Jose Adp (Extfml("ASI.Stoch"), the problem is how do I create so it goes between 0-100, or any other good ideas to get I work better..
regards
mike :)
{Adaptive Stochastic Breadth Index}
Prds:=40;
LenMin:=5;
LenMax:=25;
v1:=Stdev(C,Prds);
v2:=HHV(v1,Prds);
v3:=LLV(v1,Prds);
v4:=If((v2-v3)>0,(v1-v3)/(v2-v3),0);
currlen:=Int(LenMin+(LenMax-Lenmin)*(1-v4));
ABC:=Security("C:\\MetaStock Data\\MetaStock Data DDE\\stock1",C);
ABD:=Security("C:\\MetaStock Data\\MetaStock Data DDE\\stock2",C);
ABE:=Security("C:\\MetaStock Data\\MetaStock Data DDE\\stock3",C);
ABF:=Security("C:\\MetaStock Data\\MetaStock Data DDE\\stock4",C);
ABG:=Security("C:\\MetaStock Data\\MetaStock Data DDE\\stock5",C);
Sto:=(ABC+ABD+ABE+ABF+ABG/5)+Mov(ExtFml("ASI.Stoch",currlen),5,E);
Sto;
|
|
|
|
Rank: Advanced Member
Groups: Registered, Registered Users Joined: 3/19/2005(UTC) Posts: 2,995
Was thanked: 14 time(s) in 10 post(s)
|
Hey mplwengrud-
This is not pretty, but it might be adaptable. The trouble, as I see it, is not knowing what range the securities will trade in. Well, I'm standing by for flying rocks... :)
[code:1:0e57e8cbd9]upper:=Input("Upper boundary",70,100,100);
lower:=Input("Lower boundary",0,30,0);
factor:=Input("Correction factor",1,10,1)/500;
Prds:=40;
LenMin:=5;
LenMax:=25;
v1:=Stdev(C,Prds);
v2:=HHV(v1,Prds);
v3:=LLV(v1,Prds);
v4:=If((v2-v3)>0,(v1-v3)/(v2-v3),0);
currlen:=Int(LenMin+(LenMax-Lenmin)*(1-v4));
ABC:=Security("C:\\MetaStock Data\\MetaStock Data DDE\\stock1",C);
ABD:=Security("C:\\MetaStock Data\\MetaStock Data DDE\\stock2",C);
ABE:=Security("C:\\MetaStock Data\\MetaStock Data DDE\\stock3",C);
ABF:=Security("C:\\MetaStock Data\\MetaStock Data DDE\\stock4",C);
ABG:=Security("C:\\MetaStock Data\\MetaStock Data DDE\\stock5",C);
Sto:=(ABC+ABD+ABE+ABF+ABG/5)+Mov(ExtFml("ASI.Stoch",currlen),5,E);
plot:=(upper-lower+1)*sto*factor+lower;
plot[/code:1:0e57e8cbd9]
|
|
|
|
Rank: Member
Groups: Registered, Registered Users, Subscribers Joined: 11/5/2005(UTC) Posts: 22
|
Hi Stockman...
I agree with you It isn’t pretty, still the same whit your code :? ...I don’t know if this is really possible.
I’m using a folder with 1min data to create this index and my thoughts was that to add the stocks together and use Stochastic to give a quicker reaction to a normal Stock index. The 5 stocks make the higher turnover and are highest weight in a index...
Regards mike
|
|
|
|
Rank: Advanced Member
Groups: Registered, Registered Users Joined: 1/19/2005(UTC) Posts: 1,065 Location: Koh Pha-Ngan, Earth
Was thanked: 2 time(s) in 2 post(s)
|
|
|
|
|
Rank: Advanced Member
Groups: Registered, Registered Users Joined: 3/19/2005(UTC) Posts: 2,995
Was thanked: 14 time(s) in 10 post(s)
|
There you go... the perfect answer. You've posted that before, I forgot. :oops:
|
|
|
|
Rank: Member
Groups: Registered, Registered Users, Subscribers Joined: 11/5/2005(UTC) Posts: 22
|
Thanks Jose and stockman...
But I am sorry to say that I don’t have the skill to putt the suggestion together, so I hope you can help me out here..
:D
|
|
|
|
Rank: Advanced Member
Groups: Registered, Registered Users Joined: 3/19/2005(UTC) Posts: 2,995
Was thanked: 14 time(s) in 10 post(s)
|
I'm thinking something along this line (original code and concept by Jose Silva):
[code:1:d71d012ba0]pds:=Input("Normalizing lookback periods (1= historical Hi/Lo)",1,2600,126);
Prds:=40;
LenMin:=5;
LenMax:=25;
v1:=Stdev(C,Prds);
v2:=HHV(v1,Prds);
v3:=LLV(v1,Prds);
v4:=If((v2-v3)>0,(v1-v3)/(v2-v3),0);
currlen:=Int(LenMin+(LenMax-Lenmin)*(1-v4));
ABC:=Security("C:\\MetaStock Data\\MetaStock Data DDE\\stock1",C);
ABD:=Security("C:\\MetaStock Data\\MetaStock Data DDE\\stock2",C);
ABE:=Security("C:\\MetaStock Data\\MetaStock Data DDE\\stock3",C);
ABF:=Security("C:\\MetaStock Data\\MetaStock Data DDE\\stock4",C);
ABG:=Security("C:\\MetaStock Data\\MetaStock Data DDE\\stock5",C);
PriceX:=(ABC+ABD+ABE+ABF+ABG/5)+Mov(ExtFml("ASI.Stoch",currlen),5,E);
{ Choose x pds or historical Price High/Low }
Hi:=If(pds>1,HHV(PriceX,pds),Highest(PriceX));
Lo:=If(pds>1,LLV(PriceX,pds),Lowest(PriceX));
{ Price normalized to 0~100% }
PriceNorm:=(PriceX-Lo)/Max(Hi-Lo,.000001)*100;
PriceNorm[/code:1:d71d012ba0]
|
|
|
|
Rank: Member
Groups: Registered, Registered Users, Subscribers Joined: 11/5/2005(UTC) Posts: 22
|
Perfecto Stockman and Jose... :)
It looks very goood, lets see how its works in real action tomorrow....
Many big thanks =D>
mike
|
|
|
|
Users browsing this topic |
Guest (Hidden)
|
Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.