Demand IndexLibrary "DemandIndex"
di()
The Demand Index is a complex technical indicator that uses price and volume to assess buying and selling pressure affecting a security.
James Sibbet established six rules for using Demand Index when the technical indicator was originally published. While traders may use variations of these rules, they serve as a great baseline for using the indicator in practice.
The six rules are as follows:
A divergence between the Demand Index and price is a bearish indication.
Prices often rally to new highs following an extreme peak in the Demand Index.
Higher prices with a low Demand Index often indicate a top in the market.
The Demand Index moving through the zero line suggests a change in trend.
The Demand Index remaining near the zero line indicates weak price movement that won’t last long.
A long-term divergence between the Demand Index and price predicts a major top or bottom.
Traders should use the Demand Index in conjunction with other technical indicators and chart patterns to maximize their odds of success.
Indicators and strategies
myAutoviewAlertsLibrary "myAutoviewAlerts"
My Alerts Functions - To use with autoview
@returns - These functions returns a string to use in alerts to send commands to autoview. You can open an order, place a stop or take order, close an opened order or a opened position, or open a hedge position.
@param a = String - Account Identification
@param e = String - Exchange
@param s = String - Symbol
@param b = String - Book Side
@param q = Float - Quantity
@param fp = Float - Fixed Price
@param delay = Integer - In Seconds
@param i = Integer - Account Index (to multiple accounts allerts)
@param base = String - Base Currency (bitmex) - "Tether" or "Bitcoin"
@param fsl = Float - Stop Loss Limit Price
@param c = String - Close -> "order" or "position"
@param ro = Bool - Reduce Only
@param sl = Bool - Stop Loss -> bitfinex
@param t = String - Type -> "market" or "limit"
@function f_order => Open Orders
@function f_stop => Set Stop Loss Order
@function f_take => Set Take Order
@function f_closeOrder => Close Open Orders
@function f_closePosition => Close Open Positions
@function f_hedge => To Open a Hedge Position (short 100% of balance)
AllTimeHighLowLibrary "AllTimeHighLow"
Provides functions calculating the all-time high/low of values.
hi(val)
Calculates the all-time high of a series.
Parameters:
val : Series to use (`high` is used if no argument is supplied).
Returns: The all-time high for the series.
lo(val)
Calculates the all-time low of a series.
Parameters:
val : Series to use (`low` is used if no argument is supplied).
Returns: The all-time low for the series.
L_BetaLibrary "L_Beta"
TODO: add library description here
length()
beta()
simple_beta()
index_selector()
L_Index_4khansoloLibrary "L_Index_4khansolo"
countrySelect()
colorPositron()
indexName()
indexRSI()
maRSI()
colorRSIfull()
rsiColor()
rsiFillColor()
rsiCompartments()
fiatIndexer()
colorMACD()
indexMACD()
colour()
CalulateWinLossLibrary "CalulateWinLoss"
TODO: add library description here
colorwhitered(x)
TODO: add function description here
Parameters:
x : TODO: add parameter x description here
Returns: TODO: add what function returns
colorredwhite()
cal()
myAlertsLibrary "myAlerts"
My Alerts Functions - To use with autoview
f_order(_price, _qty, _position, _account, _exchange, _i, i_qtyTypeOrder, typeMsg, syminfoticker)
- Write the entry order message
Parameters:
_price : - The order price
_qty : - The order quantity
_position : - The order side
_account : - The user account
_exchange : - The user exchange
_i : - Used for multi-accounts, this represents the index of accounts
i_qtyTypeOrder : - String used to set Thether or Bitcoin Type Orders
typeMsg : - True = Autoview; False = Metatrader
syminfoticker : - Ticker
Returns: - Returns the open order message
f_stop(_stop_price, _slLimit_price, _account, _exchange, _i, i_delayOrders, typeMsg, syminfoticker)
- Write the stop order message
Parameters:
_stop_price : - The order stop price
_slLimit_price : - The order stop limit price
_account : - The user account
_exchange : - The user exchange
_i : - Used for multi-accounts, this represents the index of accounts
i_delayOrders : - Time in seconds to delay command on autoview
typeMsg : - True = Autoview; False = Metatrader
syminfoticker : - Ticker
Returns: - Returns the open order message
f_take(_take_price, _account, _exchange, _i, i_delayOrders, typeMsg, syminfoticker)
- Write the stop order message
Parameters:
_take_price : - The order stop price
_account : - The user account
_exchange : - The user exchange
_i : - Used for multi-accounts, this represents the index of accounts
i_delayOrders : - Time in seconds to delay command on autoview
typeMsg : - True = Autoview; False = Metatrader
syminfoticker : - Ticker
Returns: - Returns the open order message
f_update(_account, _exchange, _i, i_delayOrders, typeMsg, syminfoticker)
- Write the update order message
Parameters:
_account : - The user account
_exchange : - The user exchange
_i : - Used for multi-accounts, this represents the index of accounts
i_delayOrders : - Time in seconds to delay command on autoview
typeMsg : - True = Autoview; False = Metatrader
syminfoticker : - Ticker
Returns: - Returns the open order message
f_exit(_account, _exchange, _i, i_delayOrders, typeMsg, syminfoticker)
- Write the exit order message
Parameters:
_account : - The user account
_exchange : - The user exchange
_i : - Used for multi-accounts, this represents the index of accounts
i_delayOrders : - Time in seconds to delay command on autoview
typeMsg : - True = Autoview; False = Metatrader
syminfoticker : - Ticker
Returns: - Returns the open order message
f_hedge(_account, _exchange, _i, i_delayOrders, typeMsg, syminfoticker)
- Write the exit order message
Parameters:
_account : - The user account
_exchange : - The user exchange
_i : - Used for multi-accounts, this represents the index of accounts
i_delayOrders : - Time in seconds to delay command on autoview
typeMsg : - True = Autoview; False = Metatrader
syminfoticker : - Ticker
Returns: - Returns the open order message
FunctionLAPACKdsyrkLibrary "FunctionLAPACKdsyrk"
subroutine part of LAPACK: Linear Algebra Package,
performs one of the symmetric rank k operations
.
C := alpha*A*A**T + beta*C, or C := alpha*A**T*A + beta*C,
.
where alpha and beta are scalars, C is an n by n symmetric matrix
and A is an n by k matrix in the first case and a k by n matrix
in the second case.
.
reference:
netlib.org
dsyrk(uplo, trans, n, k, alpha, a, lda, beta, c, ldc)
performs one of the symmetric rank k operations
.
C := alpha*A*A**T + beta*C, or C := alpha*A**T*A + beta*C,
.
where alpha and beta are scalars, C is an n by n symmetric matrix
and A is an n by k matrix in the first case and a k by n matrix
in the second case.
.
Parameters:
uplo : string specifies whether the upper or lower triangular part of
the array C is to be referenced as follows:
UPLO = 'U' or 'u' Only the upper triangular part of C is to be referenced.
UPLO = 'L' or 'l' Only the lower triangular part of C is to be referenced.
.
trans : string specifies the operation to be performed as follows:
TRANS = 'N' or 'n' C := alpha*A*A**T + beta*C.
TRANS = 'T' or 't' C := alpha*A**T*A + beta*C.
TRANS = 'C' or 'c' C := alpha*A**T*A + beta*C.
.
n : int specifies the order of the matrix C. N must be at least zero.
k : int On entry with:
TRANS = 'N' or 'n', K specifies the number of columns of the matrix A.
TRANS = 'T' or 't' or 'C' or 'c', K specifies the number of rows of the matrix A.
K must be at least zero.
.
alpha : float scalar.
a : matrix matrix A.
lda : int specifies the first dimension of A.
beta : float scalar.
c : matrix matrix C, is overwritten by the lower triangular part of the updated matrix.
ldc : int specifies the first dimension of C
Returns: void, C is overwritten by the lower triangular part of the updated matrix.
FunctionLAPACKdtrsmLibrary "FunctionLAPACKdtrsm"
subroutine in the LAPACK:linear algebra package, used to solve one of the following matrix equations:
op( A )*X = alpha*B, or X*op( A ) = alpha*B,
where alpha is a scalar, X and B are m by n matrices, A is a unit, or
non-unit, upper or lower triangular matrix and op( A ) is one of
op( A ) = A or op( A ) = A**T.
The matrix X is overwritten on B.
reference:
netlib.org
dtrsm(side, uplo, transa, diag, m, n, alpha, a, lda, b, ldb)
solves one of the matrix equations
op( A )*X = alpha*B, or X*op( A ) = alpha*B,
where alpha is a scalar, X and B are m by n matrices, A is a unit, or
non-unit, upper or lower triangular matrix and op( A ) is one of
op( A ) = A or op( A ) = A**T.
The matrix X is overwritten on B.
Parameters:
side : string , On entry, SIDE specifies whether op( A ) appears on the left or right of X as follows:
SIDE = 'L' or 'l' op( A )*X = alpha*B.
SIDE = 'R' or 'r' X*op( A ) = alpha*B.
uplo : string , specifies whether the matrix A is an upper or lower triangular matrix as follows:
UPLO = 'U' or 'u' A is an upper triangular matrix.
UPLO = 'L' or 'l' A is a lower triangular matrix.
transa : string , specifies the form of op( A ) to be used in the matrix multiplication as follows:
TRANSA = 'N' or 'n' op( A ) = A.
TRANSA = 'T' or 't' op( A ) = A**T.
TRANSA = 'C' or 'c' op( A ) = A**T.
diag : string , specifies whether or not A is unit triangular as follows:
DIAG = 'U' or 'u' A is assumed to be unit triangular.
DIAG = 'N' or 'n' A is not assumed to be unit triangular.
m : int , the number of rows of B. M must be at least zero.
n : int , the number of columns of B. N must be at least zero.
alpha : float , specifies the scalar alpha. When alpha is zero then A is not referenced and B need not be set before entry.
a : matrix, Triangular matrix.
lda : int , specifies the first dimension of A.
b : matrix, right-hand side matrix B, and on exit is overwritten by the solution matrix X.
ldb : int , specifies the first dimension of B.
Returns: void, modifies matrix b.
usage:
dtrsm ('L', 'U', 'N', 'N', 5, 3, 1.0, a, 7, b, 6)
BoxLine_LibLibrary "BoxLine_Lib"
personal Library for line and box built in functions
lineXY(x)
get x1,y1,x2,y2 in a tuple
Parameters:
x : TODO: line
Returns: tuple of x1,y1,x2,y2
line(x)
Create line with only the y1 value(when line == na) or all
when line != na set x1,y1,x2,y2 individually just 1 or all
- use just the line value to set the x2 to current bar or time will set to time
- will auto pick xloc.bar_index or xloc.bar_time if not used
Parameters:
x : (line line,int x1,float y1,int x2,float y2,
string xloc,string extend,color color,string style,int width)
Returns: Line
boxXY(x)
get left,top,right,bottom in a tuple
Parameters:
x : box
Returns: tuple of left,top,right,bottom
box(x)
Create line with only the top,bottom value(when line == na) or all
when box != na set left,top,right,bottom individually just 1 or all
- use just the box value to set the right to current bar or time will set to time
- if right is above a number that a bar_index wouldnt be
Parameters:
x : box box,int left,float top,int right,
float bottom,color border_color, int border_width,
string border_style,string extend,string xloc,
color bgcolor,string text,string text_size, color text_color,
string text_halign,string text_valign,string text_wrap)
Returns: TODO: Box
VonnyPublicLibraryLibrary "VonnyPublicLibrary"
A collection functions commonly used within my scripts
EntryBull(float, float)
Calculate when a bullish condition occurs. (When you have two variables)
Parameters:
float : Enter first variable
float : Enter second variable
Returns: True the first bar of your bullish condition
EntryBear(float, float)
Calculate when a bearish condition occurs. (When you have two variables)
Parameters:
float : Enter first variable
float : Enter second variable
Returns: True the first bar of your bearish condition
LowestPivot(bool, bool, bool, float, float)
Calculate the low of your bearish condition
Parameters:
bool : bullish condition
bool : bearish condition
bool : candle buffer to prevent the script from crashing. Since were working with a Dynamic Length
float : Enter what you want to see the low off? Low of the bar OR Close of the bar
float : Enter what you want to see the low off? Low of the bar OR Open of the bar..... might seem pointless but some times the Lowest open is lower then the Lowest Close
Returns: Lowest point of your sell condition when ever your buy condition is triggered
HighestPivot(bool, bool, bool, float, float)
Calculate the high of your bullish condition
Parameters:
bool : bullish condition
bool : bearish condition
bool : candle buffer to prevent the script from crashing. Since were working with a Dynamic Length
float : Enter what you want to see the high off? High of the bar OR Close of the bar
float : Enter what you want to see the high off? High of the bar OR Open of the bar..... might seem pointless but some times the Highest open is Higher then the Highest Close
Returns: Highest point of your buy condition when ever your sell condition is triggered
lookBack(bool, bool)
Calculate how many bars since your bullish condition and bearish condition.
Parameters:
bool : enter bullish condition
bool : enter bearish condition
Returns: How many bars elapsed since the most recent condition. Bullish or bearish
DegreeALineLibrary "DegreeALine"
TODO: add library description here
Degree(x1, y1, x2, y2)
TODO: add function description here
Parameters:
x1 : First X coordinate of a line, index of the bar where the line starts.
y1 : First Y coordinate of a line, price on the price scale.
x2 : Second X coordinate of a line, index of the bar where the line ends.
y2 : Second Y coordinate of a line, price on the price scale.
Returns: Degree Of Line
MYX_ACE_DBLibrary "MYX_ACE_DB"
TODO: Library for Malaysia ACE Market
db(x)
TODO: Library for Malaysia ACE Market
Parameters:
x : TODO: id
Returns: TODO: id
MYX_LEAP_DBLibrary "MYX_LEAP_DB"
TODO: Library for Malaysia LEAP Market
db(x)
TODO: Library for Malaysia LEAP Market
Parameters:
x : TODO: id
Returns: TODO: id
LibBacktestingDayRangeLibrary "LibBacktestingDayRange"
TODO: add library description here
import Nut_Satit/CalulateWinLoss/version as backtest
rangdate(startDate, finishDate)
TODO: add function description here
Parameters:
startDate : TODO: add parameter startDate description here
finishDate : TODO: add parameter finishDate description here
Returns: TODO: add what function returns
time_cond : TODO: insert variable and buy or sell condition
lib_hlmLibrary "lib_hlm"
Ichimoku trend line and plotting tools.
HLM(Period)
Optionless Ichimoku/Donchian trend line calculation.
Parameters:
Period : The period for the trend line calculation.
Returns: The midpoint of the highest high and the lowest low.
HLM_Offset(offset, currentIsZero, intoPast)
Standardized language for plotting offsets.
Parameters:
offset : The offset number to use.
currentIsZero : `true` for ichimoku counting. `false` for natural language
intoPast : `true` if projecting backwards. `false` if projecting forwards.
Returns: The offset adjusted by counting style and direction.
TK()
Calculates the Ichimoku Tenkan and Kijun lines.
Returns: {tenkan, kijun}
SenkouSpans(period_1, period_2, period_3)
Calculates the Ichimoku Senkou Span A and Senkou Span B values.
Parameters:
period_1 : default=9
period_2 : default=26
period_3 : default=52
Returns: {senkou_a, senkou_b}
Ichimoku_Cloud(period_1, period_2, period_3)
Calculate the Ichimoku cloud value and offsets.
Parameters:
period_1 : default=9
period_2 : default=26
period_3 : default=52
Returns: {senkou_a, senkou_b, cloud_offset}
Chikou_Span()
Gets the chikou span and offsets.
Returns: {chikou, chikou_offset}
Ichimoku(enabled)
Get the values for the full, default Ichimoku system, including plotting offsets. Common toggle for all values.
Parameters:
enabled : `true` will return plottable values. `false` will return only na's (turns off plotting).
Returns: {tenkan, kijun, senkou_a, senkou_b, cloud_offset, chikou, chikou_offset}
Ichimoku_Line_Colors()
Get a set of colors with a common transparency for Ichimoku.
Returns: {tenkan_color, kijun_color, senkou_a_color, senkou_b_color, chikou_color}
Ichimoku_Cloud_Color()
Determines the cloud color and applies transparency (Ichimoku).
Returns: the dominant lines color with applied transparency
Ichimoku_Colors()
Gets a full set of default ichimoku colors with cloud color based on the input senkou values.
Returns: {tenkan_color, kijun_color, senkou_a_color, senkou_b_color, chikou_color, cloud_color}
SAT_LIBLibrary "SAT_LIB"
TODO: This library regroups indicator's functions and functions i use a lot
getRENKOLEVELS(upColor1, dnColor1, HIGH, LOW, ATR)
TODO: RenkoLevels indicator by Mongolor function
Parameters:
upColor1 : TODO: (Type: color) renko up color
dnColor1 : TODO: (Type: color) renko down color
HIGH : TODO: (Type: float)
LOW : TODO: (Type: float)
ATR : TODO: (Type: float)
Returns: TODO: Renkolevels
FunctionPatternFrequencyLibrary "FunctionPatternFrequency"
Counts the word or integer number pattern frequency on a array.
reference:
rosettacode.org
count(pattern)
counts the number a pattern is repeated.
Parameters:
pattern : : array : array with patterns to be counted.
Returns:
array : list of unique patterns.
array : list of counters per pattern.
usage:
count(array.from('a','b','c','a','b','a'))
count(pattern)
counts the number a pattern is repeated.
Parameters:
pattern : : array : array with patterns to be counted.
Returns:
array : list of unique patterns.
array : list of counters per pattern.
usage:
count(array.from(1,2,3,1,2,1))
ccIndicatorLibrary "ccIndicator"
isMACD_bullCondition()
isMACD_bearCondition()
getProfitPrice()
getLossPrice()
isTouchProfitPrice()
isTouchLossPrice()
ccIndidatorTimeLibrary "ccIndidatorTime"
isDateRange()
isDateRange_Long1()
isDateRange_Long2()
isDateRange_Long3()
isDateRange_Long4()
isDateRange_Short1()
isDateRange_Short2()
isDateRange_Short3()
isDateRange_Short4()