Is there an indicator which can model exponential decay.
N(t) = N(0)* e^Lt
where N(0) = current data value, and L is decay constant, and t = time bars.
Trying to model volatality as a function of exponential decay.
Thanks,
Sofia
Size:
Color:
What is "time bars"?
How does the "decay" work?
So to make it easier to understand might there be some existing analogue in a different programming language?
Size:
Color:
Basically trying to predict future value based on current value.
Kind of predictive series, Decay is some constant by which value changes.
t = number of bar
CODE:
Please log in to see this code.
In the above example we are using past data to calculate current data, is it possible to model future data based on current data using
above model ?
Size:
Color:
QUOTE:
Basically trying to predict future value based on current value.
You should take a look at the Kalman indicator in Wealth Lab.
The Kalman filter is a "general solution" where you pass a system of dynamic predictive equations (partial differential equations expressed in state-space form) into the filter. It then weights the coefficients of these equations by a covariant matrix so as to minimize the contribution of the unstable terms. Any type of time series with stochastic behavior (and that includes stock price modeling) is a good fit. It's commonly used in satellite and missile guidance systems.
https://en.wikipedia.org/wiki/Kalman_filterFor stocks, only one predictive equation has been employed (but you could craft others), and that's the Taylor series: first and second derivative terms are all that have been included (in the Taylor series) for stock trading so far. Recall, but the solution to these derivatives is an exponential, so you're on the right track by fitting your problem to an exponential model, but the Kalman can do it better because of the covariance weighting of the differential coefficients.
The bad news is that Wealth Lab's Kalman indicator doesn't attempt to predict the future, which is a big oversight in my opinion for the stock trading application. I thought about extending its solution to include the next bar, but that's another issue.
But what you can--and should--do is compare the last actual bar to the value the Kalman indicator computed for the last bar. This comparison will tell you if the stock is currently under or over valued (based on the weighted Taylor series) so you can plan an entry or exit action, respectively, in your strategy. The example the WL wiki gives for the WL Kalman indicator illustrates this for a buy-low entry strategy using the CMO indicator.
https://en.wikipedia.org/wiki/Kalman_filter
Size:
Color:
Thanks, will try.
Size:
Color:
I played with the Kalman indicator example (cited above) trying to improve it some with a Chandelier Exit. I've included that code below, but it still needs serious work. The funny thing is the code below actually
performs better for 20% of the stocks compared with my primary production strategy (which doesn't use Kalman) that I trade with today.
I plan to incorporate the Kalman indicator into my main production strategy eventually, which is based on robust statistical analysis.
CODE:
Please log in to see this code.
Size:
Color:
According to the WealthScript Guide (Indicators > Stability of Indicators), some indicators used in your code are progressively calculated (ATR, Kalman). Being "unstable" they require a greater amount of "seed data" with regard to the ATR period used (22-day). So here's a little tweak to the code to account for this:
CODE:
Please log in to see this code.
Size:
Color:
You missed a parenthesis. Should be
CODE:
Please log in to see this code.
I fixed my above code.
I knew the Kalman was progressively calculated, but I didn't know about ATR being progressively calculated. I also didn't know it required that much lead-in data to become stable. Thanks.
Size:
Color: