Rank: Advanced Member
Groups: Registered, Registered Users, Subscribers Joined: 10/29/2004(UTC) Posts: 1,394 Location: Glastonbury, CT
Was thanked: 2 time(s) in 2 post(s)
|
You can have up to 20 declared variables in an indicator.You can also reuse some of those 20 variables again, once you have come to their last value. The use of the Fml() and VarFml() do speed up processing, there are drawbacks! If you use those functions in another indicator, they default back to their default values. IE: Fml(a) has 3 input values Length, smoothing, lookback, you now create Fml(b) that uses Fml(A) as a Variable. Fml(A) will then revert back to it's default values Another problem with the use of Fml() functions, say you create an indicator Fml(A) that has multiple plot lines Now if I were to use this Fml(A) in another indicator , only "BearRise"
would be used since it is the last value stated, to remedy this you
would have to use the VarFml() function Code: pds1:=Input("fast ma",3,100,5);
pds2:=Input("slow ma",5,200,21);
pds3:=Input("signal len",2,100,5);
TF:=Input("Time frame 1",1,100,1);
Off:=Input("Offset",0,100,0);
HD:= ExtFml("PowerPivots.TDataCreate",1,TF);
LD:= ExtFml("PowerPivots.TDataCreate",2,TF) ;
A:=Mov((HD+LD)/2,pds1,E)-Mov((HD+LD)/2,pds2,E);
Sig:=Mov(A,pds3,E);
BullRise:=If(A>0 AND A>Ref(A,-1),A,0);
BullFall:=If(A>0 AND A<Ref(A,-1),A,0);
BearRise:=If(A<0 AND A>Ref(A,-1),A,0);
BearFall:=If(A<0 AND A<Ref(A,-1),A,0);
BullRise:=ExtFml( "PowerPivots.TDataLocalize",BullRise, TF, Off);
BullFall:=ExtFml( "PowerPivots.TDataLocalize",BullFall, TF, Off);
BearRise:=ExtFml( "PowerPivots.TDataLocalize",BearRise, TF, Off);
BearFall:=ExtFml( "PowerPivots.TDataLocalize",BearFall, TF, Off);
UZ:=Ref(HHV(Sig,52),-1)*.90;
LZ:=Ref(LLV(Sig,52),-1)*.90;
Sig:=ExtFml( "PowerPivots.TDataLocalize", Sig, TF, Off);
UZ:=ExtFml( "PowerPivots.TDataLocalize", UZ, TF, Off);
LZ:=ExtFml( "PowerPivots.TDataLocalize", LZ, TF, Off);
UZ;LZ;Sig;BullRise;Bullfall;BearFall;BearRise;
Another problem with the use of Fml() function is in renaming an indicator or deleting that indicator, then you will get a rat's nest of error messages In your first post you stated a performance issue! This resulted in the use of multiple mathematical operations that are redundant and are a waste of computer resources. There are several reasons as to why Metastock slows down, without a visual chart showing what you are doing, it is difficult to determine the cause! How many Bars are loaded onto your Chart?Are you looking at RealTime or EOD Data? The Number of Indicators Plotted on a Chart? How many open Charts are you looking at once? How many indicators that you use have the Prev()function? How many indicators have the Security()function? I would suggest that you read the formula primer that is in the files section in this forum. I can tell you that a formula that is short and concise will process a lot faster than one that is poorly written!
|