[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Metastockusers] (unknown)



PureBytes Links

Trading Reference Links

nikku_x

'Error - Division by Zero'  is a common error in Metastock it can pop up in
any code that "/" (divide). The number of errors can be helpful is tracking
down the cause. I've seen it happen when a series of "no trade" days have
the last close loaded  for OHLC and then divide some value by the difference
between HIGH and LOW (H-L=0).

If a zero in a data array is indeed the cause of the problem then modifying
the code to force a fractional error in place of the zero can be effective.
Correct operator precedence needs to be observed so the error is eliminated
BEFORE the division is performed otherwise your efforts will be in vain.

If you think you have identified the data array that is causing the problem
you can do a quick check of your historical data to find the number of
events that you have

Place Cum("suspect data array"=0) in a test exploration column and run the
exploration on all you data and forcing the required number of bars. The
report column will give you a count of events for every issue. If you only
have one or two issues you can create an indicator to do the same thing.

I could cover a number of other troubleshooting techniques but I think you
get the picture. If I get a moment I'll try Jose's indicator as posted on
the issues you mention and see what happens.

I have a similar problem when using the Security function in 8.01 where I
KNOW I've eliminated the possibility of "Divide by Zero error", and yet
under certain defined conditions I can create it but not find the root
source code.

Roy

> Here is a formula which was very kindly provided to me by Jose, that
> super formula-writer :)
>
> It is meant to describe the slope of a line in MS. I was using this
> with no problems for 2 days - then yesterday, when I went to open an
> indicator I wrote which quotes this one, a message came up
> saying 'Error - Division by Zero'. This message was not coming up
> before and I was using the same charts - common INDU stocks like GE,
> MMM, etc. Has anyone seen MS acting in a similar way?
>
>
> Indicator/Oscillator Slope v2.0
>  -100~+100% / -90~+90 degrees}
> {©Copyright 2003 Jose Silva}
>
>
> x:=Mov(Mov(
>  ((C-LLV(L,7))/(HHV(H,7)-LLV(L,7)))*100
>  ,3,S),3,S);
>
> smooth:=Input("Smoothing periods",1,252,10);
> plot:=Input("plot:  underlying indicator=1,  Slope=2",1,2,2);
> y:=Input("Range adjustor (0.1~100)",0.1,100,5);
> display:=Input("display  -100~100%=1,  -90~90 degrees=2",1,2,2);
>
> LRlast:=x;
> LRS:=x-Ref(x,-1);
> LRprev:=LRlast-LRS;
>
> a:=Min(LRlast,LRprev)/Max(LRlast,LRprev);
> LRratio:=(If(LRlast>LRprev,2-a,a)-1)*y;
> LRSdeg:=If(LRratio<0,Atan(LRratio,1)-360,
>  Atan(LRratio,1));
> LRSper:=LRSdeg*10/9;
> LRStrue:=If(display=2,LRSdeg,LRSper);
>
> {smoothing alternative 1}
> LRStrue:=If(smooth=1,LRStrue,
>  Mov(LRStrue,smooth,E));
>
> {smoothing alternative 2}
> {LRStrue:=If(smooth=1,LRStrue,
>  LinRegSlope(LRStrue,smooth));}
>
> If(plot=1,x,LRStrue)
>
>
>
>
>
>
>
> To unsubscribe from this group, send an email to:
> Metastockusers-unsubscribe@xxxxxxxxxxx
>
>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
>
>
>
>



------------------------ Yahoo! Groups Sponsor ---------------------~-->
Buy Ink Cartridges or Refill Kits for your HP, Epson, Canon or Lexmark
Printer at MyInks.com. Free s/h on orders $50 or more to the US & Canada.
http://www.c1tracking.com/l.asp?cid=5511
http://us.click.yahoo.com/mOAaAA/3exGAA/qnsNAA/zMEolB/TM
---------------------------------------------------------------------~->

To unsubscribe from this group, send an email to:
Metastockusers-unsubscribe@xxxxxxxxxxx

 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/