Rank: Advanced Member
Groups: Registered, Registered Users, Subscribers Joined: 5/13/2005(UTC) Posts: 715 Location: Midwest, USA
Was thanked: 1 time(s) in 1 post(s)
|
I'm trying to plot a simple moving average, centered properly. The following comes close:
Speed:= Input("MA",1,500,80); Displacement:=Speed/2; MA:=Mov(C,Speed,S); Ref(MA,Displacement);
To do it properly, the period and displacement need to be an odd number, so I've coded an automatic adjustment:
Speed:= Input("MA",1,500,80); Speed:=If(Mod(Speed,2)=0,Speed+1,Speed); MA:=ExtFml("FORUM.Mov",C,Speed,S); Displacement:=If(Mod(Speed,2)=0,Speed/2,(Speed+1)/2); ExtFml("Forum.REF",MA,-Displacement);
However, the adjustment means that the FORUM.DLL needs to be used for both the Moving Average and the use of REF for a horizontal shift (like the built-in M.A.).
It "sort of" works, BUT the FORUM.DLL plot drops down to zero, instead of stopping!
Anyone have an idea on how to fix this?
|