Rank: Advanced Member
Groups: Registered, Registered Users, Subscribers Joined: 7/25/2005(UTC) Posts: 1,042
Was thanked: 57 time(s) in 54 post(s)
|
Hi mc Here are a couple of formulas that might help you. The first is "Multi-Frame ID OHLC", and it's main function is to plot O, H, L & C on the current chart for a higher timeframe. The best way to learn how to use this is to load it into MetaStock and experiment with all the options. In "Dynamic" mode any still-developing prices for the last frame will plot on the last bar. "Static" mode plots new frame prices on the last bar of a completed frame (not possible in all situations), and in "Delayed" mode all results are delayed by one bar. That means that the first bar of a new frame must be present before the prices of the just-completed frame can be plotted. The second formula is based on the first but it has been modified to plot last-bar values of the current (developing) frame for the last 5 frames. With the timeframe set to 1440 minutes you will be able to read off the OPEN, HIGH, LOW and CLOSE for the current day as each new bar develops for whatever periodicity your chart is set to. You will need the 188KB Forum DLL installed in MetaStock before loading either formula into the Indicator Builder. If you already hae this formula under another name, such as ForumDll_200.DLL, you should make a copy of it and name the copy Forum.DLL. A restart of MetaStock will be necessary if the DLL or the name of the copy is new to the "External Function Dlls" folder. The DLL is available in the Files section of this forum. Roy Code:
{Multi-Frame ID OHLC}
{Requires Equis Forum DLL}
{Roy Larsen, 2008-2013, 16/5/13}
{User settings}
N:=Input("Multi-Frame ID OHLC, Half Frame Offset",0,1,0);
J:=Input("Periodicity in Minutes, 1-1440",1,1440,30);
N:=N*J*(Mod(J,2)=0)/2;
Q:=Input("Mode, 0=Static 1=Dynamic 2=Delayed",0,2,0);
{Timing signals}
{Day counter by metastocktools.com}
J:=If((Mod(J,5)=0)*(J<21)+(J=30)+(J<5)+(Mod(J,60)=0)*
((J<241)+(J=480)+((Mod(J,360)=0)*(J<>1080))),J,30);
D:=DayOfMonth();F:=Rnd(Life(291231));
Z:=Cum(1);D:=ValueWhen(1,Z=1,F+D)-F;
D:=D*1440+Minute()+Hour()*60;
I:=Int(If(J=1440,D,D-1)/J);
I:=I>ValueWhen(2,1,I);
G:=LastValue(Lowest(Sum(I>0,9))>7);
I:=ExtFml("Forum.Sum",I,1);M:=(G+I)*(Z>1);
F:=ExtFml("Forum.Sum",Ref(I,1),1)*(M=0)*(Z>1)+G;
B:=LastValue(Z);A:=B-1=Z;B:=B=Z;
J:=If(F,1,(Alert(F,2)=0)*M*2*(Z>1));
J:=If(A+LastValue(J)>2 OR B+(Q=1)=2,1,J);
J:=If(G,1,If(Q=2,M*2,J));
{Frame prices}
Om:=ValueWhen(1,M+(Z=1),O);
Hm:=HighestSince(1,M+(Z=1),H);
Lm:=LowestSince(1,M+(Z=1),L);
Om:=ValueWhen(1,J,If(J=1,Om,ValueWhen(2-G,1,Om)));
Hm:=ValueWhen(1,J,If(J=1,Hm,ValueWhen(2-G,1,Hm)));
Lm:=ValueWhen(1,J,If(J=1,Lm,ValueWhen(2-G,1,Lm)));
K:=ValueWhen(1,J,If(J=1,C,ValueWhen(2-G,1,C)));
Om; Hm; Lm; K;
Code:
{Multi-Frame ID OHLC - Last Value} {Requires Equis Forum DLL} {Roy Larsen, 2013, 16/5/13}
{User settings} N:=Input("Multi-Frame ID OHLC - Last Value",0,0,0); J:=Input("Periodicity in Minutes, 1-1440",1,1440,240); Q:=Input("Mode, 0=Static 1=Dynamic 2=Delayed",0,2,1);
{Timing signals} {Day counter by metastocktools.com} J:=If((Mod(J,5)=0)*(J<21)+(J=30)+(J<5)+(Mod(J,60)=0)* ((J<241)+(J=480)+((Mod(J,360)=0)*(J<>1080))),J,30); D:=DayOfMonth();F:=Rnd(Life(291231)); Z:=Cum(1);D:=ValueWhen(1,Z=1,F+D)-F; D:=D*1440+Minute()+Hour()*60; I:=Int(If(J=1440,D,D-1)/J); I:=I>ValueWhen(2,1,I); G:=LastValue(Lowest(Sum(I>0,9))>7); I:=ExtFml("Forum.Sum",I,1);M:=(G+I)*(Z>0); F:=ExtFml("Forum.Sum",Ref(I,1),1)*(M=0)*(Z>1)+G; B:=LastValue(Z);A:=B-1=Z;B:=B=Z; J:=If(F,1,(Alert(F,2)=0)*M*2*(Z>1)); J:=If(A+LastValue(J)>2 OR B+(Q=1)=2,1,J); J:=If(G,1,If(Q=2,M*2,J));
{Frame prices} Q:=ValueWhen(1,M+(Z=1),O); B:=HighestSince(1,M+(Z=1),H); Y:=LowestSince(1,M+(Z=1),L); Q:=ValueWhen(1,J,If(J=1,Q,ValueWhen(2-G,1,Q))); B:=ValueWhen(1,J,If(J=1,B,ValueWhen(2-G,1,B))); Y:=ValueWhen(1,J,If(J=1,Y,ValueWhen(2-G,1,Y))); K:=ValueWhen(1,J,If(J=1,C,ValueWhen(2-G,1,C)));
{Last frame prices plotted on last 5 frames} J:=LastValue(Cum(J>0))-5=Cum(J>0); {Frame OPEN} ValueWhen(1,J,LastValue(Q)); {Frame HIGH} ValueWhen(1,J,LastValue(B)); {Frame LOW} ValueWhen(1,J,LastValue(Y)); {Frame CLOSE} ValueWhen(1,J,LastValue(K));
|