Library "Antares"
this library contains some utility functions that I use in my open source scripts including moving average helpers, candlstick helpers, money management, formatters, convertors, webhook integration, analysis, filters and drawing helpers
ma(type, length, source)
Wraps all ma functions
Parameters:
type: Either SMA or EMA or RMA or WMA or VWMA
length: Number of bars (length).
source: Series of values to process.
Returns: Moving average of `source` for `length` bars back by the of MA.
bb(ma, length, mult, source)
Overwrites `ta.bb` duo to limitations of simple int.float mult. Bollinger Bands . A Bollinger Band is a technical analysis tool defined by a set of lines plotted two standard deviations (positively and negatively) away from a simple moving average ( SMA ) of the security's price, but can be adjusted to user preferences.
Parameters:
ma: Either SMA or EMA or RMA or WMA or VWMA
length: Number of bars (length).
mult: Standard deviation factor.
source: Series of values to process.
Returns: Bollinger Bands .
atr(length, h, l, c)
Overwrites `ta.atr` duo to limitations of simple int length. Function atr ( average true range ) returns the RMA of true range. True range is max(high - low, abs(high - close), abs(low - close)).
Parameters:
length: Number of bars (length).
h: High price high price.
l: low price.
c: Close price close price.
Returns: Average true range .
rsi(length, source)
Overwrites `ta.rsi` duo to limitations of simple int length. Relative strength index . It is calculated using the `ta.rma()` of upward and downward changes of `source` over the last `length` bars.
Parameters:
length: Number of bars (length).
source: Series of values to process.
Returns: Relative strength index .
lowest(length, source, start)
Lowest value for a given number of bars back.
Parameters:
length: Number of bars (length).
source: Series of values to process.
start: Series number of bars that should be skipped before process.
Returns: Lowest value in the series.
highest(length, source, start)
Highest value for a given number of bars back.
Parameters:
length: Number of bars (length).
source: Series of values to process.
start: Series number of bars that should be skipped before process.
Returns: Highest value in the series.
atr_multiplier( rsi , atr_max_multiplier)
Dynamic atr multiplier calculated by RSI .
Parameters:
rsi: Relative strength index .
atr_max_multiplier: The maximum multiplier of atr
Returns: Dynamic multiplier of ATR
offset(atr, atr_multiplier)
Safe dynamic offset you need to use in your stoploss, stop buy/sell, etc.
Parameters:
atr: Average true range .
atr_multiplier: ATR multiplier got from `atr_multiplier( rsi , atr_max_multiplier)`
Returns: Dynamic offset
rsi_emotional( rsi , bottom, top)
Tells you if RSI is in emotional zone.
Parameters:
rsi: Relative Strength Index
bottom: The zone that below it market reacts emotionally
top: The zone that above it market reacts emotionally
Returns: false if RSI was between `bottom` and `top` otherwise true
rsi_signal( rsi , bottom, top)
Tells you if RSI is in good point to check your other strategy conditions.
Parameters:
rsi: Relative Strength Index
bottom: The zone that below it market reacts emotionally
top: The zone that above it market reacts emotionally
Returns: 1 if RSI crossed out 30, 50 or 70. -1 if RSI crossed under 70, 50, 30. otherwise is 0
this library contains some utility functions that I use in my open source scripts including moving average helpers, candlstick helpers, money management, formatters, convertors, webhook integration, analysis, filters and drawing helpers
ma(type, length, source)
Wraps all ma functions
Parameters:
type: Either SMA or EMA or RMA or WMA or VWMA
length: Number of bars (length).
source: Series of values to process.
Returns: Moving average of `source` for `length` bars back by the of MA.
bb(ma, length, mult, source)
Overwrites `ta.bb` duo to limitations of simple int.float mult. Bollinger Bands . A Bollinger Band is a technical analysis tool defined by a set of lines plotted two standard deviations (positively and negatively) away from a simple moving average ( SMA ) of the security's price, but can be adjusted to user preferences.
Parameters:
ma: Either SMA or EMA or RMA or WMA or VWMA
length: Number of bars (length).
mult: Standard deviation factor.
source: Series of values to process.
Returns: Bollinger Bands .
atr(length, h, l, c)
Overwrites `ta.atr` duo to limitations of simple int length. Function atr ( average true range ) returns the RMA of true range. True range is max(high - low, abs(high - close), abs(low - close)).
Parameters:
length: Number of bars (length).
h: High price high price.
l: low price.
c: Close price close price.
Returns: Average true range .
rsi(length, source)
Overwrites `ta.rsi` duo to limitations of simple int length. Relative strength index . It is calculated using the `ta.rma()` of upward and downward changes of `source` over the last `length` bars.
Parameters:
length: Number of bars (length).
source: Series of values to process.
Returns: Relative strength index .
lowest(length, source, start)
Lowest value for a given number of bars back.
Parameters:
length: Number of bars (length).
source: Series of values to process.
start: Series number of bars that should be skipped before process.
Returns: Lowest value in the series.
highest(length, source, start)
Highest value for a given number of bars back.
Parameters:
length: Number of bars (length).
source: Series of values to process.
start: Series number of bars that should be skipped before process.
Returns: Highest value in the series.
atr_multiplier( rsi , atr_max_multiplier)
Dynamic atr multiplier calculated by RSI .
Parameters:
rsi: Relative strength index .
atr_max_multiplier: The maximum multiplier of atr
Returns: Dynamic multiplier of ATR
offset(atr, atr_multiplier)
Safe dynamic offset you need to use in your stoploss, stop buy/sell, etc.
Parameters:
atr: Average true range .
atr_multiplier: ATR multiplier got from `atr_multiplier( rsi , atr_max_multiplier)`
Returns: Dynamic offset
rsi_emotional( rsi , bottom, top)
Tells you if RSI is in emotional zone.
Parameters:
rsi: Relative Strength Index
bottom: The zone that below it market reacts emotionally
top: The zone that above it market reacts emotionally
Returns: false if RSI was between `bottom` and `top` otherwise true
rsi_signal( rsi , bottom, top)
Tells you if RSI is in good point to check your other strategy conditions.
Parameters:
rsi: Relative Strength Index
bottom: The zone that below it market reacts emotionally
top: The zone that above it market reacts emotionally
Returns: 1 if RSI crossed out 30, 50 or 70. -1 if RSI crossed under 70, 50, 30. otherwise is 0
Notes de version:
v2
Added:
body_high(o, c)
Parameters:
o: Open price
c: Close price
body_low(o, c)
Parameters:
o: Open price
c: Close price
is_green(o, c)
Parameters:
o: Open price
c: Close price
is_red(o, c)
Parameters:
o: Open price
c: Close price
body_size(o, c, mintick)
Parameters:
o: Open price
c: Close price
mintick: Min tick value for the symbol.
body_percent(o, h, l, c)
Parameters:
o: Open price
h: High price
l: Low price
c: Close price
top_wick_size(o, h, c, mintick)
Parameters:
o: Open price
h: High price
c: Close price
mintick: Min tick value for the symbol.
top_wick_percent(o, h, l, c)
Parameters:
o: Open price
h: High price
l: Low price
c: Close price
bottom_wick_size(o, l, c, mintick)
Parameters:
o: Open price
l: Low price
c: Close price
mintick: Min tick value for the symbol.
bottom_wick_percent(o, h, l, c)
Parameters:
o: Open price
h: High price
l: Low price
c: Close price
wick_percent(o, h, l, c)
Parameters:
o: Open price
h: High price
l: Low price
c: Close price
is_hammer(o, h, l, c, fib, color_match)
Parameters:
o: Open price
h: High price
l: Low price
c: Close price
fib: Fibonachi level
color_match: If true then the color of the candle will be checked
is_shooting_star(o, h, l, c, fib, color_match)
Parameters:
o: Open price
h: High price
l: Low price
c: Close price
fib: Fibonachi level
color_match: If true then the color of the candle will be checked
is_doji(o, h, l, c, max_body_percent, wick_size)
Parameters:
o: Open price
h: High price
l: Low price
c: Close price
max_body_percent: Max percentage of candle body
wick_size: Size of wick
is_whalish(offset, o, c)
Parameters:
offset: Safe dynamic offset you need to use in your stoploss, stop buy/sell, etc.
o: Open price
c: Close price
is_bullish_engulfing(o, h, l, c, allowed_gap, allowed_rejection_wick, engulf_wick)
Parameters:
o: Open price
h: High price
l: Low price
c: Close price
allowed_gap: How much gap is allowed
allowed_rejection_wick: Max ratio of top wick size on body size
engulf_wick: Should it engulf wick of previous candle?
is_bearish_engulfing(o, h, l, c, allowed_gap, allowed_rejection_wick, engulf_wick)
Parameters:
o: Open price
h: High price
l: Low price
c: Close price
allowed_gap: How much gap is allowed
allowed_rejection_wick: Max ratio of bottom wick size on body size
engulf_wick: Should it engulf wick of previous candle?
bullish_bars(length, o, c, start)
Parameters:
length: Number of bars (length).
o: Open price
c: Close price
start: Series number of bars that should be skipped before process.
bearish_bars(length, o, c, start)
Parameters:
length: Number of bars (length).
o: Open price
c: Close price
start: Series number of bars that should be skipped before process.
Added:
body_high(o, c)
Parameters:
o: Open price
c: Close price
body_low(o, c)
Parameters:
o: Open price
c: Close price
is_green(o, c)
Parameters:
o: Open price
c: Close price
is_red(o, c)
Parameters:
o: Open price
c: Close price
body_size(o, c, mintick)
Parameters:
o: Open price
c: Close price
mintick: Min tick value for the symbol.
body_percent(o, h, l, c)
Parameters:
o: Open price
h: High price
l: Low price
c: Close price
top_wick_size(o, h, c, mintick)
Parameters:
o: Open price
h: High price
c: Close price
mintick: Min tick value for the symbol.
top_wick_percent(o, h, l, c)
Parameters:
o: Open price
h: High price
l: Low price
c: Close price
bottom_wick_size(o, l, c, mintick)
Parameters:
o: Open price
l: Low price
c: Close price
mintick: Min tick value for the symbol.
bottom_wick_percent(o, h, l, c)
Parameters:
o: Open price
h: High price
l: Low price
c: Close price
wick_percent(o, h, l, c)
Parameters:
o: Open price
h: High price
l: Low price
c: Close price
is_hammer(o, h, l, c, fib, color_match)
Parameters:
o: Open price
h: High price
l: Low price
c: Close price
fib: Fibonachi level
color_match: If true then the color of the candle will be checked
is_shooting_star(o, h, l, c, fib, color_match)
Parameters:
o: Open price
h: High price
l: Low price
c: Close price
fib: Fibonachi level
color_match: If true then the color of the candle will be checked
is_doji(o, h, l, c, max_body_percent, wick_size)
Parameters:
o: Open price
h: High price
l: Low price
c: Close price
max_body_percent: Max percentage of candle body
wick_size: Size of wick
is_whalish(offset, o, c)
Parameters:
offset: Safe dynamic offset you need to use in your stoploss, stop buy/sell, etc.
o: Open price
c: Close price
is_bullish_engulfing(o, h, l, c, allowed_gap, allowed_rejection_wick, engulf_wick)
Parameters:
o: Open price
h: High price
l: Low price
c: Close price
allowed_gap: How much gap is allowed
allowed_rejection_wick: Max ratio of top wick size on body size
engulf_wick: Should it engulf wick of previous candle?
is_bearish_engulfing(o, h, l, c, allowed_gap, allowed_rejection_wick, engulf_wick)
Parameters:
o: Open price
h: High price
l: Low price
c: Close price
allowed_gap: How much gap is allowed
allowed_rejection_wick: Max ratio of bottom wick size on body size
engulf_wick: Should it engulf wick of previous candle?
bullish_bars(length, o, c, start)
Parameters:
length: Number of bars (length).
o: Open price
c: Close price
start: Series number of bars that should be skipped before process.
bearish_bars(length, o, c, start)
Parameters:
length: Number of bars (length).
o: Open price
c: Close price
start: Series number of bars that should be skipped before process.
Notes de version:
v3
Added:
trend(light_source, heavy_source, reverse)
Parameters:
light_source: MA with shorter length
heavy_source: MA with longer length
reverse: If true then downtrend chart means the price is bullish
Returns: 1 if light_source crossed over heavy_source, -1 if crossed under heavy_source, otherwise 0
donchian(length, l, h)
Parameters:
length: Number of bars (length).
l: Low price
h: High price
tenkansen(l, h, length)
Parameters:
l: Low price
h: High price
length: Number of bars (length).
kijunsen(l, h, length)
Parameters:
l: Low price
h: High price
length: Number of bars (length).
senkou_a(tenkansen, kijunsen)
Parameters:
tenkansen: Conversion Line, is the mid-point of the highest and lowest prices of an asset over the last nine periods.
kijunsen: Base line, is an indicator and important component of the Ichimoku Kinko Hyo method of technical analysis
senkou_b(l, h, length)
Parameters:
l: Low price
h: High price
length: Number of bars (length).
crossover(heavy_source, light_source, full_enter, full_cross)
Parameters:
heavy_source: MA with longer length
light_source: MA with shorter length
full_enter: False means that previous source can be equal or lower than current one, otherwise should be lower
full_cross: False means that current source can be equal or greater than previous one, otherwise should be greater
crossunder(heavy_source, light_source, full_enter, full_cross)
Parameters:
heavy_source: MA with longer length
light_source: MA with shorter length
full_enter: False means that previous source can be equal or lower than current one, otherwise should be lower
full_cross: False means that current source can be equal or greater than previous one, otherwise should be greater
cross(heavy_source, light_source, full_enter, full_cross)
Parameters:
heavy_source: MA with longer length
light_source: MA with shorter length
full_enter: False means that previous source can be equal or lower than current one, otherwise should be lower
full_cross: False means that current source can be equal or greater than previous one, otherwise should be greater
above_line(line, length, source, start)
Parameters:
line: Horizontal line that source will be checked with
length: Number of bars (length).
source: Series of values to process
start: Series number of bars that should be skipped before process.
below_line(line, length, source, start)
Parameters:
line: Horizontal line that source will be checked with
length: Number of bars (length).
source: Series of values to process
start: Series number of bars that should be skipped before process.
crossover_line(line, length, source, start)
Parameters:
line: Horizontal line that source will be checked with
length: Number of bars (length).
source: Series of values to process
start: Series number of bars that should be skipped before process.
crossunder_line(line, length, source, start)
Parameters:
line: Horizontal line that source will be checked with
length: Number of bars (length).
source: Series of values to process
start: Series number of bars that should be skipped before process.
cross_line(line, length, source, start)
Parameters:
line: Horizontal line that source will be checked with
length: Number of bars (length).
source: Series of values to process
start: Series number of bars that should be skipped before process.
bars_crossover_line(line, length, o, c, start)
Parameters:
line: Horizontal line that source will be checked with
length: Number of bars (length).
o: Open price
c: Close price
start: Series number of bars that should be skipped before process.
bars_crossunder_line(line, length, o, c, start)
Parameters:
line: Horizontal line that source will be checked with
length: Number of bars (length).
o: Open price
c: Close price
start: Series number of bars that should be skipped before process.
bars_cross_line(line, length, o, c, start)
Parameters:
line: Horizontal line that source will be checked with
length: Number of bars (length).
o: Open price
c: Close price
start: Series number of bars that should be skipped before process.
Added:
trend(light_source, heavy_source, reverse)
Parameters:
light_source: MA with shorter length
heavy_source: MA with longer length
reverse: If true then downtrend chart means the price is bullish
Returns: 1 if light_source crossed over heavy_source, -1 if crossed under heavy_source, otherwise 0
donchian(length, l, h)
Parameters:
length: Number of bars (length).
l: Low price
h: High price
tenkansen(l, h, length)
Parameters:
l: Low price
h: High price
length: Number of bars (length).
kijunsen(l, h, length)
Parameters:
l: Low price
h: High price
length: Number of bars (length).
senkou_a(tenkansen, kijunsen)
Parameters:
tenkansen: Conversion Line, is the mid-point of the highest and lowest prices of an asset over the last nine periods.
kijunsen: Base line, is an indicator and important component of the Ichimoku Kinko Hyo method of technical analysis
senkou_b(l, h, length)
Parameters:
l: Low price
h: High price
length: Number of bars (length).
crossover(heavy_source, light_source, full_enter, full_cross)
Parameters:
heavy_source: MA with longer length
light_source: MA with shorter length
full_enter: False means that previous source can be equal or lower than current one, otherwise should be lower
full_cross: False means that current source can be equal or greater than previous one, otherwise should be greater
crossunder(heavy_source, light_source, full_enter, full_cross)
Parameters:
heavy_source: MA with longer length
light_source: MA with shorter length
full_enter: False means that previous source can be equal or lower than current one, otherwise should be lower
full_cross: False means that current source can be equal or greater than previous one, otherwise should be greater
cross(heavy_source, light_source, full_enter, full_cross)
Parameters:
heavy_source: MA with longer length
light_source: MA with shorter length
full_enter: False means that previous source can be equal or lower than current one, otherwise should be lower
full_cross: False means that current source can be equal or greater than previous one, otherwise should be greater
above_line(line, length, source, start)
Parameters:
line: Horizontal line that source will be checked with
length: Number of bars (length).
source: Series of values to process
start: Series number of bars that should be skipped before process.
below_line(line, length, source, start)
Parameters:
line: Horizontal line that source will be checked with
length: Number of bars (length).
source: Series of values to process
start: Series number of bars that should be skipped before process.
crossover_line(line, length, source, start)
Parameters:
line: Horizontal line that source will be checked with
length: Number of bars (length).
source: Series of values to process
start: Series number of bars that should be skipped before process.
crossunder_line(line, length, source, start)
Parameters:
line: Horizontal line that source will be checked with
length: Number of bars (length).
source: Series of values to process
start: Series number of bars that should be skipped before process.
cross_line(line, length, source, start)
Parameters:
line: Horizontal line that source will be checked with
length: Number of bars (length).
source: Series of values to process
start: Series number of bars that should be skipped before process.
bars_crossover_line(line, length, o, c, start)
Parameters:
line: Horizontal line that source will be checked with
length: Number of bars (length).
o: Open price
c: Close price
start: Series number of bars that should be skipped before process.
bars_crossunder_line(line, length, o, c, start)
Parameters:
line: Horizontal line that source will be checked with
length: Number of bars (length).
o: Open price
c: Close price
start: Series number of bars that should be skipped before process.
bars_cross_line(line, length, o, c, start)
Parameters:
line: Horizontal line that source will be checked with
length: Number of bars (length).
o: Open price
c: Close price
start: Series number of bars that should be skipped before process.
Notes de version:
v4
Added:
percent(number, precision)
the value of `number` percentified to with precision 2 by default
Parameters:
number: The value to be percentified.
precision: Optional argument. Decimal places to which `number` will be rounded. When no argument is supplied, rounding is to the nearest integer.
Returns: The value of `number` percentified according to precision.
sl(sl_offset, o, c)
Parameters:
sl_offset: Comes dynamically from offset(atr, atr_multiplier). But you can use any offset algorithm you want.
o: Open price
c: Close price
qty(risked_capital, sl_offset)
Parameters:
risked_capital: What you stand to lose if given stoploss is reached.
sl_offset: Comes dynamically from offset(atr, atr_multiplier). But you can use any offset algorithm you want.
amount(qty, entry)
Parameters:
qty: The size, or quantity, of the asset/coin (not in quote currency) for a position.
entry: The price at which you enter the trade.
max_risk(sl_offset, capital, leverage, max_margin, entry)
Parameters:
sl_offset: Comes dynamically from offset(atr, atr_multiplier). But you can use any offset algorithm you want.
capital
leverage: The proportion of your trade that will be paid for with borrowed funds. If you are using 2x leverage, you will be funding half of the trade. If you are using 25x leverage you will be funding 1/25 of the trade.
max_margin: Max margin
entry: The price at which you enter the trade.
risked_capital(risk, max_risk, capital, dynamic)
Parameters:
risk: The percentage of your total capital you are willing to risk in this trade.
max_risk: The maximum risk that your margin allows you to do.
capital
dynamic: If true, reduces risked capital based on max risk
risked(risked_capital, capital)
Parameters:
risked_capital: What you stand to lose if given stoploss is reached.
capital
tp(sl, ror, entry)
Parameters:
sl: A price level you can set on a position which will, once reached, close the position and prevent any further loss.
ror: The ratio of potential profit of the trade to its potential loss.
entry: The price at which you enter the trade.
tp_qty(qty, ror, percent)
Parameters:
qty: The size, or quantity, of the asset/coin (not currency) for this position.
ror: The ratio of potential profit of the trade to its potential loss.
percent: The percentage of quantity you're going to take as profit, when the target ROR was reached.
margin(amount, leverage)
Parameters:
amount: The size of the asset/coin (not in base currency) for a position.
leverage: The proportion of your trade that will be paid for with borrowed funds. If you are using 2x leverage, you will be funding half of the trade. If you are using 25x leverage you will be funding 1/25 of the trade.
pnl(exit, qty, short, entry)
Parameters:
exit: The price at which you exit your trade. Can be referred to as your take profit or "TP".
qty: The size, or quantity, of the asset/coin (not currency) for this position.
short: A selling position that enables a trader to profit if the price of an asset decreases.
entry: The price at which you enter the trade.
risk_reward(risked_capital, pnl)
Parameters:
risked_capital: What you stand to lose if given stoploss is reached.
pnl: Profit and Loss. Shows what you stand to gain or lose with the inputs provided.
roe(pnl, margin)
Parameters:
pnl: Profit and Loss. Shows what you stand to gain or lose with the inputs provided.
margin: Margin is the portion of your own funds that you put into a trade. Keep in mind that depending on what margin mode you are using, your losses may not be limited to this margin.
format_percent(number, fallback)
Parameters:
number: Number
fallback: Fallback, if the value was na
format_pairs(main_value, second_value, title, one_line_value, one_line_pair)
Parameters:
main_value: The first value
second_value: The second value
title: The title
one_line_value: If true wraps second value with parenthesis and concats it with the main value, otherwise moves it to another line
one_line_pair: If true divides the pairs with `:`, otherwise moves the values to another line
_format_quote(source, fallback)
Parameters:
source: Series of values to process
fallback: Fallback, if the value was na
_format_base(source, fallback)
Parameters:
source: Series of values to process
fallback: Fallback, if the value was na
Added:
percent(number, precision)
the value of `number` percentified to with precision 2 by default
Parameters:
number: The value to be percentified.
precision: Optional argument. Decimal places to which `number` will be rounded. When no argument is supplied, rounding is to the nearest integer.
Returns: The value of `number` percentified according to precision.
sl(sl_offset, o, c)
Parameters:
sl_offset: Comes dynamically from offset(atr, atr_multiplier). But you can use any offset algorithm you want.
o: Open price
c: Close price
qty(risked_capital, sl_offset)
Parameters:
risked_capital: What you stand to lose if given stoploss is reached.
sl_offset: Comes dynamically from offset(atr, atr_multiplier). But you can use any offset algorithm you want.
amount(qty, entry)
Parameters:
qty: The size, or quantity, of the asset/coin (not in quote currency) for a position.
entry: The price at which you enter the trade.
max_risk(sl_offset, capital, leverage, max_margin, entry)
Parameters:
sl_offset: Comes dynamically from offset(atr, atr_multiplier). But you can use any offset algorithm you want.
capital
leverage: The proportion of your trade that will be paid for with borrowed funds. If you are using 2x leverage, you will be funding half of the trade. If you are using 25x leverage you will be funding 1/25 of the trade.
max_margin: Max margin
entry: The price at which you enter the trade.
risked_capital(risk, max_risk, capital, dynamic)
Parameters:
risk: The percentage of your total capital you are willing to risk in this trade.
max_risk: The maximum risk that your margin allows you to do.
capital
dynamic: If true, reduces risked capital based on max risk
risked(risked_capital, capital)
Parameters:
risked_capital: What you stand to lose if given stoploss is reached.
capital
tp(sl, ror, entry)
Parameters:
sl: A price level you can set on a position which will, once reached, close the position and prevent any further loss.
ror: The ratio of potential profit of the trade to its potential loss.
entry: The price at which you enter the trade.
tp_qty(qty, ror, percent)
Parameters:
qty: The size, or quantity, of the asset/coin (not currency) for this position.
ror: The ratio of potential profit of the trade to its potential loss.
percent: The percentage of quantity you're going to take as profit, when the target ROR was reached.
margin(amount, leverage)
Parameters:
amount: The size of the asset/coin (not in base currency) for a position.
leverage: The proportion of your trade that will be paid for with borrowed funds. If you are using 2x leverage, you will be funding half of the trade. If you are using 25x leverage you will be funding 1/25 of the trade.
pnl(exit, qty, short, entry)
Parameters:
exit: The price at which you exit your trade. Can be referred to as your take profit or "TP".
qty: The size, or quantity, of the asset/coin (not currency) for this position.
short: A selling position that enables a trader to profit if the price of an asset decreases.
entry: The price at which you enter the trade.
risk_reward(risked_capital, pnl)
Parameters:
risked_capital: What you stand to lose if given stoploss is reached.
pnl: Profit and Loss. Shows what you stand to gain or lose with the inputs provided.
roe(pnl, margin)
Parameters:
pnl: Profit and Loss. Shows what you stand to gain or lose with the inputs provided.
margin: Margin is the portion of your own funds that you put into a trade. Keep in mind that depending on what margin mode you are using, your losses may not be limited to this margin.
format_percent(number, fallback)
Parameters:
number: Number
fallback: Fallback, if the value was na
format_pairs(main_value, second_value, title, one_line_value, one_line_pair)
Parameters:
main_value: The first value
second_value: The second value
title: The title
one_line_value: If true wraps second value with parenthesis and concats it with the main value, otherwise moves it to another line
one_line_pair: If true divides the pairs with `:`, otherwise moves the values to another line
_format_quote(source, fallback)
Parameters:
source: Series of values to process
fallback: Fallback, if the value was na
_format_base(source, fallback)
Parameters:
source: Series of values to process
fallback: Fallback, if the value was na
Notes de version:
v5
- Fix atr_multiplier
- Fix atr_multiplier
Notes de version:
v6
Updated:
atr_multiplier(rsi, atr_min_multiplier, atr_max_multiplier)
Dynamic atr multiplier calculated by RSI.
Parameters:
rsi: Relative strength index.
atr_min_multiplier: The minimum multiplier of atr
atr_max_multiplier: The maximum multiplier of atr
Returns: Dynamic multiplier of ATR
Updated:
atr_multiplier(rsi, atr_min_multiplier, atr_max_multiplier)
Dynamic atr multiplier calculated by RSI.
Parameters:
rsi: Relative strength index.
atr_min_multiplier: The minimum multiplier of atr
atr_max_multiplier: The maximum multiplier of atr
Returns: Dynamic multiplier of ATR