utilsLibrary "utils"
Few essentials captured together (subset of arrayutils)
timer(timeStart, endTime)
finds difference between two timestamps
Parameters:
timeStart : start timestamp
endTime : end timestamp
Returns:
check_overflow(pivots, barArray, dir)
finds difference between two timestamps
Parameters:
pivots : pivots array
barArray : pivot bar array
dir : direction for which overflow need to be checked
Returns: bool overflow
get_trend_series(pivots, length, highLow, trend)
finds series of pivots in particular trend
Parameters:
pivots : pivots array
length : length for which trend series need to be checked
highLow : filter pivot high or low
trend : Uptrend or Downtrend
Returns: int trendIndexes
get_trend_series(pivots, firstIndex, lastIndex)
finds series of pivots in particular trend
Parameters:
pivots : pivots array
firstIndex : First index of the series
lastIndex : Last index of the series
Returns: int trendIndexes
getConsolidatedLabel(include, labels, separator)
Consolidates labels into single string by concatenating it with given separator
Parameters:
include : array of conditions to include label or not
labels : string array of labels
separator : Separator for concatenating labels
Returns: string labelText
getColors(theme)
gets array of colors based on theme
Parameters:
theme : dark or light theme
Returns: color themeColors
אינדיקטורים ואסטרטגיות
rzigzagLibrary "rzigzag"
Recursive Zigzag Using Matrix allows to create zigzags recursively on multiple levels. After bit of consideration, decided to make this public.
zigzag(length, ohlc, numberOfPivots, offset)
calculates plain zigzag based on input
Parameters:
length : Zigzag Length
ohlc : Array containing ohlc values. Can also contain custom series
numberOfPivots : Number of max pivots to be returned
offset : Offset from current bar. Can be used for calculations based on confirmed bars
Returns:
nextlevel(zigzagmatrix, numberOfPivots)
calculates next level zigzag based on present zigzag coordinates
Parameters:
zigzagmatrix : Matrix containing zigzag pivots, bars, bar time, direction and level
numberOfPivots : Number of max pivots to be returned
Returns: matrix zigzagmatrix
draw(zigzagmatrix, newPivot, doublePivot, lineColor, lineWidth, lineStyle, showLabel, xloc)
draws zigzag based on the zigzagmatrix input
Parameters:
zigzagmatrix : Matrix containing zigzag pivots, bars, bar time, direction and level
newPivot : Flag indicating there is update in the pivots
doublePivot : Flag containing there is double pivot update on same bar
lineColor : Zigzag line color
lineWidth : Zigzag line width
lineStyle : Zigzag line style
showLabel : Flag to indicate display pivot labels
xloc : xloc preference for drawing lines/labels
Returns:
draw(length, ohlc, numberOfPivots, offset, lineColor, lineWidth, lineStyle, showLabel, xloc)
calculates and draws zigzag based on zigzag length and source input
Parameters:
length : Zigzag Length
ohlc : Array containing ohlc values. Can also contain custom series
numberOfPivots : Number of max pivots to be returned
offset : Offset from current bar. Can be used for calculations based on confirmed bars
lineColor : Zigzag line color
lineWidth : Zigzag line width
lineStyle : Zigzag line style
showLabel : Flag to indicate display pivot labels
xloc : xloc preference for drawing lines/labels
Returns:
drawfresh(zigzagmatrix, zigzaglines, zigzaglabels, lineColor, lineWidth, lineStyle, showLabel, xloc)
draws fresh zigzag for all pivots in the input matrix.
Parameters:
zigzagmatrix : Matrix containing zigzag pivots, bars, bar time, direction and level
zigzaglines : array to which all newly created lines will be added
zigzaglabels : array to which all newly created lables will be added
lineColor : Zigzag line color
lineWidth : Zigzag line width
lineStyle : Zigzag line style
showLabel : Flag to indicate display pivot labels
xloc : xloc preference for drawing lines/labels
Returns:
percentageLibLibrary "percentageLib"
: every thing need anout percentage
getPercentage(entry, exit)
: get percentage change of of two value
Parameters:
entry : : value of entry price
exit : : value of exit price
Returns: : negative or positive value
applyPercentageNoAddUp(price, percentage)
: apply percentage change on value decrease or increase
Parameters:
price : : value of price
percentage : : percentage change can be negative or positive
Returns: : return only positive value
applyPercentageAddUp(price, percentage)
: apply percentage change on value decrease or increase
Parameters:
price : : value of price
percentage : : percentage change can be negative or positive
Returns: : return only positive value
reversePercentage(percentage)
: get percentage (positive or negative) and return the percentage need to back to previous price
Parameters:
percentage : : percentage change can be negative or positive
Returns: : return positive/negative value
@example : reversePercentage(10) =>11.11111111111111111111111 , reversePercentage(10) =>9.0909090909090909
getReversePercentage(price, percentage)
: get two prices and return the percentage need to back to previous price
Parameters:
price : : value of price
percentage : : percentage change can be negative or positive
Returns: : return only positive value
@example : getReversePercentage(100,90) =>11.11111111111111111111111
multipeBarTotalPercentage()
drawcandlesLibrary "drawcandles"
simple utility to draw different candles using box and lines. Quite useful for drawing candles such as zigzag candles or MTF candles
draw(o, h, l, c, oBar, cBar)
draws candles based on ohlc values
Parameters:
o : Open Price
h : High Price
l : Low Price
c : Close Price
oBar : Open Time
cBar : Close Time
Returns: void
HarmonicSwitches█ OVERVIEW
This library is complementary for XABCD Harmonic Pattern Custom Range Interactive
TupleSwitchHL()
: Tuple Switch for High Low
Parameters:
: : _bool, low_X, high_X, low_A, high_A, low_B, high_B, low_C, high_C
Returns: : price_X, price_A, price_B, price_C
TupleSwitchStyleColor()
: Tuple switch for style and color
Parameters:
: : _bool
Returns: : style0, style1, col_dir
TupleSwitchString()
: Tuple switch for string
Parameters:
: : _bool
Returns: : str_dir, str_X, str_A
TupleSwitchValid()
: Tuple switch for valid
Parameters:
: : _str
Returns: : str_invalid, str_valid
TupleSwitchTime()
: Tuple switch for time
Parameters:
: : _str, time_1, time_2, time_3
Returns: : E1, E2
SwitchColor()
: Switch color
Parameters:
: : _str
Returns: : col_valid
SwitchExtend()
: Extend line
Parameters:
: : _str
Returns: : _extend
curveLibrary "curve"
Regression array Creator. Handy for weights, Auto Normalizes array while holding curves.
curve(_size, _power)
Curve Regression Values Tool
Parameters:
_size : (float) Number of Steps required (float works, future consideration)
_power : (float) Strength of value decrease
Returns: (float ) Array of multipliers from 1 downwards to 0.
srcCalcLibrary "srcCalc"
Provides functions for converting input strings 'open','high','low','close','hl2','hlc3','ohlc4','hlcc4' to corresponding source values.
get_src(src)
Converts string to source float value
Parameters:
src : String to use (`close` is used if no argument is supplied).
Returns: Returns the float value of the string
xor logical operatorLibrary "xor"
xor(a, b)
xor: Exclusive or, or exclusive disjunction is a logical operation that is true if and only if its arguments differ (one is true, the other is false).
Parameters:
a : first argument
b : second argument
Returns: returns xor (true only if a and b are true, but not both)
Example:
true xor true = false
true xor false = true
false xor true = true
false xor false = false
CommonMarkupLibrary "CommonMarkup"
Provides functions for chart markup, such as indicating recession bands.
markRecessionBands(showBands, lineY, labelY)
Mark vertical bands and show recession band labels if argument showBands is true. Example "markRecessionBands(bar_index ,3.0"
Parameters:
showBands : - show vertical recession bands when true. Functionally equiv to no op when false
lineY : - y-axis value for line positioning
labelY : - y-axis value for label positioning
@return true - always answers the value of showBands
Object: object oriented programming made possible! Hash map's in Pinescript?? Absolutely
This Library is the first step towards bringing a much needed data structure to the Pine Script community.
"Object" allows Pine coders to finally create objects full or unique key:value pairs, which are converted to strings and stored in an array. Data can be stored and accessed using dedicated get and set methods.
The workflow is simple, but has a few nuances:
0. Import this library into your project; you can give it whatever alias you'd like (I'll be using obj)
1. Create your first object using the obj.new() method and assign it a variable or "ID".
2. Use the object's ID as the first argument into the obj.set() method, for the key and value there's one extra step required. They must be added as arguments to the appropriate prop_() method.
Note: While objects in this library technically only store data as strings, any primitive data type can be converted to a string before being stored, meaning that one object can hold data from multiple types at once. There's a trade off though..Pine Script requires that all exported function parameters have pre-defined types, meaning that as convenient as it would be to have a single method for storing and returning data of every type, it's not currently possible. Instead there are functions to add properties for each individual type, which are then converted to strings automatically (the original type is flagged and stored along with the data). Furthermore, since switch/if statements can only return values of the same type, there must also be "get" methods which correspond with each type. Again, a single "get" method which auto-detects the returned value's type was the goal but it's just not currently possible. Instead each get method is only allowed to return a value of its own type. No worries though, all the "get" methods will throw errors if they can't access the data you're trying to access. In that error message, you'll be informed exactly which "get" method you need to use if you ever lose track of what type of data you should be returning.
3. The second argument for obj.set() method is the obj.prop_() method. You just plug in your key as a string and your value and you're done. Easy as that.
Please do not skip this step, properties must be formatted correctly for data to be stored and accessed correctly
4. Obj.get_ (s: string, f: float, b: bool, i: int) methods are even easier, just choose whichever method will return the data type you need, then plug in your ID, and key and that's it. Objects will output data of the same type they were stored as!
There's a short example at the end of the script if you'd like to see more!
prop_string(string: key, string: value)
returns property formatted to string and flagged as string type
prop_float(string: key, float: value)
returns property formatted to string and flagged as float type
prop_bool(string: key, bool: value)
returns property formatted to string and flagged as bool type
prop_int(string: key, int: value)
returns property formatted to string and flagged as int type
Support for lines and shapes coming soon!
new()
returns an empty object
set(string : ID, string: property)
adds new property to object
get_f(string : ID, string: key)
returns float values
get_s(string : ID, string: key)
returns string values
get_b(string : ID, string: key)
returns boolean values
get_i(string : ID, string: key)
returns int values
More methods like Obj.remove(), Obj.size(), Obj.fromString, Obj.fromArray, Obj.toJSON, Obj.keys, & Obj.values coming very soon!!
arraysLibrary "arrays"
Library contains utility functions using arrays.
delete( arr , index)
remove an item from array at specific index. Also deletes the item
Parameters:
arr: - array from which the item needs to be deleted
index: - index of item to be deleted
Returns: void
pop( arr )
remove the last item from array. Also deletes the item
Parameters:
arr: - array from which the last item needs to be removed and deleted
Returns: void
shift( arr )
remove an item from array at index 0. Also deletes the item
Parameters:
arr: - array from which the first item needs to be removed and deleted
Returns: void
unshift( arr , val, maxItems)
add an item to the beginning of an array with max items cap
Parameters:
arr: - array to which the item needs to be added at the beginning
val: - value of item which needs to be added
maxItems: - max items array can hold. After that, items are removed from the other end
Returns: resulting array
clear( arr )
remove and delete all items in an array
Parameters:
arr: - array which needs to be cleared
Returns: void
push( arr , val, maxItems)
add an item to the end of an array with max items cap
Parameters:
arr: - array to which the item needs to be added at the beginning
val: - value of item which needs to be added
maxItems: - max items array can hold. After that, items are removed from the starting index
Returns: resulting array
HarmonicCalculation█ OVERVIEW
This library is complementary for XABCD Harmonic Pattern Custom Range Interactive
PriceDiff()
: Price Difference
Parameters:
: : price_1, price_2
Returns: : PriceDiff
TimeDiff()
: Time Difference
Parameters:
: : time_1, time_2
Returns: : TimeDiff
ReturnIndexOf3Arrays()
: Return Index Of 3 Arrays
Parameters:
: : id1, id2, id3, _int
Returns: : ReturnIndexOf3Arrays
AbsoluteRange()
: Price Difference
Parameters:
: : price, y, point
Returns: : AbsoluteRange
PriceAverage()
: To calculate average of 2 prices
Parameters:
: : price_1, price_2
Returns: : PriceAverage
TimeAverage()
: To calculate average of 2 times
Parameters:
: : time_1, time_2
Returns: : TimeAverage
StringBool()
: To show ratio in 3 decimals format
Parameters:
: : _value, _bool, _text
Returns: : StringBool
PricePercent()
: To show Price in percent format
Parameters:
: : _price, PriceRef, str_dir
Returns: : PricePercent
BoolCurrency()
: To show syminfo.currency
Parameters:
: : _bool
Returns: : BoolCurrency
RatioText()
: To show RatioText in 3 decimals format
Parameters:
: : _value, _text
Returns: : RatioText
RangeText()
: To display RangeText in Harmonic Range Format
Parameters:
: : _id1, _id2, _int, _text
Returns: : RangeText
PriceCurrency()
: To show Currency in Price Format
Parameters:
: : _bool, _value
Returns: : PriceCurrency
HarmonicDB█ OVERVIEW
This library was to showcase database for specifications of Harmonic Patterns using arrays.
█ CREDITS
Scott M Carney, author of Harmonic Trading : Volume Three
animal_db(x)
TODO: export animal_db
Parameters:
x : TODO: float value is set to default if not necessary
Returns: TODO:
DeleteArrayObject█ OVERVIEW
Delete array object according to array size such as label, line, linefill, box and table.
█ CREDITS
HeWhoMustNotBeNamed
PriceTimeInteractive█ OVERVIEW
This library was intended to Get price of given time.input
█ CREDITS
Credits to TradingView for CAGR Custom Range.
█ FUNCTIONS
ohlc_time()
: Get OHLC price of given time.input
Parameters:
: : Time (t) must be using time.input
Returns: : OHLC
hlc_time()
: Get HLC price of given time.input
Parameters:
: : Time (t) must be using time.input
Returns: : HLC
hl_time()
: Get HL price of given time.input
Parameters:
: : Time (t) must be using time.input
Returns: : HL
AdxlLibrary "Adxl"
Functions to calculate the Average Directional Index
getDirectionUp(bar, lookback)
Bar high changed from open for bar
Parameters:
bar : series int The bar to calculate at
lookback : series int The lookback period
Returns: series float
getDirectionDown(bar, lookback)
Bar low changed from open for bar
Parameters:
bar : series int The bar to calculate at
lookback : series int The lookback period
Returns: series float
getPositiveDirectionalMovement(bar, lookback)
Positive directional movement for bar during lookback
Parameters:
bar : series int The bar to calculate at
lookback : series int The lookback period
Returns: series float
getNegativeDirectionalMovement(bar, lookback)
Negative directional movement for bar during lookback
Parameters:
bar : series int The bar to calculate at
lookback : series int The lookback period
Returns: series float
getTrueRangeMovingAverage(bar, lookback)
True range moving average for bar during lookback
Parameters:
bar : series int The bar to calculate at
lookback : simple int The lookback period
Returns: series int
getDirectionUpIndex(bar, lookback)
Direction up index for bar during lookback
Parameters:
bar : series int The bar to calculate at
lookback : simple int The lookback period
Returns: series int
getDirectionDownIndex(bar, lookback)
Direction down index for bar during lookback
Parameters:
bar : series int The bar to calculate at
lookback : simple int The lookback period
Returns: series int
getTotalDirectionIndex(bar, lookback)
Total direction index for bar during lookback
Parameters:
bar : series int The bar to calculate at
lookback : simple int The lookback period
Returns: series int
getAverageDirectionalIndex(bar, lookback)
Average Directional Index (ADX) for bar during lookback
Parameters:
bar : series int The bar to calculate at
lookback : simple int The lookback period
Returns: series int
Heikin Ashi CandlesLibrary "heikin_ashi_candles"
This library is programmed to calculate the Heikin Ashi candles using the standard formula of Heikin Ashi Candles.
Notice the Heikin Ashi chart type isn't 100% like the results from this calculation.
You can import this library in your code to use it as a smoothing method for your strategy which operates on the standard chart type.
_close()
_open()
_high()
_low()
_ohlc4()
_hlcc4()
_hlc3()
_hl2()
CalculatePercentageSlTpLibrary "CalculatePercentageSlTp"
This Library calculate the sl and tp amount in percentage
sl_percentage(entry_price, sl_price)
this function calculates the sl value in percentage
Parameters:
entry_price : indicates the entry level
sl_price : indicates the stop loss level
Returns: stop loss in percentage
tp_percentage(entry_price, tp_price)
this function calculates the tp value in percentage
Parameters:
entry_price : indicates the entry level
tp_price : indicates the take profit level
Returns: take profit in percentage
sl_level(entry_price, sl_percentage)
this function calculates the sl level price
Parameters:
entry_price : indicates the entry level
sl_percentage : indicates the stop loss percentage
Returns: stop loss price in $
tp_level(entry_price, tp_percentage)
this function calculates the tp level price
Parameters:
entry_price : indicates the entry level
tp_percentage : indicates the take profit percentage
Returns: take profit price in $
AdxCalcHourlyLibrary "AdxCalcHourly"
getBars()
getBars: Returns the number of bars to use in the historical lookback period
Returns: simple int
directionDown()
directionDown: Calculates the direction down for bar_index
Returns: series float
directionUp()
directionUp: Calculates the direction up for bar_index
Returns: series float
trueRangeMovingAverage()
trueRangeMovingAverage: Calculates the true range moving average over the historical lookback period
Returns: series float
positiveDirectionalMovement()
positiveDirectionalMovement: Calculates the positive direction movement for bar_index
Returns: series float
negativeDirectionalMovement()
negativeDirectionalMovement: Calculates the begative direction movement for bar_index
Returns: series float
totalDirectionDown()
totalDirectionDown: Calculates the total direction down for the historical lookback period
Returns: series float
totalDirectionUp()
totalDirectionUp: Calculates the total direction up for the historical lookback period
Returns: series float
totalDirection()
totalDirection: Calculates the total direction movement for the historical lookback period
Returns: series float
averageDirectionalIndex()
averageDirectionalIndex: Calculates the average directional index (ADX) based on the trend for the historical lookback period
Returns: series float
getAdxHistoricalAverage()
getAdxHistoricalAverage: Calculates the average directional index (ADX) for the historical lookback period
Returns: series float
getAdxHistoricalHigh()
getAdxHistoricalHigh: Calculates the historical high of the directional index (ADX) for the historical lookback period
Returns: series float
getAdxHistoricalLow()
getAdxHistoricalLow: Calculates the historical low of the directional index (ADX) for the historical lookback period
Returns: series float
getAdxOpinion()
getAdxOpinion: Calculatesa recomendation for the directional index (ADX) based on the historical lookback period
Returns: series float
"Swap" - Bool/Position/Value : Array / Matrix / Var AutoswapLibrary "swap"
Side / Boundary Based All Types Swapper
- three automagical types for Arrays, Matrixes, and Variables
-- no signal : Long/ Short position autoswap
-- true / false : Boolean based side choice
-- Src / Thresh : if source is above or below the threshold
- two operating modes for variables, Holding mode only for arrays/matrixes
-- with two items, will automatically change between the two caveat is it does not delete table/box/line(fill VAR items automatically)
-- with three items, a neutral is available for NA input or neutral
- one function name for all of them. One import name that's easy to type/remember
-- make life easy for your conditional items.
side(source, thresh, _a, _b, _c)
side Change outputs based on position or a crossing level
Parameters:
source : (float) OPTIONAL value input
thresh : (float) OPTIONAL boundary line to cross
_a : (any) if Long/True/Above
_b : (any) if Short/False/Below
_c : (any) OPTIONAL NOT FOR MTX OR ARR... Neutral Item, if var/varip on a/b it will leave behind, ie, a table or box or line will not erase , if it's a varip you're sending in.
Returns: first, second, or third items based on input conditions
Please notify if bugs found.
Thanks.
RouterOrdersIronLibrary "RouterOrdersIron"
Library for routing orders to the Binance exchange.
MsgDoLongMKT(id, symbol, balance)
Returns json for Iron to buy a symbol for the amount of the balance with market order.
Parameters:
id : ID of your Iron router.
symbol : Symbol for a trade, BTC example
balance : The amount for which to carry out the transaction.
Returns: true
MsgDoShortMKT(id, symbol, balance)
Returns json for Iron to sell a symbol for the amount of the balance with market order.
Parameters:
id : ID of your Iron router.
symbol : Symbol for a trade, BTC example
balance : The amount for which to carry out the transaction.
Returns: true
MsgDoLongLR(id, symbol, balance)
Returns json for Iron to buy a symbol for the amount of the balance. It is set at the best price and is re-set each time if a new price has risen before the application.
Parameters:
id : ID of your Iron router.
symbol : Symbol for a trade, BTC example
balance : The amount for which to carry out the transaction.
Returns: true
MsgDoShortLR(id, symbol, balance)
Returns json for Iron to sell a symbol for the amount of the balance. It is set at the best price and is re-set each time if a new price has risen before the application.
Parameters:
id : ID of your Iron router.
symbol : Symbol for a trade, BTC example
balance : The amount for which to carry out the transaction.
Returns: true
DoLongMKT(id, symbol, balance)
Buy a symbol for the amount of the balance. It is send market order to Iron.
Parameters:
id : ID of your Iron router.
symbol : Symbol for a trade, BTC example
balance : The amount for which to carry out the transaction.
Returns: true
DoShortMKT(id, symbol, balance)
Sell a symbol for the amount of the balance. It is send market order to Iron.
Parameters:
id : ID of your Iron router.
symbol : Symbol for a trade, BTC example
balance : The amount for which to carry out the transaction.
Returns: true
DoLongLR(id, symbol, balance)
Buy a symbol for the amount of the balance. It is set at the best price and is re-set each time if a new price has risen before the application.
Parameters:
id : ID of your Iron router.
symbol : Symbol for a trade, BTC example
balance : The amount for which to carry out the transaction.
Returns: true
DoShortLR(id, symbol, balance)
Sell a symbol for the amount of the balance. It is set at the best price and is re-set each time if a new price has risen before the application.
Parameters:
id : ID of your Iron router.
symbol : Symbol for a trade, BTC example
balance : The amount for which to carry out the transaction.
Returns: true
GetQty(price, balance)
Get Qty for strategy on balance
Parameters:
price : Order price
balance : The amount for which to carry out the transaction.
Returns: Qty for strategy order TV
Moving_AveragesLibrary "Moving_Averages"
This library contains majority important moving average functions with int series support. Which means that they can be used with variable length input. For conventional use, please use tradingview built-in ta functions for moving averages as they are more precise. I'll use functions in this library for my other scripts with dynamic length inputs.
ema(src, len)
Exponential Moving Average (EMA)
Parameters:
src : Source
len : Period
Returns: Exponential Moving Average with Series Int Support (EMA)
alma(src, len, a_offset, a_sigma)
Arnaud Legoux Moving Average (ALMA)
Parameters:
src : Source
len : Period
a_offset : Arnaud Legoux offset
a_sigma : Arnaud Legoux sigma
Returns: Arnaud Legoux Moving Average (ALMA)
covwema(src, len)
Coefficient of Variation Weighted Exponential Moving Average (COVWEMA)
Parameters:
src : Source
len : Period
Returns: Coefficient of Variation Weighted Exponential Moving Average (COVWEMA)
covwma(src, len)
Coefficient of Variation Weighted Moving Average (COVWMA)
Parameters:
src : Source
len : Period
Returns: Coefficient of Variation Weighted Moving Average (COVWMA)
dema(src, len)
DEMA - Double Exponential Moving Average
Parameters:
src : Source
len : Period
Returns: DEMA - Double Exponential Moving Average
edsma(src, len, ssfLength, ssfPoles)
EDSMA - Ehlers Deviation Scaled Moving Average
Parameters:
src : Source
len : Period
ssfLength : EDSMA - Super Smoother Filter Length
ssfPoles : EDSMA - Super Smoother Filter Poles
Returns: Ehlers Deviation Scaled Moving Average (EDSMA)
eframa(src, len, FC, SC)
Ehlrs Modified Fractal Adaptive Moving Average (EFRAMA)
Parameters:
src : Source
len : Period
FC : Lower Shift Limit for Ehlrs Modified Fractal Adaptive Moving Average
SC : Upper Shift Limit for Ehlrs Modified Fractal Adaptive Moving Average
Returns: Ehlrs Modified Fractal Adaptive Moving Average (EFRAMA)
ehma(src, len)
EHMA - Exponential Hull Moving Average
Parameters:
src : Source
len : Period
Returns: Exponential Hull Moving Average (EHMA)
etma(src, len)
Exponential Triangular Moving Average (ETMA)
Parameters:
src : Source
len : Period
Returns: Exponential Triangular Moving Average (ETMA)
frama(src, len)
Fractal Adaptive Moving Average (FRAMA)
Parameters:
src : Source
len : Period
Returns: Fractal Adaptive Moving Average (FRAMA)
hma(src, len)
HMA - Hull Moving Average
Parameters:
src : Source
len : Period
Returns: Hull Moving Average (HMA)
jma(src, len, jurik_phase, jurik_power)
Jurik Moving Average - JMA
Parameters:
src : Source
len : Period
jurik_phase : Jurik (JMA) Only - Phase
jurik_power : Jurik (JMA) Only - Power
Returns: Jurik Moving Average (JMA)
kama(src, len, k_fastLength, k_slowLength)
Kaufman's Adaptive Moving Average (KAMA)
Parameters:
src : Source
len : Period
k_fastLength : Number of periods for the fastest exponential moving average
k_slowLength : Number of periods for the slowest exponential moving average
Returns: Kaufman's Adaptive Moving Average (KAMA)
kijun(_high, _low, len, kidiv)
Kijun v2
Parameters:
_high : High value of bar
_low : Low value of bar
len : Period
kidiv : Kijun MOD Divider
Returns: Kijun v2
lsma(src, len, offset)
LSMA/LRC - Least Squares Moving Average / Linear Regression Curve
Parameters:
src : Source
len : Period
offset : Offset
Returns: Least Squares Moving Average (LSMA)/ Linear Regression Curve (LRC)
mf(src, len, beta, feedback, z)
MF - Modular Filter
Parameters:
src : Source
len : Period
beta : Modular Filter, General Filter Only - Beta
feedback : Modular Filter Only - Feedback
z : Modular Filter Only - Feedback Weighting
Returns: Modular Filter (MF)
rma(src, len)
RMA - RSI Moving average
Parameters:
src : Source
len : Period
Returns: RSI Moving average (RMA)
sma(src, len)
SMA - Simple Moving Average
Parameters:
src : Source
len : Period
Returns: Simple Moving Average (SMA)
smma(src, len)
Smoothed Moving Average (SMMA)
Parameters:
src : Source
len : Period
Returns: Smoothed Moving Average (SMMA)
stma(src, len)
Simple Triangular Moving Average (STMA)
Parameters:
src : Source
len : Period
Returns: Simple Triangular Moving Average (STMA)
tema(src, len)
TEMA - Triple Exponential Moving Average
Parameters:
src : Source
len : Period
Returns: Triple Exponential Moving Average (TEMA)
thma(src, len)
THMA - Triple Hull Moving Average
Parameters:
src : Source
len : Period
Returns: Triple Hull Moving Average (THMA)
vama(src, len, volatility_lookback)
VAMA - Volatility Adjusted Moving Average
Parameters:
src : Source
len : Period
volatility_lookback : Volatility lookback length
Returns: Volatility Adjusted Moving Average (VAMA)
vidya(src, len)
Variable Index Dynamic Average (VIDYA)
Parameters:
src : Source
len : Period
Returns: Variable Index Dynamic Average (VIDYA)
vwma(src, len)
Volume-Weighted Moving Average (VWMA)
Parameters:
src : Source
len : Period
Returns: Volume-Weighted Moving Average (VWMA)
wma(src, len)
WMA - Weighted Moving Average
Parameters:
src : Source
len : Period
Returns: Weighted Moving Average (WMA)
zema(src, len)
Zero-Lag Exponential Moving Average (ZEMA)
Parameters:
src : Source
len : Period
Returns: Zero-Lag Exponential Moving Average (ZEMA)
zsma(src, len)
Zero-Lag Simple Moving Average (ZSMA)
Parameters:
src : Source
len : Period
Returns: Zero-Lag Simple Moving Average (ZSMA)
evwma(src, len)
EVWMA - Elastic Volume Weighted Moving Average
Parameters:
src : Source
len : Period
Returns: Elastic Volume Weighted Moving Average (EVWMA)
tt3(src, len, a1_t3)
Tillson T3
Parameters:
src : Source
len : Period
a1_t3 : Tillson T3 Volume Factor
Returns: Tillson T3
gma(src, len)
GMA - Geometric Moving Average
Parameters:
src : Source
len : Period
Returns: Geometric Moving Average (GMA)
wwma(src, len)
WWMA - Welles Wilder Moving Average
Parameters:
src : Source
len : Period
Returns: Welles Wilder Moving Average (WWMA)
ama(src, _high, _low, len, ama_f_length, ama_s_length)
AMA - Adjusted Moving Average
Parameters:
src : Source
_high : High value of bar
_low : Low value of bar
len : Period
ama_f_length : Fast EMA Length
ama_s_length : Slow EMA Length
Returns: Adjusted Moving Average (AMA)
cma(src, len)
Corrective Moving average (CMA)
Parameters:
src : Source
len : Period
Returns: Corrective Moving average (CMA)
gmma(src, len)
Geometric Mean Moving Average (GMMA)
Parameters:
src : Source
len : Period
Returns: Geometric Mean Moving Average (GMMA)
ealf(src, len, LAPercLen_, FPerc_)
Ehler's Adaptive Laguerre filter (EALF)
Parameters:
src : Source
len : Period
LAPercLen_ : Median Length
FPerc_ : Median Percentage
Returns: Ehler's Adaptive Laguerre filter (EALF)
elf(src, len, LAPercLen_, FPerc_)
ELF - Ehler's Laguerre filter
Parameters:
src : Source
len : Period
LAPercLen_ : Median Length
FPerc_ : Median Percentage
Returns: Ehler's Laguerre Filter (ELF)
edma(src, len)
Exponentially Deviating Moving Average (MZ EDMA)
Parameters:
src : Source
len : Period
Returns: Exponentially Deviating Moving Average (MZ EDMA)
pnr(src, len, rank_inter_Perc_)
PNR - percentile nearest rank
Parameters:
src : Source
len : Period
rank_inter_Perc_ : Rank and Interpolation Percentage
Returns: Percentile Nearest Rank (PNR)
pli(src, len, rank_inter_Perc_)
PLI - Percentile Linear Interpolation
Parameters:
src : Source
len : Period
rank_inter_Perc_ : Rank and Interpolation Percentage
Returns: Percentile Linear Interpolation (PLI)
rema(src, len)
Range EMA (REMA)
Parameters:
src : Source
len : Period
Returns: Range EMA (REMA)
sw_ma(src, len)
Sine-Weighted Moving Average (SW-MA)
Parameters:
src : Source
len : Period
Returns: Sine-Weighted Moving Average (SW-MA)
vwap(src, len)
Volume Weighted Average Price (VWAP)
Parameters:
src : Source
len : Period
Returns: Volume Weighted Average Price (VWAP)
mama(src, len)
MAMA - MESA Adaptive Moving Average
Parameters:
src : Source
len : Period
Returns: MESA Adaptive Moving Average (MAMA)
fama(src, len)
FAMA - Following Adaptive Moving Average
Parameters:
src : Source
len : Period
Returns: Following Adaptive Moving Average (FAMA)
hkama(src, len)
HKAMA - Hilbert based Kaufman's Adaptive Moving Average
Parameters:
src : Source
len : Period
Returns: Hilbert based Kaufman's Adaptive Moving Average (HKAMA)
bullratioLibrary "bullratio"
Calculate the profit/loss ratio of a permabull for configurable time range
bullratio(len)
calculates the profit/loss ratio for a permabull of age len
Parameters:
len : the number of candles to include in the running bull ratio - 0 for all time
Returns: series float of profit/loss percentage