Welcome to NexusFi: the best trading community on the planet, with over 150,000 members Sign Up Now for Free
Genuine reviews from real traders, not fake reviews from stealth vendors
Quality education from leading professional traders
We are a friendly, helpful, and positive community
We do not tolerate rude behavior, trolling, or vendors advertising in posts
We are here to help, just let us know what you need
You'll need to register in order to view the content of the threads and start contributing to our community. It's free for basic access, or support us by becoming an Elite Member -- see if you qualify for a discount below.
-- Big Mike, Site Administrator
(If you already have an account, login at the top of the page)
yet another 'adaptation' of SW with this one you can change price factor, look back period and alpha. Disclaimer:I have no idea of what are various calculations that I cut and paste from multiple internet sources.
Coding of recently posted SWave indicator was a resource hog and a general mess, so without further ado, here is a (hopefully) improved version.
You will be able to run this one on COBC false if you are so inclined, without causing your processor to explode.
Rounding reduces the amount of wasted CPU load due to calculations that go past any reasonable number of significant digits.
"If we don't loosen up some money, this sucker is going down." -GW Bush, 2008
“Lack of proof that something is true does not prove that it is not true - when you want to believe.” -Humpty Dumpty, 2014
“The greatest shortcoming of the human race is our inability to understand the exponential function.” Prof. Albert Bartlett
Looks as though, for most instruments, rounding to only five decimal places has no effect on the output. The one exception so far is the 6J, where 7 decimal precision seems to be needed.
Which raises the question of whether the CPU cycles needed for the rounding are less than those saved by reducing the precision of the calculations. I suppose this could be answered by measuring the backfill time for different configurations and printing it to the output window, but I haven't done that.
Has anyone tested my version against Cory's to see if they plot identically? I haven't bothered to do that yet, either.
Such laziness shows why I will never become a FUNded Trader®.
Maybe we should try using JFE's new, Even BETTER Sine Wave, to paint support and resistance lines on price charts.
"If we don't loosen up some money, this sucker is going down." -GW Bush, 2008
“Lack of proof that something is true does not prove that it is not true - when you want to believe.” -Humpty Dumpty, 2014
“The greatest shortcoming of the human race is our inability to understand the exponential function.” Prof. Albert Bartlett
Who would like to check my code and find the error? My version is not plotting correctly. So for now, don't use it.
However, I found the problem. The b2 coefficient must be calculated on every tick, AFTER Smooth[0] is known, because it is dependent on Smooth[0].
So the calculation of b2 can be left where it is, but the portion of it that depends on Smooth[0] must be stripped out of it and put into the Detrender calculation.
Another problem is that Smooth[0] does not seem to apply the correct weightings to the priceval terms. I think it should be (4*priceval[0]+3*priceval[1]+2*priceval[2]=1*priceval[3]) /10. That's why the calculation of Smooth[0] and of b1 should be changed as indicated above, and why this version does not plot identically to the one posted by @cory.
Now that I have revealed the problems, who would like to fix them? My updated version plots exactly the same as other versions of SineWave that I have seen, and loads EXTREMELY fast.
"If we don't loosen up some money, this sucker is going down." -GW Bush, 2008
“Lack of proof that something is true does not prove that it is not true - when you want to believe.” -Humpty Dumpty, 2014
“The greatest shortcoming of the human race is our inability to understand the exponential function.” Prof. Albert Bartlett