Rank: Advanced Member
Groups: Registered, Registered Users, Subscribers Joined: 3/7/2005(UTC) Posts: 1,346
|
wmadani had an excellent question the other day involing calculating the number of securities that closed above a moving average....
thank goodness roy answered first cause his hightech code sure makes my lowtech method look like a joke ....
a few sites offer those types of sums, such as stockcharts.com, but it's nice to be able to plot them in metastock on our own..... roy's method makes quick work of it....
have you ever wanted to plot put/call ratios, put call volumes or something similar.... if you can locate your 'want to plot' items data in either text or excel, its a simple matter to load that into meta..... don't worry if the data is not true open/high/low/close data..... meta doesn't care...... use the downloader to create a new security and paste in the data.... use the security data function to plot the data....
every now and then we might have a need to find something within a bars since period.... such as 52 week new highs or lows..... of course the explorer can find'em..... a quick way to limit the period is by using the data loading option and load only 52 weeks worth.... only takes a second to change the time to 1 month.... just change the data loading amount appropriately......h
[code:1:0b583d54ae]type:=Input("calls, puts, total, put/call ratio, ",1,4,4);
pds:=Input("moving average periods",2,50,5);
plot:=
If(type=1,Security("C:\\MetaStock Data\\dow 30\\pcr",O),
If(type=2,Security("C:\\MetaStock Data\\dow 30\\pcr",H),
If(type=3,Security("C:\\MetaStock Data\\dow 30\\pcr",L),
If(type=4,Security("C:\\MetaStock Data\\dow 30\\pcr",C),
Security("C:\\MetaStock Data\\dow 30\\pcr",C)))));
Mov(plot,pds,S);
plot[/code:1:0b583d54ae]
example of roys reset for all 6 columns at once
[code:1:0b583d54ae]A:=ExtFml("GV.SetVar","CountA",0);
Sin(Cum(5)); {forces visible plot}
A:=ExtFml("GV.SetVar","Countb",0);
Sin(Cum(5)); {forces visible plot}
A:=ExtFml("GV.SetVar","Countc",0);
Sin(Cum(5)); {forces visible plot}
A:=ExtFml("GV.SetVar","Countd",0);
Sin(Cum(5)); {forces visible plot}
A:=ExtFml("GV.SetVar","Counte",0);
Sin(Cum(5)); {forces visible plot}
A:=ExtFml("GV.SetVar","Countf",0);
Sin(Cum(5)); {forces visible plot}[/code:1:0b583d54ae]
|