I am new to Ninja Scripting and trying to build the PVI indicator.
Formula can be found at http://www.incrediblecharts.com/tech...lume_index.php
I started of but the code does not work:
protected override void OnBarUpdate()
{
// Use this method for calculating your indicator values.
// PVI (today) = PVI (yesterday) + [(Ct-Cy) / Cy] x PVI (yesterday)
if (Volume[0] > Volume[1]) {
myPVI.Set(0,(myPVI[1]+((Close[0] - Close[1]) / Close[1]) * myPVI[1]));
}
if (Volume[0] <= Volume[1]) {
myPVI.Set(0,myPVI[1]);
}
Plot0.Set(myPVI[0]);
Plot2.Set(myPVI[1]);
}

Comment