Material Design ColorsThis library provides a standard set of colors defined in Material Design 2.0.
🔵 API
Step 1: Import this library.
import algotraderdev/material/1
// remember to check the latest version of this library and replace the 1 above.
Step 2: Get the color you like. Check the source code or the screenshot above to see all the supported colors.
material.red()
Each color function (except for `black()` and `white()`) accepts an optional `variant` parameter. You can choose any of 50, 100, 200, 300, 400, 500, 600, 700, 800, and 900. By default, 500 is chosen if this parameter is not provided.
Design
Branch CurveLibrary "branch"
Generates a branch made of segments with a starting angle
and a turning angle for each segment. The branch is generated from a starting point
and a number of nodes to generate. The length of each segment and angle of each segment
can be adjusted. The branch can be generated in 2D or 3D, render as you wish.
method branch(origin, nodes, segment_length, segment_growth, angle_start, angle_turn)
# Branch Generation.
- `origin`: CommonTypesMath.Vector3 - The starting point of the branch. If the z value is not zero, it will be used as the starting angle.
- `nodes`: int - The number of nodes to generate.
- `segment_length`: float - The length of each segment.
- `segment_growth`: float - The growth of each segment. 0 = no growth, 100 = double the length of the previous segment.
- `angle_start`: float - The starting angle of the branch in degrees.
- `angle_turn`: float - The turning angle of each segment in degrees.
Namespace types: CommonTypesMath.Vector3
Parameters:
origin (Vector3 type from RicardoSantos/CommonTypesMath/1) : The starting point of the branch. If the z value is not zero, it will be used as the starting angle.
nodes (int) : The number of nodes to generate.
segment_length (float) : The length of each segment.
segment_growth (float) : The growth of each segment. 0 = no growth, 100 = double the length of the previous segment.
angle_start (float) : The starting angle of the branch in degrees.
angle_turn (float) : The turning angle of each segment in degrees.
@return segments The list of segments that make up the branch.
TASC 2023.03 Every Little Bit Helps - Special EditionMy first Published contribution.
Gracious thank you to all Pine Coders,
this has subtle features that have multiple shifts based on inputs.
with some experimentation, one might try pushing other sources
at the hue dials and see more dynamic indication.
for John Ehlers article
TASC Magazine This Month.
- Special Edition.
theme_engineLibrary "theme_engine"
Theme Builder and Structure for live generative themes
init(_name)
New theme object.
Parameters:
_name : (string) opptional name
Returns: a VAR theme (holds it's vals when updated if not overwritten)
globals(theme, _h1, _h2, _h3, _h4, _s, _val, _contrast)
Create light/dark theme globals
Parameters:
theme : (theme) Theme to add theses to
_h1 : (float) Hue #1 for Template
_h2 : (float) Hue #2 for Template
_h3 : (float) Hue #3 for Template
_h4 : (float) Hue #4 for Template
_s : (float) Saturation of theme
_val : (float) Luminosity (light/dark)
_contrast : (float) Contrast to apply
Returns: Theme wwith adjusted colors
setConfig(theme, setting)
Apply a Settings object to a theme
Parameters:
theme : Theme object to apply settings to.
setting : settings to apply
Returns: theme
Types :
settings
Settings for a theme
Fields:
h1 : (float) Hue #1 for Template
h2 : (float) Hue #2 for Template
h3 : (float) Hue #3 for Template
h4 : (float) Hue #4 for Template
sat : (float) Saturation of theme
lum : (float) Luminosity (light/dark)
vib : (float) Vibrance (Contrast)
r : (float) Hue of Red
o : (float) Hue of Orange
y : (float) Hue of Yellow
g : (float) Hue of Green
a : (float) Hue of Aqua
b : (float) Hue of Blue
i : (float) Hue of Indigo
v : (float) Hue of Violet
satvals : (settings) Array for use if desired to customize Saturation per color
lumvals : (settings) Array for use if desired to customize Luminancce per color
mods
Modifiers Item for Use if desired
Fields:
val : (float)
size : (float)
depth : (float)
hue : (float)
sat : (float)
alpha : (float)
mix : (float)
emit : (float)
ch : (float)
step : (int)
dist : (int)
holds : (mods)
isin : (mods)
track : (color)
varient
Light/Dark/Custom Theme Varients
Fields:
bg : (color) Bacckground Color
fg : (color) Foreground Color
accent : (color) Accccent Color
secondary : (color) Secondary Color
txt : (color) Text Color
theme
Theme Object
Fields:
name : (string) Theme name
dark : (varient) Theme dark Varient
light : (varient) Theme light Varient
red : (color) Color for red
orange : (color) Color for orange
yellow : (color) Color for yellow
green : (color) Color for green
aqua : (color) Color for aqua
blue : (color) Color for blue
purple : (color) Color for purple
pink : (color) Color for pink
tweaks : (mods) Modifiers UDT to use for adjusters
themedict
Fields:
names : (string ) Names of themes
themes : (theme ) Theme Items
fontLibrary "font"
Unicode Characters Replacement function for strings.
uni(_str, _number)
Unicode Font Substitutee
Parameters:
_str : Input Strinbg
_number : Font by Int input
uni(_str, _number)
Unicode Font Substitutee
Parameters:
_str : Input Strinbg
_number : Font by Name input
ColorArrayLibrary "ColorArray"
Simple color array gradient tool.
makeGradient(size, _col1, _col2, _col3, _col4, _col5) Color Gradient Array from 5 colors.
Parameters:
size : : default 10
_col1 : : default #ff0000
_col2 : : default #ffff00
_col3 : : default #00ff00
_col4 : : default #00ffff
_col5 : : default #0000ff
Returns: array of colors to specified size.
Ichimoku [Gu5]Original Ichimoku Kinko Hyo created by Goichi Hosoda 1930
Knowing how to interpret the Ichimoku indicator can be complicated. I hope this version is more intuitive
Use Ichimoku to determine the trend of the day
When the market is above the cloud, and Tenkan (green line) crosses over Kijun (red Line), there is a Bullish Trend . When Tenkan crosses under Kijun, the trend ends.
When the market is under the cloud, and Tenkan crosses under Kijun; There is a Bearish Trend . When Tenkan crosses over Kijun, the trend ends.
When the market crosses the cloud (orange bars), there is no trend
The default setting is 9, 26 and 52. For cryptocurrencies (24/7 market), you can change it to 10, 30 and 60 periods.
///
Ichimoku Kinko Hyo fue creado por Goichi Hosoda en 1930
Saber interpretar al indicador Ichimoku puede ser complicado. Espero esta version sea mas intuitiva
Use Ichimoku para determinar la tendencia del día, y operar solo a favor de la misma
Cuando el mercado esta sobre la nube y Tenkan (linea verde) cruza sobre Kijun (linea roja), la tendencia es alcista. Cuando Tenkan cruza bajo Kijun, termina la tendencia.
Cuando el mercado esta bajo la nube y Tenkan cruza bajo Kijun, la tendencia es bajista. Cuando Tenkan cruza sobre Kijun, termina la tendencia.
Cuando el mercado atraviesa la nube (barras naranjas), no hay tendencia
Por defecto, el seteo es 9, 26 y 52. Para criptomonedas, puede cambiarlo a 10, 30 y 60 períodos
Open Interest Money Flow Index (OIMFI)CAUTION : This system was inspired from seiglerj' s "Money Flow Index " script. Open Interests are used instead of volume.
What is the Money Flow Index ( MFI )?
The Money Flow Index ( MFI ) is a technical oscillator that uses price and volume for identifying overbought or oversold conditions in an asset. It can also be used to spot divergences which warn of a trend change in price. The oscillator moves between 0 and 100.
Unlike conventional oscillators such as the Relative Strength Index ( RSI ), the Money Flow Index incorporates both price and volume data, as opposed to just price. For this reason, some analysts call MFI the volume-weighted RSI .
What Does the Money Flow Index ( MFI ) Tell You?
One of the primary ways to use the Money Flow Index is when there is a divergence. A divergence is when the oscillator is moving in the opposite direction of price. This is a signal of a potential reversal in the prevailing price trend.
For example, a very high Money Flow Index that begins to fall below a reading of 80 while the underlying security continues to climb is a price reversal signal to the downside. Conversely, a very low MFI reading that climbs above a reading of 20 while the underlying security continues to sell off is a price reversal signal to the upside.
Traders also watch for larger divergences using multiple waves in the price and MFI . For example, a stock peaks at $10, pulls back to $8, and then rallies to $12. The price has made two successive highs, at $10 and $12. If MFI makes a lower higher when the price reaches $12, the indicator is not confirming the new high. This could foreshadow a decline in price.
The overbought and oversold levels are also used to signal possible trading opportunities. Moves below 10 and above 90 are rare. Traders watch for the MFI to move back above 10 to signal a long trade, and to drop below 90 to signal a short trade.
Other moves out of overbought or oversold territory can also be useful. For example, when an asset is in an uptrend, a drop below 20 (or even 30) and then a rally back above it could indicate a pullback is over and the price uptrend is resuming. The same goes for a downtrend. A short-term rally could push the MFI up to 70 or 80, but when it drops back below that could be the time to enter a short trade in preparation for another drop .
Reference : www.investopedia.com
WARNING :
** Since each instrument in the list has its own unique contract data, you must first enter its name to display it. I recommend you to select OANDA from the markets. Finally, when the COT reports are issued, it may repaints. However, this repaint is usually close to closing or after close .(When COT reports are so sharp ) So use this script only 1W ( 1 week ) or 1 M ( 1 month ) timeframe.
** This data is taken to Tradingview with the help of Quandl. This is a very low possibility, but the system will not work if there is a malfunction.
FEATURES :
*** Working with all futures (Including : Bitcoin )
*** If you dont work with "Futures" , you can select "Others" from switchable menu and use volume for all instruments.
*** New generation elegant design used : Adaptive coloring Overbought - Oversold Levels according to the closing price.
NOTE : This code is open source under the MIT License. If you have any improvements or corrections to suggest, please send me a pull request via the github repository github.com
Stay tuned. Best wishes !
Function : Bollinger Bands and BBW Squeeze DetectorThis script shows Bollinger Bands function and want to detect Bollinger Band Width Squeeze with a successful, different perspective .
Bollinger Bands : You can specify the Bollinger Bands periods as mutable variables .
Bollinger Band Width Squeeze : First the Bollinger bands width was calculated.The width was then divided into levels using the money flow index.
Thus, the bollinger takes into account the available volume averages when calculating the band width mfi (Money Flow Index).
After this modelling, we can limit and color the lower limit and upper limits just as Relative Strength Index.
We can even put warnings on oversold areas if desired. Let's not forget that we are working with width rather than price.
By design, squeeze areas are defined directly above the Bollinger Bands with coloration. I think it is very practical and looks stylish.
I tried and found it quite successful and wanted to share it with users.
I came up with many ideas when I wrote this system, and I will share them very soon . I hope it will be useful to users and give new ideas.
Best regards.
Template For Custom FIR Filters - Make Your Moving AverageIntroduction
FIR filters (finite impulse response) are widely used in technical analysis, there is the simple or arithmetic moving average, the triangular, the weighted, the least squares...etc. A FIR filter is characterized by the fact that its impulse response (the output of a filter using an impulse as input) is finite, this mean that the impulse response won't have infinite outputs unlike IIR filters.
They are extremely simple to design to, even without the Fourier transform, this is why i post this template that will let you create custom filters from step responses. Don't hesitate to post your results.
How It Works
Originally you create your filters from the frequency response you want your filter to have, this is because the inverse Fourier transform of the frequency response is the filter impulse response.
After that step you use convolution (convolution is the sum of the product between the signal and the impulse response) and you will have your filter. But we don't have Fourier transforms in pine so how can we possibly make FIR filters from convolution ? Well here the thing, the impulse response is the derivative of the step response and the step response is the sum of the impulse response, this mean we can create filters from step responses.
Step response of a moving average.
Step responses are easy to design, you just need a function that start at 0 and end up at 1.
How To Use The Template
All the work is done for you, the only thing you need to do is to enter your function at line 5 :
f(x)=> your function
For example if you want your filter to have a step response equal to sqrt(x) just enter :
f(x)=> sqrt(x)
This will give the following filter output :
You can create custom step responses from online graphing tools like fooplot or wolfram alpha, i recommend fooplot.
You can also design your filter step response from the line 14/15/16, b will be your filter step response, just use a , for example b = pow(a,2) , then replace output in plot by b and use overlay false, you can also plot step , if you like your step response copy the content of b and paste after f(x) => .
Filter Characteristics
The impulse response determine how many of a certain signal you want in your filter, this is also called weighting, you can think of filter design as cooking where your ingredients are the the signal at different periods and the impulse response determine how many of an ingredient you must include in the recipe. The step response can also tell you about your filter characteristics, for example :
This one converge faster to the step function, this mean that the filter will have less lag.
However this one converge slower to the step function, this mean the filter might have more lag but could be smoother.
Be aware that you must find a good weighting balance, else you can have output equals to the signal or just a delayed version of the signal without smoothing.
Real Case
Lets design a sine weighted moving average (swma), this FIR filter use the first 180 degrees of a sine wave function as impulse response.
Impulse response of the swma.
We can design it from the step response without much problems, remember that the impulse response is the derivative of the step response, therefore the derivative of the step response is equal to the first 180 degrees of a sine wave, the derivative of the cosine function is a sine function, therefore :
f(x)=> .5*(1 - cos(x*pi))
And voila.
Designing A BandPass Filter
The bandpass filter like a low-pass and high pass filter, you can think of it as a smooth oscillator.
To design a bandpass filter your step response must be bell shaped, or starting at 0 and ending at 0, for example :
f(x)=>sin(x*pi) give :
Conclusion
Just use fooplot and experiment, you could get nice filters, i will try to post some using this template but it would be really nice to have other people use it. If you need further help pm me.
Thanks for reading !
80/20 14 RSIThe default RSI (14) set up with Pareto (80/20 for overbought and oversold).
The background color is turning green and red as buy & sell signals
8/21/100 EMAsBecause we all want to keep our charts clean, I have saved my EMA's configuration in this script.
Follow the green & red background as the buy / sell signal. Always keep an eye on the EMA 100 too.