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

RE: AW: TradeStation Precision - Summary with example



PureBytes Links

Trading Reference Links

I do not have time to verify, but what you do is somewhat dangerous:
You use the same variables for both calculations is the same code ( dmi and
betterdmi share plusdm and plusdm14 and other variables in the same
indicator code for both versions.

If I would do a comparison test, I prefer to write them as user functions,
and call the functions from the main code, in order to be sure that nothing
may interact


Sincerely,

Pierre Orphelin
www.sirtrade.com
TradeStation Technologies representative in France



> -----Message d'origine-----
> De : Bengtsson, Mats [mailto:mats.bengtsson@xxxxxxxx]
> Envoyé : mardi 31 juillet 2001 23:36
> À : omega-list@xxxxxxxxxx
> Objet : FW: AW: TradeStation Precision - Summary with example
>
>
> Resent the below mail, after deleting all lines that contained error that
> were so small they were not visible in second decimal of the
> percent column,
> and then splitting the listing to one mail and the functions to another,
> since it seems to have been to big to go through. This is the
> mail with the
> code
>
> This will be a lengthy mail, but not too many words, just my
> opinion "a bug
> is a bug", followed by the run of the Omega DMIPlus function for one of my
> sybols compared with a dmi that should be a little more correct (only data
> shown is lines with precision errors). The symbol data has only three
> decimals as is standard in Omega. The output below is the second symbol
> printing with errors (the first was ericsson). The selected
> dmipluslength 5
> is arbitrary, I guess by changing lengths the errors can becomes
> smaller or
> greater, I have not tried to optimise in either direction.
>
> First in the list comes symbolname, date, omegadmi, betterdmi, difference
> and difference in percent. Last comes the functions I used to produce the
> list, which is the dmi fuinction provided by omega, corrected according to
> Bob with extensions done by me, followed by those extended
> functions. Anyone
> who wants to can run the functions on his data (I used workspace
> assistant,
> and I get differences on for example ericsson, which should affect some of
> you). I have spent too much time trying to explain this but not getting
> through to neither Pierre nor Patrick, that I actually did not
> bother to see
> if I did any great coding errors, but I hope not.
>
> Sorry for this long mail, but I thought that maybe this will show a little
> easier that differences exists, are a lot more than 7th digit in precision
> difference, and will affect your trading a lot if you are using
> for example
> plusdmi, difference plusdmi/minusdmi, plusdmi rising/not rising, ... There
> are other examples in other indicators, I am just focusing on
> this one since
> it is easier to discuss if it does not becomes to theoretical.
>
> Plusdmi function:
> {*******************************************************************
> 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);
> Var: OldDM14(0),OldPlusDm(0);
>
> If CurrentBar = 1 Then Begin
> 	MyRange = Length;
> 	MIBTest2 = 0;
> 	PlusDM14 = 0;
> 	OldDM14=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];
> 		OldPlusDM=PlusDM;
> 		If MIBGreaterEqual(MinusDM,PlusDM) Then
> 			PlusDM = 0 ;
> 		if (MinusDm>=OldPlusDM) then
> 			OldPlusDM=0;
> 		{MinusDM not set to 0 because it is not used}
> 		TRange = TRange + TrueRange[Counter];
> 		PlusDM14 = PlusDM14 + PlusDM;
> 		OldDM14=OldDM14+OldPlusDM;
> 	End;
> 	If TRange <> 0 Then BEGIN
> 		MIBTest2 = (100 * PlusDM14 / TRange)-(100 * OldDM14 /
> TRange);
> 		if ((100 * PlusDM14 / TRange)-(100 * OldDM14 / TRange)<>0)
> then
>
> FileAppend("d:\temp\dmiError.csv",GetSymbolname+",Date"+numtostr(d
> ate,0)+",O
> megaDMI,"+numtostr((100 * PlusDM14 /
> TRange),3)+",BetterDMI,"+numtostr((100
> * OldDM14 / TRange),3)+",diff,"+numtostr((100 * PlusDM14 / TRange)-(100 *
> OldDM14 / TRange),3)+",diffpercent,"+numtostr(((100 * PlusDM14 /
> TRange)-(100 * OldDM14 / TRange))/(100 * OldDM14 /
> TRange)*100,2)+newline);
> 	End
> 	Else
> 		MIBTest2 = 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];
> 		OldPlusDM=PlusDM;
> 		If MIBGreaterEqual(MinusDM,PlusDM) Then
> 			PlusDM = 0;
> 		if (MinusDm>=OldPlusDM) then
> 			OldPlusDM=0;
> 		{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;
> 			OldDM14=OldDM14[1] -(OldDM14[1]/MyRange)+OldPlusDM;
> 		End;
> 		If TRange <> 0 Then Begin
> 			MIBTest2 = (100 * PlusDM14 / TRange)-(100 * OldDM14
> / TRange);
> 			if ((100 * PlusDM14 / TRange)-(100 * OldDM14 /
> TRange)<>0) then
>
> FileAppend("d:\temp\dmiError.csv",GetSymbolname+",Date"+numtostr(d
> ate,0)+",O
> megaDMI,"+numtostr((100 * PlusDM14 /
> TRange),3)+",BetterDMI,"+numtostr((100
> * OldDM14 / TRange),3)+",diff,"+numtostr((100 * PlusDM14 / TRange)-(100 *
> OldDM14 / TRange),3)+",diffpercent,"+numtostr(((100 * PlusDM14 /
> TRange)-(100 * OldDM14 / TRange))/(100 * OldDM14 /
> TRange)*100,2)+newline);
> 		End
> 		Else
> 			MIBTest2 = 0 ;
> 	End ;
>
>
> Mibgreaterequal function:
> Inputs: LeftValue(Numericsimple),RightValue(NumericSimple);
> MIBGreaterEqual=LeftValue>=(RightValue-MIBFloatCompareValue(LeftValue));
>
>
> Mibfloatcomparevalue function:
> Inputs: Value(Numericsimple);
> Var: AbsCurrentValue(0);
> AbsCurrentValue=absValue(Value);
> if (AbsCurrentValue<1) Then Begin
> 	MIBFloatCompareValue=0.0000005;
> End
> else if (AbsCurrentValue<10) Then Begin
> 	MIBFloatCompareValue=0.000005;
> End
> else if (AbsCurrentValue<100) Then Begin
> 	MIBFloatCompareValue=0.00005;
> End
> else if (AbsCurrentValue<1000) Then Begin
> 	MIBFloatCompareValue=0.0005;
> End
> else if (AbsCurrentValue<10000) Then Begin
> 	MIBFloatCompareValue=0.005;
> End
> else Begin
> 	MIBFloatCompareValue=0.05;
> End
>
> Indicator to output all of it:
> Plot mibtest2(5);
>
>
>
> 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.
>