PureBytes Links
Trading Reference Links
|
Hello Pierre Orphelin,
Let's imagine for a moment that no such terrible things as "errors over bars", "double precision" and "epsilon" are exist.
To do this let's look at the simple Indicator with Single precision, Single bar (lastbaronchart) and hopefully no "epsilon" (whatever it is):
{########################################}
If LastBarOnChart Then Begin
Value1 = 10.3 - 10.2;
Value2 = 10.2 - 10.1;
If Value1 > Value2 Then Value3 = 1 Else Value3=0;
plot1 (Value3);
End;
{########################################}
What is your best guess about the value of plot1? (hint: do not use tradestation for the answer yet).
Now, after you have your best answer try to plot the Indicator in tradestation and compare the results.
If you ended up with two oposit results (as I did) use any third-party software (Microsoft Excel, e.t.c.) for the same calculation to score the results.
It would be really nice of you to post your results with your explanation here.
Thanks,
gary
> From: "pierre.orphelin" <pierre.orphelin@xxxxxxxxxxxxxx>
>
> I do not want to spend the night with this.
> Here is your code with comments ( and it produces an horizontal line here)
>
> > var: plusdm(0);
> > var: minusdm(0);
> > var: plusdm1(0);
> > var: minusdm1(0);
> > If 10.387 - 10.280 < 0 Then
> > PlusDM = 0
>
> So PlusDm will never be set to 0 (10.387 >10.280) 10.387 - 10.280 produces a
> positive number
>
> > Else
>
> Yes, else...
>
> > PlusDM = 10.387 - 10.280;
>
> PlusDM will always (Else) produce : 10.387 - 10.280 =0.107, means an
> horizontal line.
>
> > If 10.280 - 10.173 < 0 Then
> > MinusDM = 0
>
> Minus DM will never be set to 0
>
> > Else
> > MinusDM = 10.280 - 10.173;
>
> But set to 0.107
>
> > > > > > If MinusDM >= PlusDM Then
> > > > > > PlusDM = 0;
>
> Yes, it shoud be set to 0 if the rounding errors that is always the same
> over bars produced a stricly 0 value.
> But even with double precision, this error wil remains and the result will
> be 0 if the epsilon difference is below 0, 0.107 in the other case.
> What you see here is computer approximation on basic operation, and as your
> opration remains the same over bars, the same epsilon value is produced.
> This will not affect in any case the precision of the calculus more than the
> epsilon effect ( single or double precision)
|