PureBytes Links
Trading Reference Links
|
I have a function called CMO on my system. I assume this is the one to which you are referring. It is very simple:
CMO = 100*((C-C[Length])/(Summation(AbsValue((C-C[1])), Length)))
There obviously is no divide-by-zero check.
If you change it to:
Value1 = Summation(AbsValue((C - C[1])), Length);
if Value1 <> 0 then CMO = 100 * (C - C[Length]) / Value1;
this should fix the problem.
I have attached an ELA file of this for those with SuperCharts who cannot enter two lines of code.
Bob Fulks
At 1:48 PM -0400 4/13/99, Owen Davies wrote:
>>It sure is a bug, but not Omega's. Its of whomever
>>wrote that CMO() function. I don't have it in any of
>>my TradeStations, so unless SuperCharts has functions
>>that TradeStation does not, this function was written
>>by someone else.
>
>
>Well, I hate to seem argumentative, but this doesn't really
>make sense to me. Yes, it is an add-in function. It comes
>in the sschande.ela available at the Omega download site.
>And it works fine. Plot the indicator, and I've never had
>a problem. Use it in a "system" ( I just use them to collect
>statistics), and the system runs. But do this:
>
> CMO(n) > CMO(n)[1],
>
>and you get the dreaded DBZ error.
>
>I've had this happen with other indicators as well, including
>a derivative I wrote of the RSI which did not involve any
>divisions. Worked fine until I tried to compare one day's
>oscillator value with the previous day's. Another case of
>inexplicable DBZ.
>
>My own best guess is that Earl Adamy is right: The divide-
>by-zero message is just something Omega uses to tell us
>the software has puked for no good reason. But if someone
>has a better explanation--or, please God, a work-around--
>I'd love to hear it.
>
>Thanks for trying.
>
>Owen Davies
Attachment Converted: "c:\eudora\attach\CMOFUNCT.ELA"
|