Login Page - Create Account

Support Board


Date/Time: Mon, 10 Jun 2024 15:07:30 +0000



Post From: Ehlers Even Better Sine Wave

[2022-06-15 22:59:28]
SC Support Tom - Posts: 450
WRT Post #11:


I don't see an image attached even when I log in. Just says Private File.

I just made it public. Please have a look at it.


You can see that an input of 2 in the study interface, when inverted, plots like the 3 input but is a bit more responsive (faster).

It is more responsive, but with random data. This is a clear cut case of GIGO (Garbage In, Garbage Out).


That's exactly what you would expect.

No. A horizontal line at zero is exactly what you would expect.

Please observe:

alpha1 = (1 - sin(360/2))/cos(360/2) = (1 - sin(180))/cos(180) = (1 - 0)/(-1) = -1

HP = 0.5(-1 + 1)(Close - Close[1]) + (-1)HP[1]
HP = 0 - HP[1]
HP = -HP[1]

Since all Subgraphs are initialized to 0 by default, HP should be 0 for all values of sc.Index, and consequently, so should the values of the Indicator. But since the calculated values of HP differ slightly from zero, this is not what we see.

What you are looking at is due to the vagaries of floating point arithmetic in C++. That's it. It is not a problem for other values of the Length, because the errors are so small. But when the exact value of a calculation is 0, any error is a 100% error.

Strictly speaking, we should be disallowing a Length of 4 as well, since the exact value of alpha1 is undefined for that Length. But again, floating point error stops that from happening.


All I'm asking is you don't put the limit on it so I can continue to use the study this way.

I was directed to change it by one of my superiors who reviewed the thread, and I agree with him that it should be done. I will call him over here for a final ruling.

In the meantime, as a compromise, I am attaching a .cpp file for the EBSWI as an Advanced Custom Study that will allow you to use Lengths from 1 onwards. You can build it and use it.
Date Time Of Last Edit: 2022-06-16 02:33:33
attachmentscsf_EvenBetterSinewaveIndicator.cpp - Attached On 2022-06-15 23:17:06 UTC - Size: 2.45 KB - 124 views