Hi friends,
My problem was to plot, in an intraday chart (or daily chart), indicators with upper periodicities.
I know that there are indicators to plot Close, but I dind't find anything to plot something more complicated like Bollinger Band or other users indicators.
If you have time, have a look at the 4 indicators below.
They give the opportunity to plot Open, High, Low and Close in any Periodicity you want (greater than the periodicity basis, of course).
First, you have to install the Alchan78.dll in your directory :"D:\Program Files\Equis\MetaStock\External Function DLLs" and restart Metastock.
You can choose between Intraday (from 1 to 60 minutes), Daily, Monthly (from 1 to 12) and Yearly.
---------8<-------------------
{_Reduct_O_combo}
{ **>> _fredcom_ <<** 21fev07 }
{necessite Alchan78.dll}
{http://perso.club-internet.fr/jsallin/Alchan78/Alchan78.zip}
periodicity:=Input("0=Minute; 1=Day; 2=Week; 3=Month; 4=Year",0,5,1);
nb:=Input("nb Minutes or Month, if appropriate ",1,60,1);
intervI:=Ceiling((Minute()+Hour()*60)/nb);
intervM:=ceiling(month()/nb);
keep:=If(periodicity=0,intervI<>ref(intervI,-1) OR DayOfMonth()<>Ref(DayOfMonth(),-1),0);
keep:=If(periodicity=1,DayOfMonth()<>Ref(DayOfMonth(),-1),keep);
keep:=If(periodicity=2,DayOfWeek()<Ref(DayOfWeek(),-1),keep);
keep:=if(periodicity=3,intervM<>ref(intervM,-1),keep);
keep:=If(periodicity=4,Year()<>Ref(Year(),-1),keep);
keep2:=Cum(1)>=LastValue(Cum(1)) ;
Vcomp:=ExtFml( "Alchan78.Select",keep , O);
vcomp
---------8<-------------------
{_Reduct_H_combo}
{ **>> _fredcom_ <<** 21fev07}
{necessite Alchan78.dll}
{http://perso.club-internet.fr/jsallin/Alchan78/Alchan78.zip}
periodicity:=Input("0=Minute; 1=Day; 2=Week; 3=Month; 4=Year",0,5,1);
nb:=Input("nb Minutes or Month, if appropriate ",1,600,1);
intervI:=Ceiling((Minute()+Hour()*60)/nb);
intervM:=Ceiling(Month()/nb);
keep:=If(periodicity=0,intervI<>Ref(intervI,-1) OR DayOfMonth()<>Ref(DayOfMonth(),-1),0);
keep:=If(periodicity=1,DayOfMonth()<>Ref(DayOfMonth(),-1),keep);
keep:=If(periodicity=2,DayOfWeek()<Ref(DayOfWeek(),-1),keep);
keep:=If(periodicity=3,intervM<>Ref(intervM,-1),keep);
keep:=If(periodicity=4,Year()<>Ref(Year(),-1),keep);
keep2:=Cum(1)>=LastValue(Cum(1)) ;
Vcomp:=ExtFml( "Alchan78.Select",keep , Ref(HighestSince(1,keep,H),-1));
vcomp:=Ref(vcomp,1);
vcomp:=ExtFml( "Alchan78.Select",1 , If(keep2,0,vcomp));
vcomp:=If(keep2,vcomp+HighestSince(1,keep,H),vcomp);
vcomp
---------8<-------------------
{_Reduct_L_combo}
{ **>> _fredcom_ <<** 21fev07}
{necessite Alchan78.dll}
{http://perso.club-internet.fr/jsallin/Alchan78/Alchan78.zip}
periodicity:=Input("0=Minute; 1=Day; 2=Week; 3=Month; 4=Year",0,5,1);
nb:=Input("nb Minutes or Month, if appropriate ",1,600,1);
intervI:=Ceiling((Minute()+Hour()*60)/nb);
intervM:=Ceiling(Month()/nb);
keep:=If(periodicity=0,intervI<>Ref(intervI,-1) OR DayOfMonth()<>Ref(DayOfMonth(),-1),0);
keep:=If(periodicity=1,DayOfMonth()<>Ref(DayOfMonth(),-1),keep);
keep:=If(periodicity=2,DayOfWeek()<Ref(DayOfWeek(),-1),keep);
keep:=If(periodicity=3,intervM<>Ref(intervM,-1),keep);
keep:=If(periodicity=4,Year()<>Ref(Year(),-1),keep);
keep2:=Cum(1)>=LastValue(Cum(1)) ;
Vcomp:=ExtFml( "Alchan78.Select",keep , Ref(LowestSince(1,keep,L),-1));
vcomp:=Ref(vcomp,1);
vcomp:=ExtFml( "Alchan78.Select",1 , If(keep2,0,vcomp));
vcomp:=If(keep2,vcomp+LowestSince(1,keep,L),vcomp);
vcomp
---------8<-------------------
{_Reduct_C_combo}
{ **>> _fredcom_ <<** 21fev07}
{necessite Alchan78.dll}
{http://perso.club-internet.fr/jsallin/Alchan78/Alchan78.zip}
periodicity:=Input("0=Minute; 1=Day; 2=Week; 3=Month; 4=Year",0,5,1);
nb:=Input("nb Minutes or Month, if appropriate ",1,600,1);
intervI:=Ceiling((Minute()+Hour()*60)/nb);
intervM:=ceiling(month()/nb);
keep:=If(periodicity=0,intervI<>ref(intervI,-1) OR DayOfMonth()<>Ref(DayOfMonth(),-1),0);
keep:=If(periodicity=1,DayOfMonth()<>Ref(DayOfMonth(),-1),keep);
keep:=If(periodicity=2,DayOfWeek()<Ref(DayOfWeek(),-1),keep);
keep:=if(periodicity=3,intervM<>ref(intervM,-1),keep);
keep:=If(periodicity=4,Year()<>Ref(Year(),-1),keep);
keep2:=Cum(1)>=LastValue(Cum(1)) ;
Vcomp:=ExtFml( "Alchan78.Select",keep , Ref(C,-1));
vcomp:=Ref(vcomp,1);
vcomp:=ExtFml( "Alchan78.Select",1 , If(keep2,0,vcomp));
vcomp:=If(keep2,vcomp+C,vcomp);
vcomp
---------8<-------------------
For example, if I want to plot, on a 1minute basis, the 60minutes Close with the 20 periods moving average and the Bollinger bands (20 periods,2 deviations), I create the dediate indicators :
{_Reduct_C60}
{ **>> _fredcom_ <<** 21fev07}
{necessite Alchan78.dll}
{http://perso.club-internet.fr/jsallin/Alchan78/Alchan78.zip}
nb:=60;
intervI:=Ceiling((Minute()+Hour()*60)/nb);
keep:=intervI<>Ref(intervI,-1) OR DayOfMonth()<>Ref(DayOfMonth(),-1);
keep2:=Cum(1)>=LastValue(Cum(1)) ;
Vcomp:=ExtFml( "Alchan78.Select",keep , Ref(C,-1));
vcomp:=Ref(vcomp,1);
vcomp:=ExtFml( "Alchan78.Select",1 , If(keep2,0,vcomp));
vcomp:=If(keep2,vcomp+C,vcomp);
C60:=vcomp;
C60;
Mov(C60,20,S);
BBandTop(C60, 20,S, 2) ;
BBandBot(C60, 20,S, 2) ;
On the next photo, you could see on the left a chart in a 60minutes basis with, on the upper window the close & mov(c,20,s) & Bollband(c,20,2).
On the right, the chart in a 1 minute basis with on the upper window the C60 Close & mov(C60,20,s) & BollBand(C60,20,s).
Of course, it's usable in the Explorer.