StrataSearch chart freezes when using fco() directly

Questions directed to our Support Team. Responses can be expected within 24 hours.

StrataSearch chart freezes when using fco() directly

Postby mandelmus » Fri Jan 11, 2013 5:43 am

The help file says that fco can be used with any values. When I apply the formula ... "fco(close-open,5)" ... to a chart, StrataSearch just freezes up and I have to "End Task" on it to close out. These freezes occur with other similar formula combinations as well. If I insert a custom formula for "clop = close - open" ... as in ... "fco(clop(),5)" ... then the chart plots the custom formula without freezing ... but, as soon as I either change the symbol or try to zoom out or in, StrataSearch freezes. Can you fix this in future releases please?
Posts: 141
Joined: Fri Dec 23, 2011 1:51 pm

Re: StrataSearch chart freezes when using fco() directly

Postby Overload » Fri Jan 11, 2013 10:07 am

Thanks for the info on this, and I was able to recreate it. I then placed the formula "fco(close-open,5)" in the Display > Calculations menu and found the root of the problem. On days when the Open Price is the same as the Close Price, this usage creates a value of zero, which then creates a divide-by-zero error in the Forecast Oscillator formula.

Traditionally the Forecast Oscillator is used with prices rather than price ranges. And I was not able to find any documentation on what Tushar Chande might recommend for this divide-by-zero scenario. But I was able to create a fix by creating a Custom Formula that forces the value to not be zero. Here's the Custom Formula I used:

value = parameter("Value");
NotZero = if(value = 0, 0.000001, value);

In the charts, I then used this formula instead:

fco(NotZero(close-open), 5)

While the above works without errors, it also creates enormous spikes in the fco() line on days when the close and open prices are equal. Instead of using 0.000001, I also tried using a value of just 1:

value = parameter("Value");
NotZero = if(value = 0, 1, value);

But this also creates spikes, and it is even more invalid since it assumes there is a price change of 1 when that is not the case.
From what I can tell, the proper way to solve this in StrataSearch would be to force a null (empty) value on days in the fco() where the input value is 0. This would create a bit of a sporadic line that appears on the chart, but then disappears whenever the close and open prices are equal. It would also create issues if the fco() were ever used in a moving average or some other formula.

In the end, you are absolutely right that the fco() should not lock up with divide-by-zero errors, and I will put this on the list. But at the same time, you're using the fco() with unorthodox input, and I'm not clear on what fco() should spit out when zeros are entered as input values. If you have a recommendation, or know of how other systems might handle it, I would appreciate the input.

Posts: 2248
Joined: Wed Nov 30, 2005 12:14 pm

Return to Technical Support