Chirped Sine Wave GeneratorINTRODUCTION:
The title pretty much sums up what this tool is, but not what it's for. It's NOT an indicator, just a chirped sine wave generator intended as a developer tool. Basically it sweeps from a very high frequency near the "Nyquist frequency" by chosen starting, step, and repetition rates to an ever decreasing lower frequency. This is typically viewed best on ALL, 5Y, or 1Y charts starting at bar_index==0 onward. Also, with the chart interval being intraday, you may use (ALT + SHIFT + ◀) keyboard shortcuts to jump back to barstate.isfirst. I will say, to witness a much broader scope of the sweep, having 4K is better for viewing it with the highest detailed resolution when making comparisons.
VISUAL AIDS:
When a frequency steps to another frequency a label displays the cycle period of the new frequency. This may be disabled to remove it's obstruction of view when overlaying indicators on top of it. I also included RMS levels that may be enabled.
USAGE:
As you can see above, I sourced TV built-in indicators to the "cSine Wave" plot, having varying results across the varying frequencies generated. Oscillating indicators and filters (ema, sma, etc...) of all sorts can be applied to it to inspect lag, amplitudes, or anomalies that render across the flux on the sweeping sine wave. Keep in mind market data has near infinite frequencies existing at any given time that can pop up or disappear instantly, so performance in theory on this swept synthetic waveform does not equate to performance on ANY ticker. It's gives you "ONE" totally different perspective to evaluate novel indicators.
OBSERVATIONS:
Witnessing the antiquated RSI on higher short frequencies, you will see it has a few issues, hmm. The amplitude is clamped near 50 at the Nyquist frequency growing with increasing amplitude in a funnel like shape. That doesn't imply it's a bad indicator, only there could be room for improvements... potentially. Wilder was calculating the RSI on paper basically, and the calculations were made as simple as possible in late 1970's. With advances in modern computing, many exotic permutations of RSI now exist attempting to improve upon it's original characteristics. EMA sourced to this tool appears in similar fashion to the RSI with it's own peculiarities. I suspect this occurs because EMA and RSI both use an IIR filter. CCI has a better representation across the spectral flux in this case, but that doesn't imply it's a perfect indicator on market data either. CCI could be improved as well...
REVELATIONS:
The chirped sine wave is only revealing a partial story about RSI's, EMA's, and CCI's attributes. In conclusion, how various frequencies affect our indicators, can be a bit more visually obvious using this tool, but it doesn't reveal all. For example, a 3D-RSI tells a different story when viewed in that perspective. Using a chirped sine wave, observations of ringing, weird frequency excitations, or no plot (na) may elude to more serious issues with an algorithm. In many cases, I often move the testing indicator pane to overlay the chirped sine wave pane for a more direct and precise inspection on 4K. I hope that gives you a better idea of this developer tool's intention and it's potentially limited but profound usage. I will be employing this upon nearly indicator fit for evaluation that I can utilize, upgrade, or invent in the future...
Synthesizer
Synthetic Price Action GeneratorNOTICE:
First thing you need to know, it "DOES NOT" reflect the price of the ticker you will load it on. THIS IS NOT AN INDICATOR FOR TRADING! It's a developer tool solely generating random values that look exactly like the fractals we observe every single day. This script's generated candles are as fake as the never ending garbage news cycles we are often force fed and expected to believe by using carefully scripted narratives peddled as hypnotic truth to psychologically and emotionally influence you to the point of control by coercion and subjugation. I wanted to make the script's synthetic nature very clear using that analogy, it's dynamically artificial. Do not accidentally become disillusioned by this scripts values, make trading decisions from it, and lastly don't become victim to predatory media magic ministry parrots with pretty, handsome smiles, compelling you to board their ferris wheel of fear. Now, on to the good stuff...
BACKSTORY:
Occasionally I find myself in situations where I have to build analyzers in Pine to actually build novel quantitative analytic indicators and tools worthy of future use. These analyzers certainly don't exist on this platform, but usually are required to engineer and tweak algorithms of the highest quality with the finest computational caliber. I have numerous other synthesizers to publish besides this one.
For many reasons, I needed a synthetic environment to utilize the analyzers I built in Pine, to even pursue building some exotic indicators and algorithms. Pine doesn't allow sourcing of tuples. Not to mention, I required numerous Pine advancements to make long held dreams into tangible realities. Many Pine upgrades have arrived and MANY, MANY more are in need of implementation for all. Now that I have this, intending to use it in the future often when in need, you can now use it too. I do anticipate some skilled Pine poets will employ this intended handy utility to design and/or improved indicators for trading.
ORIGIN:
This was inspired by the brilliance from the world renowned ALGOmist John F. Ehlers, but it's taken on a completely alien form from its original DNA. Browsing on the internet for something else, I came across an article with a small code snippet, and I remembered an old wish of mine. I have long known that by flipping back and forth on specific tickers and timeframes in my Watchlist is not the most efficient way to evaluate indicators in multiple theatres of price action. I realized, I always wanted to possess and use this sort of tool, so... I put it into Pine form, but now have decided to inject it with Pine Script steroids. The outcome is highly mutable candle formations in a reusable mutagenic package, observable above and masquerading as genuine looking price candles.
OVERVIEW:
I guess you could call it a price action synthesizer, but I entitled it "Synthetic Price Action Generator" for those who may be searching for such a thing. You may find this more useful on the All or 5Y charts initially to witness indication from beginning (barstate.isfirst === barindex==0) to end (last_bar_index), but you may also use keyboard shortcuts + + to view the earliest plottable bars on any timeframe. I often use that keyboard shortcut to qualify an indicator through the entirety of it's runtime.
A lot can go wrong unexpectedly with indicator initialization, and you will never know it if you don't inspect it. Many recursively endowed Infinite Impulse Response (IIR) Filters can initialize with unintended results that minutely ring in slightly erroneous fashion for the entire runtime, beginning to end, causing deviations from "what should of been..." values with false signals. Looking closely at spg(), you will recognize that 3 EMAs are employed to manage and maintain randomness of CLOSE, HIGH, and LOW. In fact, any indicator's barindex==0 initialization can be inspected with the keyboard shortcuts above. If you see anything obviously strange in an authors indicator, please contact the developer if possible and respectfully notify them.
PURPOSE:
The primary intended application of this script, is to offer developers from advanced to even novice skill levels assistance with building next generation indicators. Mostly, it's purpose is for testing and troubleshooting indicators AND evaluating how they perform in a "manageable" randomized environment. Some times indicators flake out on rare but problematic price fluctuations, and this may help you with finding your issues/errata sooner than later. While the candles upon initial loading look pristine, by tweaking it to the minval/maxval parameters limits OR beyond with a few code modifications, you can generate unusual volatility, for instance... huge wicks. Limits of minval= and maxval= of are by default set to a comfort zone of operation. Massive wicks or candle bodies will undoubtedly affect your indication and often render them useless on tickers that exhibit that behavior, like WGMCF intraday currently.
Copy/paste boundaries are provided for relevant insertion into another script. Paste placement should happen at the very top of a script. Note that by overwriting the close, open, high, etc... values, your compiler will give you generous warnings of "variable shadowing" in abundance, but this is an expected part of applying it to your novel script, no worries. plotcandle() can be copied over too and enabled/disabled in Settings->Style. Always remember to fully remove this scripts' code and those assignments properly before actual trading use of your script occurs, AND specifically when publishing. The entirety of this provided code should never, never exist in a published indicator.
OTHER INTENTIONS:
Even though these are 100% synthetic generated price points, you will notice ALL of the fractal pseudo-patterns that commonly exist in the markets, are naturally occurring with this generator too. You can also swiftly immerse yourself in pattern recognition exercises with increased efficiency in real time by clicking any SPAG Setting in focus and then using the up/down arrow keys. I hope I explained potential uses adequately...
On a personal note, the existence of fractal symmetry often makes me wonder, do we truly live in a totality chaotic universe or is it ordered mathematically for some outcomes to a certain extent. I think both. My observations, it's a pre-deterministic reality completely influenced by infinitesimal amounts of sentient free will with unimaginable existing and emerging quantities. Some how an unknown mysterious mechanism governing the totality of universal physics and mathematics counts this 100.0% flawlessly and perpetually. Anyways, you can't change the past that long existed before your birth or even yesterday, but you can choose to dream, create, and forge the future into your desires and hopes. As always, shite always happens when your not looking for it. What you choose to do after stepping in it unintentionally... is totally up to you. :) Maybe this tool and tips provided will aid you in not stepping in an algo cachucha up to your ankles somehow.
SCRIPTING LESSONS PORTRAYED IN THIS SCRIPT:
Pine etiquette and code cleanliness
Overwrite capabilities of built-in Pine variables for testing indicators
Various techniques to organize Settings panel while providing ease of adjustment utility
Use of tooltip= to provide users adequate valuable information. Most people want to trade with indicators, not blindly make adjustments to them without any knowledge of their intended operation/effects
When available time provides itself, I will consider your inquiries, thoughts, and concepts presented below in the comments section, should you have any questions or comments regarding this indicator. When my indicators achieve more prevalent use by TV members , I may implement more ideas when they present themselves as worthy additions. Have a profitable future everyone!
[pp] Signal GeneratorResearch and Development Tool.
For anyone who is familiar with working with digital signals (audio/electrical engineers) you might appreciate this Signal Generator.
You can select and vary 4 different types of signals.
Logistic Map
If you're not familiar with the logistic map, then go watch a youtube video. By default the equation is meant to represent chaos and is a good alternative for random number generation.
Random
This uses the built-in random number generator. I'm not sure if it's better to use this or the logmap default settings. Either way, you have a choice.
Unit Impulse
Good for creating a transient impulse.
Step Impulse
Similar to the unit impulse. Except constant and not a transient.
Synthesizer
It comes with 4 wave functions (Sine, Triangle, Square, Saw) that can be combined for additive synthesis. Each wave function contains its own respective phase and amplitude control.
Credits
Many of these functions were taken from www.pinecoders.com with the exception of the logistic map. I simply aggregated them all into this toolkit for ease of use.
How to use
This is not a trading indicator. This is meant to be used for research and development. You could use it to test strategies, by generating white noise with the logmap and creating trading signals. Or you could use it for teaching and learning. Using the constant data as a dependable, repeatable resource.