Rank: Advanced Member
Groups: Registered, Registered Users Joined: 1/19/2005(UTC) Posts: 1,065 Location: Koh Pha-Ngan, Earth
Was thanked: 2 time(s) in 2 post(s)
|
This simple but useful indicator allows price or indicator values to be rounded to the nearest user-defined quantized $ or % level/step.
For an application example, this quantizing method could be applied to either (or both) price or MA's, to eliminate whipsaws in price/MA crossovers.
MetaStock -> Tools -> Indicator Builder -> New ->
Copy and paste complete formulae between "---8<---" lines.
[code:1:af9e2f4b52]
==============
Stepped output
==============
---8<--------------------------
{ Stepped Price/Indicator output v2.0 }
{ ©Copyright 2005 Jose Silva
For personal use only
http://www.metastocktools.com }
{ Data array or indicator to quantize }
x:=C;
{ User inputs }
step:=Input("Step size",0,10000,0.5);
type:=Input("Step type: [1]$points, [2]%percentage",1,2,1);
{ Step size }
step:=Max(If(type=1,step,
LastValue(x*(step/100))),.00001);
{ Stepped data array }
stepX:=Int(x/step+.5)*step;
{ Plot on price chart or own window }
stepX
---8<--------------------------
[/code:1:af9e2f4b52]
jose '-)
|
|
|
|
Users browsing this topic |
Guest (Hidden)
|
Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.