Rank: Advanced Member
Groups: Registered, Registered Users, Subscribers Joined: 12/14/2009(UTC) Posts: 140 Location: Austria
|
Hi Icko, I have implemented such functionality for 5 days... you will need 3 custom functions/formulas to use it: vienna_sort_1: {(c) Sort algorithm for metastock by vienna - ts} x1:=ExtFml( "gv.GetVar", "x1"); x2:=ExtFml( "gv.GetVar", "x2"); y1:=If(x1=Max(x1,x2),x1,x2); y2:=If(x1=Max(x1,x2),x2,x1); x1:=y1;x2:=y2; ExtFml( "gv.SetVar", "x1", x1); ExtFml( "gv.SetVar", "x2", x2);
vienna_sort_0: {(c) Sort algorithm for metastock by vienna - ts} v1:=ExtFml( "gv.GetVar", "v1"); v2:=ExtFml( "gv.GetVar", "v2"); v3:=ExtFml( "gv.GetVar", "v3"); v4:=ExtFml( "gv.GetVar", "v4"); v5:=ExtFml( "gv.GetVar", "v5");
ExtFml( "gv.SetVar", "x1", v1); ExtFml( "gv.SetVar", "x2", v2); Fml("vienna_sort_1"); v1:=ExtFml( "gv.GetVar", "x1"); v2:=ExtFml( "gv.GetVar", "x2"); ExtFml( "gv.SetVar", "x1", v2); ExtFml( "gv.SetVar", "x2", v3); Fml("vienna_sort_1"); v2:=ExtFml( "gv.GetVar", "x1"); v3:=ExtFml( "gv.GetVar", "x2"); ExtFml( "gv.SetVar", "x1", v3); ExtFml( "gv.SetVar", "x2", v4); Fml("vienna_sort_1"); v3:=ExtFml( "gv.GetVar", "x1"); v4:=ExtFml( "gv.GetVar", "x2"); ExtFml( "gv.SetVar", "x1", v4); ExtFml( "gv.SetVar", "x2", v5); Fml("vienna_sort_1"); v4:=ExtFml( "gv.GetVar", "x1"); v5:=ExtFml( "gv.GetVar", "x2");
ExtFml( "gv.SetVar", "v1", v1); ExtFml( "gv.SetVar", "v2", v2); ExtFml( "gv.SetVar", "v3", v3); ExtFml( "gv.SetVar", "v4", v4); ExtFml( "gv.SetVar", "v5", v5);
vienna_sort: {(c) Sort algorithm for metastock by vienna - ts}
tmp:=ExtFml( "gv.SetVar", "v1", C); tmp:=ExtFml( "gv.SetVar", "v2", Ref(C,-1)); tmp:=ExtFml( "gv.SetVar", "v3", Ref(C,-2)); tmp:=ExtFml( "gv.SetVar", "v4", Ref(C,-3)); tmp:=ExtFml( "gv.SetVar", "v5", Ref(C,-4));
tmp:=Fml("vienna_sort_0"); tmp:=Fml("vienna_sort_0"); tmp:=Fml("vienna_sort_0"); tmp:=Fml("vienna_sort_0"); tmp:=Fml("vienna_sort_0");
v1:=ExtFml( "gv.GetVar", "v1"); v2:=ExtFml( "gv.GetVar", "v2"); v3:=ExtFml( "gv.GetVar", "v3"); v4:=ExtFml( "gv.GetVar", "v4"); v5:=ExtFml( "gv.GetVar", "v5");
v3; { v3 .. median value v1 .. highest value v5 .. lowest value }
To use it.. only use "vienna_sort" on your security.. best ts PS: gv.dll will be needed - you can find it in this forum
|