I am trying to find the maximum of a variable inside a single bar. For example, I would like to know what the maximum delta during a volumetric bar is. It sounds like an easy task, but I cannot get it working. I use a logic like this:
protected override void OnBarUpdate()
{
int paraMax;
if(IsFirstTickOfBar)
{
paraMax = 0;
}
f = f is a function that changes during a bar, e.g., delta
paraMax = Math.Max(paraMax, f)
Draw.Text(this , "MaxDelta" ,paraMax , 0, Low[0]-2*TickSize);
}
I think the problem is how to define and initialize a variable only at the beginning of a bar. I appreciate any help.
Comment