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 Gregor
MetaStock actually restricts the number of variable names per formula, not the number of variables. What this means is that once you're finished with one name you can re-use that name. Once a variable has fulfilled its purpose and is not required later in the formula its name becomes available for any other use you may have for it.
This process can be repeated a number of times when the makeup of the code allows. True, this can make following the code a little more confusing, but who cares if it gets the job done?
Another trick that works for me is to modify a variable in order to change its functionality, redefine the variable if you like but retaining its existing name. As an example of that, last night I adapted the Vervoort Inverse Fisher RSI with 19 variable names to fit my Multi-Frame format, a format that requires around another 15 variables. Mission accomplished. By developing the 10 WMA variables and their summed value in stages I was able to reduce 11 variables down to just 2.
Part of the original formula looks like this...
ma1:= Mov(C,2,W);
ma2:= Mov(ma1,2,W);
ma3:= Mov(ma2,2,W);
ma4:= Mov(ma3,2,W);
ma5:= Mov(ma4,2,W);
ma6:= Mov(ma5,2,W);
ma7:= Mov(ma6,2,W);
ma8:= Mov(ma7,2,W);
ma9:= Mov(ma8,2,W);
ma10:= Mov(ma9,2,W);
RainbW:= (5*ma1+4*ma2+3*ma3+2*ma4+ma5+ma6+ma7+ma8+ma9+ma10)/20;
and once reduced to just two variable names it looks like this (K being the weekly CLOSE).
MA:=Mov(K,2,W); RB:=5*MA;
MA:=Mov(MA,2,W); RB:=RB+4*MA;
MA:=Mov(MA,2,W); RB:=RB+3*MA;
MA:=Mov(MA,2,W); RB:=RB+2*MA;
MA:=Mov(MA,2,W); RB:=RB+MA;
MA:=Mov(MA,2,W); RB:=RB+MA;
MA:=Mov(MA,2,W); RB:=RB+MA;
MA:=Mov(MA,2,W); RB:=RB+MA;
MA:=Mov(MA,2,W); RB:=RB+MA;
MA:=Mov(MA,2,W); RB:=(RB+MA)/20;
So it's not a matter of what MetaStock won't allow but rather a matter of working out how to overcome its apparent and often annoying limitations.
Roy
|