PureBytes Links
Trading Reference Links
|
Both faster and more readable. Thank you.
Do you know if 0.000001 is a good figure or if moving towards something a
little higher catches more cases?
> -----Original Message-----
> From: Mark Jurik [mailto:mark@xxxxxxxxxxxx]
> Sent: den 18 juli 2001 17:25
> To: 'omega-list@xxxxxxxxxx'
> Subject: RE: I think I have to change my opinion from bad
> precision to buggy calculations
>
>
> The following approach can be simplified with identical results....
>
>
> BEFORE
>
> If MinusDM >= PlusDM Then
> PlusDM = 0
> else if absvalue(MinusDM-PlusDM)<=0.000001 then
> PlusDM=0;
>
>
> AFTER
>
> If MinusDM >= PlusDM - 0.000001 Then
> PlusDM = 0 ;
>
>
>
> In general, try these formats:
>
> If x <= y + 0.000001 then ....
>
> If x >= y - 0.000001 then ....
>
>
> - mark jurik
>
>
>
> ----------
> From: Bengtsson, Mats
> Sent: Tuesday, July 17, 2001 11:04 AM
> To: Jack Griffin; omega-list@xxxxxxxxxx
> Subject: RE: I think I have to change my opinion from
> bad precision to buggy c alculations
>
> I can not rewrite the functions since they are write
> protected, so I can not help as well as you suggest. What I
> have done is to create copies of them, giving them similar
> names and calling them instead. Below is the changed code for
> dmiplus, and the changes to dmiminus is similar. I have not
> yet tested if 0.000001 is the best value. It finds a number
> of occurances, but maybe 0.00001 would be better, normally
> prices never have data below 0.001 so it should be both
> enough and safe to use.
>
> As you can see, the only change I have done is to add a test
> after the test "if minusdm>=plusdm" saying "else if
> absvalue(MinusDM-PlusDM)<=0.000001
> then" and setting the value to zero. (the change need to be
> written in two places in both plusdmi and minusdmi)
>
> {*******************************************************************
> Description: Directional Movement Index Plus
> Provided By: Omega Research, Inc. (c) Copyright 1999
> ********************************************************************}
>
> Inputs: Length(NumericSimple) ;
> Variables: Counter(0), TRange(0), MyRange(Length),
> PlusDM14(0), PlusDM(0), MinusDM(0);
>
> If CurrentBar = 1 Then Begin
> MyRange = Length;
> MIBDMIPlus = 0;
> PlusDM14 = 0;
> TRange = 0;
> For Counter = 0 To MyRange - 1 Begin
> If High[Counter] - High[Counter+1] < 0 Then
> PlusDM = 0
> Else
> PlusDM = High[Counter] - High[Counter+1];
> If Low[Counter+1] - Low[Counter] < 0 Then
> MinusDM = 0
> Else
> MinusDM = Low[Counter+1] - Low[Counter];
> If MinusDM >= PlusDM Then
> PlusDM = 0
> else if absvalue(MinusDM-PlusDM)<=0.000001 then
> PlusDM=0;
> {MinusDM not set to 0 because it is not used}
> TRange = TRange + TrueRange[Counter];
> PlusDM14 = PlusDM14 + PlusDM;
> End;
> If TRange <> 0 Then
> MIBDMIPlus = 100 * PlusDM14 / TRange
> Else
> MIBDMIPlus = 0 ;
> End
> Else
> If CurrentBar > 1 Then Begin
> If High[0] - High[1] < 0 Then
> PlusDM = 0
> Else
> PlusDM = High[0] - High[1];
> If Low [1] - Low [0] < 0 Then
> MinusDM = 0
> Else
> MinusDM = Low[1] - Low[0];
> If MinusDM >= PlusDM Then
> PlusDM = 0
> else if absvalue(MinusDM-PlusDM)<=0.000001 then begin
> PlusDM=0;
> End;
> {MinusDM not set to 0 because it is not used}
> If MyRange > 0 Then Begin
> TRange = TRange[1] - (TRange[1] / MyRange) +
> TrueRange;
> PlusDM14 = PlusDM14[1] - (PlusDM14[1] /
> MyRange) +
> PlusDM;
> End;
> If TRange <> 0 Then
> MIBDMIPlus = 100 * PlusDM14 / TRange
> Else
> MIBDMIPlus = 0 ;
> End ;
>
> > -----Original Message-----
> > From: Jack Griffin [mailto:jack_2231@xxxxxxxxx]
> > Sent: den 17 juli 2001 14:03
> > To: Bengtsson, Mats; pierre.orphelin@xxxxxxxxxxxxxx;
> > omega-list@xxxxxxxxxx
> > Subject: RE: I think I have to change my opinion from bad
> > precision to bug gy c alculations
> >
> >
> > --- "Bengtsson, Mats" <mats.bengtsson@xxxxxxxx> wrote:
> > > I have found a bug. I have reported the bug. I have
> > > made clear examples of
> >
> > Hey Mats, when I find bugs in functions and indicators
> > I often post the debugged code. After you are done
> > writing debugged versions (using absvalue(x-y)<.001)
> > of the associated functions and indicators please post
> > your debugged DMI, etc.. I am sure many of us would
> > like copies. Thanks.
> >
> > Jack
> >
> >
> >
>
>
> This message contains information that may be privileged or
> confidential and is the property of the Cap Gemini Ernst &
> Young Group. It is intended only for the person to whom it is
> addressed. If you are not the intended recipient, you are not
> authorized to read, print, retain, copy, disseminate,
> distribute, or use this message or any part thereof. If you
> receive this message in error, please notify the sender
> immediately and delete all copies of this message.
>
>
>
|