utilsLibrary "utils"
TODO: add library description here
maCustomseries(source, typeMa, length)
Parameters:
source (float)
typeMa (simple string)
length (simple int)
barCrossoverCounter(signalPrice, basePrice)
Parameters:
signalPrice (float)
basePrice (float)
barCrossunderCounter(signalPrice, basePrice)
Parameters:
signalPrice (float)
basePrice (float)
Alerts
WHAlertCommandLibrary "WHAlertCommand"
f_WH_Risk(risk_Type_)
Parameters:
risk_Type_ (string)
f_WH_Open_Position(uuid_, enable_Buy_, enable_Sell, enable_All_Group_Members_, enable_Close_Opposite_Side_, enable_Risk_, risk_Type_, signal_Type_Buy_Or_Sell)
Parameters:
uuid_ (string)
enable_Buy_ (bool)
enable_Sell (bool)
enable_All_Group_Members_ (bool)
enable_Close_Opposite_Side_ (bool)
enable_Risk_ (bool)
risk_Type_ (string)
signal_Type_Buy_Or_Sell (string)
f_WH_TP(uuid_, position_Size_Percent_, side_)
Parameters:
uuid_ (string)
position_Size_Percent_ (float)
side_ (string)
f_WH_MARKET_CLOSE(uuid_, side_)
Parameters:
uuid_ (string)
side_ (string)
DerivativeAlertPlaceHoldersLibrary "DerivativeAlertPlaceHolders"
TODO: Creation of Placeholders for Alerts, for using in FNO segment.
BasicPH(CustomMessage)
Parameters:
CustomMessage (string) : TODO: Requires Custom Input of Message
Returns: TODO: String with PH
CustomPlaceHoldersFNO(CustomInputMessage, InputPrice)
Parameters:
CustomInputMessage (string) : TODO: Requires Custom Input of Message
InputPrice (float)
Returns: TODO: Alert String with PH used in major FNO alert Segments
Mizar_LibraryThe "Mizar_Library" is a powerful tool designed for Pine Script™ programmer’s, providing a collection of general functions that facilitate the usage of Mizar’s DCA (Dollar-Cost-Averaging) bot system.
To begin using the Mizar Library, you first need to import it into your indicator script. Insert the following line below your indicator initiation line: import Mizar_Trading/Mizar_Library/1 as mizar (mizar is the chosen alias).
In the import statement, Mizar_Trading.Mizar_Library_v1 refers to the specific version of the Mizar Library you wish to use. Feel free to modify mizar to your preferred alias name.
Once the library is imported, you can leverage its functions by prefixing them with mizar. . This will prompt auto-completion suggestions displaying all the available user-defined functions provided by the Mizar Library.
Now, let's delve into some of the key functions available in the Mizar Library:
DCA_bot_msg(_cmd)
The DCA_bot_msg function accepts an user-defined type (UDT) _cmd as a parameter and returns a string with the complete JSON command for a Mizar DCA bot.
Parameters:
_cmd (bot_params) : ::: User-defined type (UDT) that holds all the necessary information for the bot command.
Returns: A string with the complete JSON command for a Mizar DCA bot.
rounding_to_ticks(value, ticks, rounding_type)
The rounding_to_ticks function rounds a calculated price to the nearest actual price based on the specified tick size.
Parameters:
value (float) : ::: The calculated price as float type, to be rounded to the nearest real price.
ticks (float) : ::: The smallest possible price obtained through a request in your script.
rounding_type (int) : ::: The rounding type for the price: 0 = closest real price, 1 = closest real price above, 2 = closest real price below.
Returns: A float value representing the rounded price to the next tick.
bot_params
Bot_params is an user-defined type (UDT) that represents the parameters required for a Mizar DCA bot.
Fields:
bot_id (series string) : The ID number of your Mizar DCA bot.
api_key (series string) : Your private API key from your Mizar account (keep it confidential!).
action (series string) : The command to perform: "open" (standard) or "close" optional .
tp_perc (series string) : The take profit percentage in decimal form (1% = "0.01") optional .
base_asset (series string) : The cryptocurrency you want to buy (e.g., "BTC").
quote_asset (series string) : The coin or fiat currency used for payment (e.g., "USDT" is standard if not specified) optional .
direction (series string) : The direction of the position: "long" or "short" (only applicable for two-way hedge bots) optional .
To obtain the JSON command string for the alert_function call, you can use the DCA_bot_msg function provided by the library. Simply pass the cmd_msg UDT as an argument and assign the returned string value to a variable.
Here's an example to illustrate the process:
// Import of the Mizar Library to use the included functions
import/Mizar_Trading/Mizar_Library/1 as mizar
// Example to set a variable called “cmd_msg” and all of its parameters
cmd_msg = mizar.bot_params. new()
cmd_msg.action := "open"
cmd_msg.api_key := "top secret"
cmd_msg.bot_id := "9999"
cmd_msg.base_asset := "BTC"
cmd_msg.quote_asset := "USDT"
cmd_msg.direction := "long"
cmd_msg.tp_perc := "0.015"
// Calling the Mizar conversion function named “DCA_bot_msg()” with the cmd_msg as argument to receive the JSON command and save it in a string variable called “alert_msg”
alert_msg = mizar.DCA_bot_msg(cmd_msg)
Feel free to utilize (series) string variables instead of constant strings. By incorporating the Mizar Library into your Pine Script, you gain access to a powerful set of functions and can leverage them according to your specific requirements.
For additional help or support, you can join the Mizar Discord channel. There, you'll find a dedicated Pine Script channel where you can ask any questions related to Pine Script.
FinandyHookLibLibrary "FinandyHookLib"
TODO: add library description here
createOrderJson(model, hook_secret, options)
Parameters:
model (orderModel type from Hamster-Coder/OrderLib/7)
hook_secret (string)
options (textFormatOptions)
textFormatOptions
Fields:
price_format (series__string)
percent_format (series__string)
SAT_BACKTEST @description TODO: Regroupement of useful functionsLibrary "SAT_BACKTEST"
ex_timezone(tz)
switch case return exact @timezone for timezone input
Parameters:
tz (simple string)
Returns: syminfo.timezone or tz
if_in_date_range(usefromDate, fromDate, usetoDate, toDate, src_timezone, dst_timezone)
if_in_date_range : check if @time_close is range
Parameters:
usefromDate (simple bool)
fromDate (simple int)
usetoDate (simple bool)
toDate (simple int)
src_timezone (simple string)
dst_timezone (simple string)
Returns: true if @time_close is range
if_in_session(useSessionStart, sessionStartHour, sessionStartMinute, useSessionEnd, sessionEndHour, sessionEndMinute, useSessionDay, mon, tue, wed, thu, fri, sat, sun, src_timezone, dst_timezone)
if_in_session : check if @time_close is range
Parameters:
useSessionStart (simple bool)
sessionStartHour (simple int)
sessionStartMinute (simple int)
useSessionEnd (simple bool)
sessionEndHour (simple int)
sessionEndMinute (simple int)
useSessionDay (simple bool)
mon (simple bool)
tue (simple bool)
wed (simple bool)
thu (simple bool)
fri (simple bool)
sat (simple bool)
sun (simple bool)
src_timezone (simple string)
dst_timezone (simple string)
Returns: true if @time_close is range
Antares_messages_publicLibrary "Antares_messages_public"
This library add messages for yours strategy for use in Antares trading system for binance and bybit exchanges.
Данная библиотека позволяет формировать сообщения в алертах стратегий для Antares в более упрощенном для пользователя режиме, включая всплывающие подсказки и т.д.
set_leverage(token, market, ticker_id, leverage)
Set leverage for ticker on specified market.
Parameters:
token (string) : (integer or 0) token for trade in system, if = 0 then token part mess is empty. Токен, При значениb = 0 не включается в формирование строки алерта.
market (string) : (string) Spot 'binance' , 'bybit' . Futures ('binancefru','binancefro','bybitfu', 'bybitfi'). Строковая переменная названия биржи.
ticker_id (string) : (string) ticker in market ('btcusdt', 'ethusdt' etc...). Строковая переменная названия тикера (пары).
leverage (float) : (float) leverage level. Устанавливаемое плечо.
Returns: 'Set leverage message'.
pause(time_pause)
Set pause in message. '::' -left and '::' -right included.
Parameters:
time_pause (int)
LongLimit(token, market, ticker_id, type_qty, quantity, price, orderId, leverageforqty)
Buy order with limit price and quantity.
Лимитный ордер на покупку(в лонг).
Parameters:
token (string) : (integer or 0) token for trade in system, if = 0 then token part mess is empty. Токен, При значениb = 0 не включается в формирование строки алерта.
market (string) : (string) Spot 'binance' , 'bybit' . Futures ('binancefru','binancefro','bybitfu', 'bybitfi'). Строковая переменная названия биржи.
ticker_id (string) : (string) ticker in market ('btcusdt', 'ethusdt' etc...). Строковая переменная названия тикера (пары).
type_qty (string) : (string) type of quantity: 1. 'qty' or '' or na - standart (in coins), 2. 'quqty'- in assets (usdt,btc,etc..), 3.open% - open position(futures) or buy (spot) in % of base 4. close% - close in % of position (futures) or sell (spot) coins in % for current quantity
quantity (float) : (float) orders size, see at 'type_qty'. Размер ордера, базы или % в соответствии с 'type_qty'
price (float) : (float) price for limit order. Цена по которой должен быть установлен лимитный ордер.
orderId (string) : (string) if use order id you may change or cancel your order after or set it ''. Используйте OrderId если хотите изменить или отменить ордер в будущем.
leverageforqty (bool) : (bool) use leverage in qty. Использовать плечо при расчете количества или нет.
Returns: 'Limit Buy order'. Лимитный ордер на покупку (лонг).
LongMarket(token, market, ticker_id, type_qty, quantity, leverageforqty)
Market Buy order with quantity.
Рыночный ордер на покупку (в лонг).
Parameters:
token (string) : (integer or 0) token for trade in system, if = 0 then token part mess is empty. Токен, При значениb = 0 не включается в формирование строки алерта.
market (string) : (string) Spot 'binance' , 'bybit' . Futures ('binancefru','binancefro','bybitfu', 'bybitfi'). Строковая переменная названия биржи.
ticker_id (string) : (string) ticker in market ('btcusdt', 'ethusdt' etc...). Строковая переменная названия тикера (пары).
type_qty (string) : (string) type of quantity: 1. 'qty' or '' or na - standart (in coins), 2. 'quqty'- in assets (usdt,btc,etc..), 3.open% - open position(futures) or buy (spot) in % of base 4. close% - close in % of position (futures) or sell (spot) coins in % for current quantity
quantity (float) : (float) orders size, see at 'type_qty'. Размер ордера, базы или % в соответствии с 'type_qty'
leverageforqty (int) : (bool) use leverage in qty. Использовать плечо при расчете количества или нет.
Returns: 'Market Buy order'. Маркетный ордер на покупку (лонг).
ShortLimit(token, market, ticker_id, type_qty, quantity, price, leverageforqty, orderId)
Sell order with limit price and quantity.
Лимитный ордер на продажу(в шорт).
Parameters:
token (string) : (integer or 0) token for trade in system, if = 0 then token part mess is empty. Токен, При значениb = 0 не включается в формирование строки алерта.
market (string) : (string) Spot 'binance' , 'bybit' . Futures ('binancefru','binancefro','bybitfu', 'bybitfi'). Строковая переменная названия биржи.
ticker_id (string) : (string) ticker in market ('btcusdt', 'ethusdt' etc...). Строковая переменная названия тикера (пары).
type_qty (string) : (string) type of quantity: 1. 'qty' or '' or na - standart (in coins), 2. 'quqty'- in assets (usdt,btc,etc..), 3.open% - open position(futures) or buy (spot) in % of base 4. close% - close in % of position (futures) or sell (spot) coins in % for current quantity
quantity (float) : (float) orders size, see at 'type_qty'. Размер ордера, базы или % в соответствии с 'type_qty'
price (float) : (float) price for limit order. Цена по которой должен быть установлен лимитный ордер.
leverageforqty (bool) : (bool) use leverage in qty. Использовать плечо при расчете количества или нет.
orderId (string) : (string) if use order id you may change or cancel your order after or set it ''. Используйте OrderId если хотите изменить или отменить ордер в будущем.
Returns: 'Limit Sell order'. Лимитный ордер на продажу (шорт).
ShortMarket(token, market, ticker_id, type_qty, quantity, leverageforqty)
Sell by market price and quantity.
Рыночный ордер на продажу(в шорт).
Parameters:
token (string) : (integer or 0) token for trade in system, if = 0 then token part mess is empty. Токен, При значениb = 0 не включается в формирование строки алерта.
market (string) : (string) Spot 'binance' , 'bybit' . Futures ('binancefru','binancefro','bybitfu', 'bybitfi'). Строковая переменная названия биржи.
ticker_id (string) : (string) ticker in market ('btcusdt', 'ethusdt' etc...). Строковая переменная названия тикера (пары).
type_qty (string) : (string) type of quantity: 1. 'qty' or '' or na - standart (in coins), 2. 'quqty'- in assets (usdt,btc,etc..), 3.open% - open position(futures) or buy (spot) in % of base 4. close% - close in % of position (futures) or sell (spot) coins in % for current quantity
quantity (float) : (float) orders size, see at 'type_qty'. Размер ордера, базы или % в соответствии с 'type_qty'
leverageforqty (int) : (bool) use leverage in qty. Использовать плечо при расчете количества или нет.
Returns: 'Market Sell order'. Маркетный ордер на продажу (шорт).
Cancel_by_ticker(token, market, ticker_id)
Cancel all orders for market and ticker in setups. Отменяет все ордера на заданной бирже и заданном токене(паре).
Parameters:
token (string)
market (string) : (string) Spot 'binance' , 'bybit' . Futures ('binancefru','binancefro','bybitfu', 'bybitfi'). Строковая переменная названия биржи.
ticker_id (string) : (string) ticker in market ('btcusdt', 'ethusdt' etc...). Строковая переменная названия тикера (пары).
Returns: 'Cancel all orders'. Отмена всех ордеров на заданной бирже и заданном токене(паре).
Cancel_by_id(token, market, ticker_id, orderId)
Cancel order by Id for market and ticker in setups. Отменяет ордер по Id на заданной бирже и заданном токене(паре).
Parameters:
token (string)
market (string) : (string) Spot 'binance' , 'bybit' . Futures ('binancefru','binancefro','bybitfu', 'bybitfi'). Строковая переменная названия биржи.
ticker_id (string) : (string) ticker in market ('btcusdt', 'ethusdt' etc...). Строковая переменная названия тикера (пары).
orderId (string)
Returns: 'Cancel order'. Отмена ордера по Id на заданной бирже и заданном токене(паре).
Close_positions(token, market, ticker_id)
Close all positions for market and ticker in setups. Закрывает все позиции на заданной бирже и заданном токене(паре).
Parameters:
token (string)
market (string) : (string) Spot 'binance' , 'bybit' . Futures ('binancefru','binancefro','bybitfu', 'bybitfi'). Строковая переменная названия биржи.
ticker_id (string) : (string) ticker in market ('btcusdt', 'ethusdt' etc...). Строковая переменная названия тикера (пары).
Returns: 'Close positions'
CloseLongLimit(token, market, ticker_id, type_qty, quantity, price, orderId, leverageforqty)
Close limit order for long position. (futures)
Лимитный ордер на продажу(в шорт) для закрытия лонговой позиции(reduceonly).
Parameters:
token (string) : (integer or 0) token for trade in system, if = 0 then token part mess is empty. Токен, При значениb = 0 не включается в формирование строки алерта.
market (string) : (string) Spot 'binance' , 'bybit' . Futures ('binancefru','binancefro','bybitfu', 'bybitfi'). Строковая переменная названия биржи.
ticker_id (string) : (string) ticker in market ('btcusdt', 'ethusdt' etc...). Строковая переменная названия тикера (пары).
type_qty (string) : (string) type of quantity: 1. 'qty' or '' or na - standart (in coins), 2. 'quqty'- in assets (usdt,btc,etc..), 3.open% - open position(futures) or buy (spot) in % of base 4. close% - close in % of position (futures) or sell (spot) coins in % for current quantity
quantity (float) : (float) orders size, see at 'type_qty'. Размер ордера, базы или % в соответствии с 'type_qty'
price (float) : (float) price for limit order. Цена по которой должен быть установлен лимитный ордер.
orderId (string) : (string) if use order id you may change or cancel your order after or set it ''. Используйте OrderId если хотите изменить или отменить ордер в будущем.
leverageforqty (bool) : (bool) use leverage in qty. Использовать плечо при расчете количества или нет.
Returns: 'Limit Sell order reduce only (close long position)'. Лимитный ордер на продажу для снижения текущего лонга(в шорт не входит).
CloseLongMarket(token, market, ticker_id, type_qty, quantity, leverageforqty)
Close market order for long position.
Рыночный ордер на продажу(в шорт) для закрытия лонговой позиции(reduceonly).
Parameters:
token (string) : (integer or 0) token for trade in system, if = 0 then token part mess is empty. Токен, При значениb = 0 не включается в формирование строки алерта.
market (string) : (string) Spot 'binance' , 'bybit' . Futures ('binancefru','binancefro','bybitfu', 'bybitfi'). Строковая переменная названия биржи.
ticker_id (string) : (string) ticker in market ('btcusdt', 'ethusdt' etc...). Строковая переменная названия тикера (пары).
type_qty (string) : (string) type of quantity: 1. 'qty' or '' or na - standart (in coins), 2. 'quqty'- in assets (usdt,btc,etc..), 3.open% - open position(futures) or buy (spot) in % of base 4. close% - close in % of position (futures) or sell (spot) coins in % for current quantity
quantity (float) : (float) orders size, see at 'type_qty'. Размер ордера, базы или % в соответствии с 'type_qty'
leverageforqty (bool) : (bool) use leverage in qty. Использовать плечо при расчете количества или нет.
Returns: 'Market Sell order reduce only (close long position)'. Ордер на снижение/закрытие текущего лонга(в шорт не входит) по рыночной цене.
CloseShortLimit(token, market, ticker_id, type_qty, quantity, price, orderId, leverageforqty)
Close limit order for short position.
Лимитный ордер на покупку(в лонг) для закрытия шортовой позиции(reduceonly).
Parameters:
token (string) : (integer or 0) token for trade in system, if = 0 then token part mess is empty. Токен, При значениb = 0 не включается в формирование строки алерта.
market (string) : (string) Spot 'binance' , 'bybit' . Futures ('binancefru','binancefro','bybitfu', 'bybitfi'). Строковая переменная названия биржи.
ticker_id (string) : (string) ticker in market ('btcusdt', 'ethusdt' etc...). Строковая переменная названия тикера (пары).
type_qty (string) : (string) type of quantity: 1. 'qty' or '' or na - standart (in coins), 2. 'quqty'- in assets (usdt,btc,etc..), 3.open% - open position(futures) or buy (spot) in % of base 4. close% - close in % of position (futures) or sell (spot) coins in % for current quantity
quantity (float) : (float) orders size, see at 'type_qty'. Размер ордера, базы или % в соответствии с 'type_qty'
price (float) : (float) price for limit order. Цена по которой должен быть установлен лимитный ордер.
orderId (string) : (string) if use order id you may change or cancel your order after or set it ''. Используйте OrderId если хотите изменить или отменить ордер в будущем.
leverageforqty (bool) : (bool) use leverage in qty. Использовать плечо при расчете количества или нет.
Returns: 'Limit Buy order reduce only (close short position)' . Лимитный ордер на покупку (лонг) для сокращения/закрытия текущего шорта.
CloseShortMarket(token, market, ticker_id, type_qty, quantity, leverageforqty)
Set Close limit order for long position.
Рыночный ордер на покупку(в лонг) для сокращения/закрытия шортовой позиции(reduceonly).
Parameters:
token (string) : (integer or 0) token for trade in system, if = 0 then token part mess is empty. Токен, При значениb = 0 не включается в формирование строки алерта.
market (string) : (string) Spot 'binance' , 'bybit' . Futures ('binancefru','binancefro','bybitfu', 'bybitfi'). Строковая переменная названия биржи.
ticker_id (string) : (string) ticker in market ('btcusdt', 'ethusdt' etc...). Строковая переменная названия тикера (пары).
type_qty (string) : (string) type of quantity: 1. 'qty' or '' or na - standart (in coins), 2. 'quqty'- in assets (usdt,btc,etc..), 3.open% - open position(futures) or buy (spot) in % of base 4. close% - close in % of position (futures) or sell (spot) coins in % for current quantity
quantity (float) : (float) orders size, see at 'type_qty'. Размер ордера, базы или % в соответствии с 'type_qty'
leverageforqty (bool) : (bool) use leverage in qty. Использовать плечо при расчете количества или нет.
Returns: 'Market Buy order reduce only (close short position)'. Маркетного ордера на покупку (лонг) для сокращения/закрытия текущего шорта.
cancel_all_close(token, market, ticker_id)
Parameters:
token (string)
market (string)
ticker_id (string)
limit_tpsl_bybitfu(token, ticker_id, order_id, side, type_qty, quantity, price, tp_price, sl_price, leverageforqty)
Set multi order for Bybit : limit + takeprofit + stoploss
Выставление тройного ордера на Bybit лимитка со стоплоссом и тейкпрофитом
Parameters:
token (string) : (integer or 0) token for trade in system, if = 0 then token part mess is empty. Токен, При значениb = 0 не включается в формирование строки алерта.
ticker_id (string) : (string) ticker in market ('btcusdt', 'ethusdt' etc...). Строковая переменная названия тикера (пары).
order_id (string)
side (bool) : (bool) "buy side" if true or "sell side" if false. true для лонга, false для шорта.
type_qty (string) : (string) type of quantity: 1. 'qty' or '' or na - standart (in coins), 2. 'quqty'- in assets (usdt,btc,etc..), 3.open% - open position(futures) or buy (spot) in % of base 4. close% - close in % of position (futures) or sell (spot) coins in % for current quantity
quantity (float) : (float) orders size, see at 'type_qty'. Размер ордера, базы или % в соответствии с 'type_qty'
price (float) : (float) price for limit order by 'side'. Цена лимитного ордера
tp_price (float) : (float) price for take profit order.
sl_price (float) : (float) price for stoploss order
leverageforqty (bool) : (bool) use leverage in qty. Использовать плечо при расчете количества или нет.
Returns: Set multi order for Bybit : limit + takeprofit + stoploss.
replace_limit_tpsl_bybitfu(token, ticker_id, order_id, side, type_qty, quantity, price, tp_price, sl_price, leverageforqty)
Change multi order for Bybit : limit + takeprofit + stoploss
Изменение тройного ордера на Bybit лимитка со стоплоссом и тейкпрофитом
Parameters:
token (string) : (integer or 0) token for trade in system, if = 0 then token part mess is empty. Токен, При значениb = 0 не включается в формирование строки алерта.
ticker_id (string) : (string) ticker in market ('btcusdt', 'ethusdt' etc...). Строковая переменная названия тикера (пары).
order_id (string)
side (bool) : (bool) "buy side" if true or "sell side" if false. true для лонга, false для шорта.
type_qty (string) : (string) type of quantity: 1. 'qty' or '' or na - standart (in coins), 2. 'quqty'- in assets (usdt,btc,etc..), 3.open% - open position(futures) or buy (spot) in % of base 4. close% - close in % of position (futures) or sell (spot) coins in % for current quantity
quantity (float) : (float) orders size, see at 'type_qty'. Размер ордера, базы или % в соответствии с 'type_qty'
price (float) : (float) price for limit order by 'side'. Цена лимитного ордера
tp_price (float) : (float) price for take profit order.
sl_price (float) : (float) price for stoploss order
leverageforqty (bool) : (bool) use leverage in qty. Использовать плечо при расчете количества или нет.
Returns: Set multi order for Bybit : limit + takeprofit + stoploss.
long_stop(token, market, ticker_id, type_qty, quantity, l_stop, leverageforqty)
Stop market order for long position
Рыночный стоп-ордер на продажу для закрытия лонговой позиции.
Parameters:
token (string)
market (string) : (string) 'binance' , 'binancefru' etc.. Строковая переменная названия биржи.
ticker_id (string) : (string) ticker in market ('btcusdt', 'ethusdt' etc...). Строковая переменная названия тикера (пары).
type_qty (string) : (string) type of quantity: 1. 'qty' or '' or na - standart (in coins), 2. 'quqty'- in assets (usdt,btc,etc..), 3.open% - open position(futures) or buy (spot) in % of base 4. close% - close in % of position (futures) or sell (spot) coins in % for current quantity
quantity (float) : (float) orders size. Размер ордера.
l_stop (float) : (float) price for activation stop order. Цена активации стоп-ордера.
leverageforqty (bool) : (bool) use leverage in qty. Использовать плечо при расчете количества или нет.
Returns: 'Stop Market Sell order (close long position)'. Маркетный стоп-ордер на снижения/закрытия текущего лонга.
short_stop(token, market, ticker_id, type_qty, quantity, s_stop, leverageforqty)
Stop market order for short position
Рыночный стоп-ордер на покупку(в лонг) для закрытия шорт позиции.
Parameters:
token (string)
market (string) : (string) 'binance' , 'binancefru' etc.. Строковая переменная названия биржи.
ticker_id (string) : (string) ticker in market ('btcusdt', 'ethusdt' etc...). Строковая переменная названия тикера (пары).
type_qty (string) : (string) type of quantity: 1. 'qty' or '' or na - standart (in coins), 2. 'quqty'- in assets (usdt,btc,etc..), 3.open% - open position(futures) or buy (spot) in % of base 4. close% - close in % of position (futures) or sell (spot) coins in % for current quantity
quantity (float) : (float) orders size. Размер ордера.
s_stop (float) : (float) price for activation stop order. Цена активации стоп-ордера.
leverageforqty (bool) : (bool) use leverage in qty. Использовать плечо при расчете количества или нет.
Returns: 'Stop Market Buy order (close short position)'. Маркетный стоп-ордер на снижения/закрытия текущего шорта.
change_stop_l(token, market, ticker_id, type_qty, quantity, l_stop, leverageforqty)
Change Stop market order for long position
Изменяем стоп-ордер на продажу(в шорт) для закрытия лонг позиции.
Parameters:
token (string)
market (string) : (string) 'binance' , 'binancefru' etc.. Строковая переменная названия биржи.
ticker_id (string) : (string) ticker in market ('btcusdt', 'ethusdt' etc...). Строковая переменная названия тикера (пары).
type_qty (string) : (string) type of quantity: 1. 'qty' or '' or na - standart (in coins), 2. 'quqty'- in assets (usdt,btc,etc..), 3.open% - open position(futures) or buy (spot) in % of base 4. close% - close in % of position (futures) or sell (spot) coins in % for current quantity
quantity (float) : (float) orders size. Размер ордера.
l_stop (float) : (float) price for activation stop order. Цена активации стоп-ордера.
leverageforqty (bool) : (bool) use leverage in qty. Использовать плечо при расчете количества или нет.
Returns: 'Change Stop Market Buy order (close long position)'. Смещает цену активации Маркетного стоп-ордер на снижения/закрытия текущего лонга.
change_stop_s(token, market, ticker_id, type_qty, quantity, s_stop, leverageforqty)
Change Stop market order for short position
Смещает цену активации Рыночного стоп-ордера на покупку(в лонг) для закрытия шорт позиции.
Parameters:
token (string)
market (string) : (string) 'binance' , 'binancefru' etc.. Строковая переменная названия биржи.
ticker_id (string) : (string) ticker in market ('btcusdt', 'ethusdt' etc...). Строковая переменная названия тикера (пары).
type_qty (string)
quantity (float) : (float) orders size. Размер ордера.
s_stop (float) : (float) price for activation stop order. Цена активации стоп-ордера.
leverageforqty (bool) : (bool) use leverage in qty. Использовать плечо при расчете количества или нет.
Returns: 'Change Stop Market Buy order (close short position)'. Смещает цену активации Маркетного стоп-ордер на снижения/закрытия текущего шорта.
open_long_position(token, market, ticker_id, type_qty, quantity, l_stop, leverageforqty)
Cancel and close all orders and positions by ticker , then open Long position by market price with stop order
Отменяет все лимитки и закрывает все позы по тикеру, затем открывает лонг по маркету с выставлением стопа (переворот позиции, при необходимости).
Parameters:
token (string)
market (string) : (string) 'binance' , 'binancefru' etc.. Строковая переменная названия биржи.
ticker_id (string) : (string) ticker in market ('btcusdt', 'ethusdt' etc...). Строковая переменная названия тикера (пары).
type_qty (string) : (string) type of quantity: 1. 'qty' or '' or na - standart (in coins), 2. 'quqty'- in assets (usdt,btc,etc..), 3.open% - open position(futures) or buy (spot) in % of base 4. close% - close in % of position (futures) or sell (spot) coins in % for current quantity
quantity (float) : (float) orders size. Размер ордера.
l_stop (float) : (float). Price for activation stop loss. Цена активации стоп-лосса.
leverageforqty (int) : (bool) use leverage in qty. Использовать плечо при расчете количества или нет.
Returns: 'command_all_close + LongMarket + long_stop.
open_short_position(token, market, ticker_id, type_qty, quantity, s_stop, leverageforqty)
Cancel and close all orders and positions , then open Short position by market price with stop order
Отменяет все лимитки и закрывает все позы по тикеру, затем открывает шорт по маркету с выставлением стопа(переворот позиции, при необходимости).
Parameters:
token (string)
market (string) : (string) 'binance' , 'binancefru' etc.. Строковая переменная названия биржи.
ticker_id (string) : (string) ticker in market ('btcusdt', 'ethusdt' etc...). Строковая переменная названия тикера (пары).
type_qty (string) : (string) type of quantity: 1. 'qty' or '' or na - standart (in coins), 2. 'quqty'- in assets (usdt,btc,etc..), 3.open% - open position(futures) or buy (spot) in % of base 4. close% - close in % of position (futures) or sell (spot) coins in % for current quantity
quantity (float) : (float) orders size. Размер ордера.
s_stop (float) : (float). Price for activation stop loss. Цена активации стоп-лосса.
leverageforqty (int) : (bool) use leverage in qty. Использовать плечо при расчете количества или нет.
Returns: 'command_all_close + ShortMarket + short_stop'.
open_long_trade(token, market, ticker_id, type_qty, quantity, l_stop, qty_ex1, price_ex1, qty_ex2, price_ex2, qty_ex3, price_ex3, leverageforqty)
Cancell and close all orders and positions , then open Long position by market price with stop order and take 1 ,take 2, take 3
Отменяет все лимитки и закрывает все позы по тикеру, затем открывает лонг по маркету с выставлением стопа и 3 тейками (переворот позиции, при необходимости).
Parameters:
token (string)
market (string) : (string) 'binance' , 'binancefru' etc.. Строковая переменная названия биржи.
ticker_id (string) : (string) ticker in market ('btcusdt', 'ethusdt' etc...). Строковая переменная названия тикера (пары).
type_qty (string) : (string) type of quantity: 1. 'qty' or '' or na - standart (in coins), 2. 'quqty'- in assets (usdt,btc,etc..), 3.open% - open position(futures) or buy (spot) in % of base 4. close% - close in % of position (futures) or sell (spot) coins in % for current quantity
quantity (float) : (float) enter order size, see at type_qty. Размер ордера входа, согласно type_qty.
l_stop (float) : (float). Price for activation stop loss. Цена активации стоп-лосса.
qty_ex1 (float) : (float). Quantity for 1th take see at type_qty, if = 0 string for order dont set. Размер лимитного ордера для 1го тейка, согласно type_qty.. Если 0, то строка для этого тейка не формируется
price_ex1 (float) : (float). Price for 1th take , if = 0 string for order dont set. Цена лимитного ордера для 1го тейка. Если 0, то строка для этого тейка не формируется
qty_ex2 (float) : (float). Quantity for 2th take see at type_qty, if = 0 string for order dont set. Размер лимитного ордера для 2го тейка, согласно type_qty..Если 0, то строка для этого тейка не формируется
price_ex2 (float) : (float). Price for 2th take, if = 0 string for order dont set. Цена лимитного ордера для 2го тейка. Если 0, то строка для этого тейка не формируется
qty_ex3 (float) : (float). Quantity for 3th take see at type_qty, if = 0 string for order dont set. Размер лимитного ордера для 2го тейка, согласно type_qty..Если 0, то строка для этого тейка не формируется
price_ex3 (float) : (float). Price for 3th take, if = 0 string for order dont set. Цена лимитного ордера для 3го тейка. Если 0, то строка для этого тейка не формируется
leverageforqty (int)
Returns: 'cancel_all_close + LongMarket + long_stop + CloseLongLimit1 + CloseLongLimit2+CloseLongLimit3'.
open_short_trade(token, market, ticker_id, type_qty, quantity, s_stop, qty_ex1, price_ex1, qty_ex2, price_ex2, qty_ex3, price_ex3, leverageforqty)
Cancell and close all orders and positions , then open Short position by market price with stop order and take 1 and take 2
Отменяет все лимитки и закрывает все позы по тикеру, затем открывает шорт по маркету с выставлением стопа и 3 тейками (переворот позиции, при необходимости).
Parameters:
token (string)
market (string) : (string) 'binance' , 'binancefru' etc.. Строковая переменная названия биржи.
ticker_id (string) : (string) ticker in market ('btcusdt', 'ethusdt' etc...). Строковая переменная названия тикера (пары).
type_qty (string)
quantity (float)
s_stop (float) : (float). Price for activation stop loss. Цена активации стоп-лосса.
qty_ex1 (float) : (float). Quantity for 1th take see at type_qty, if = 0 string for order dont set. Размер лимитного ордера для 1го тейка, согласно type_qty.. Если 0, то строка для этого тейка не формируется
price_ex1 (float) : (float). Price for 1th take , if = 0 string for order dont set. Цена лимитного ордера для 1го тейка. Если 0, то строка для этого тейка не формируется
qty_ex2 (float) : (float). Quantity for 2th take see at type_qty, if = 0 string for order dont set. Размер лимитного ордера для 2го тейка, согласно type_qty..Если 0, то строка для этого тейка не формируется
price_ex2 (float) : (float). Price for 2th take, if = 0 string for order dont set. Цена лимитного ордера для 2го тейка. Если 0, то строка для этого тейка не формируется
qty_ex3 (float) : (float). Quantity for 3th take see at type_qty, if = 0 string for order dont set. Размер лимитного ордера для 2го тейка, согласно type_qty..Если 0, то строка для этого тейка не формируется
price_ex3 (float) : (float). Price for 3th take, if = 0 string for order dont set. Цена лимитного ордера для 3го тейка. Если 0, то строка для этого тейка не формируется
leverageforqty (int)
Returns: 'command_all_close + ShortMarket + short_stop + CloseShortLimit + CloseShortLimit(2)'.
Multi_LongLimit(token, market, ticker_id, type_qty, qty1, price1, qty2, price2, qty3, price3, qty4, price4, qty5, price5, qty6, price6, qty7, price7, qty8, price8, leverageforqty)
8 or less Buy orders with limit price and quantity.
До 8 Лимитных ордеров на покупку(в лонг).
Parameters:
token (string) : (integer or 0) token for trade in system, if = 0 then token part mess is empty. Токен, При значениb = 0 не включается в формирование строки алерта.
market (string) : (string) Spot 'binance' , 'bybit' . Futures ('binancefru','binancefro','bybitfu', 'bybitfi'). Строковая переменная названия биржи.
ticker_id (string) : (string) ticker in market ('btcusdt', 'ethusdt' etc...). Строковая переменная названия тикера (пары).
type_qty (string) : (string) type of quantity: 1. 'qty' or '' or na - standart (in coins), 2. 'quqty'- in assets (usdt,btc,etc..), 3.open% - open position(futures) or buy (spot) in % of base 4. close% - close in % of position (futures) or sell (spot) coins in % for current quantity
qty1 (float)
price1 (float)
qty2 (float)
price2 (float)
qty3 (float)
price3 (float)
qty4 (float)
price4 (float)
qty5 (float)
price5 (float)
qty6 (float)
price6 (float)
qty7 (float)
price7 (float)
qty8 (float)
price8 (float)
leverageforqty (bool) : (bool) use leverage in qty. Использовать плечо при расчете количества или нет.
Returns: 'Limit Buy order'. Лимитный ордер на покупку (лонг).
LibreLibrary "Libre"
TODO: add library description here
MMMM(toe)
Parameters:
toe (string)
OOOO(toe, toe1, toe2, toe3, toe4, toe5, init)
Parameters:
toe (string)
toe1 (string)
toe2 (string)
toe3 (string)
toe4 (string)
toe5 (string)
init (int)
XXXX(toe)
Parameters:
toe (string)
WWWW(toe)
Parameters:
toe (string)
string_utilsLibrary "string_utils"
Collection of string utilities that can be used to replace sub-strings in a string and string functions
that are not part of the standard library.
This a more simple replacement of my previous string_variables library since it uses types for better
performance due to data locality and methods that give a more intuitive API.
PineTradingbotWebhookLibrary "PineTradingbotWebhook"
makeWebhookJson(webhookKey, direction, qty, entryLimit, entryStop, exitLimit, exitStop, orderRef, contract)
Creates a Webhook message for Tbot on Tradingboat
Parameters:
webhookKey : the unique key to the Flask (TVWB) server
direction : the same as the strategy's direction
qty
entryLimit
entryStop
exitLimit
exitStop
orderRef
contract
Returns: JSON as a string
jsonLibrary "json"
JSON Easy Object Create/stringiffy
Functions to add/write JSON
new (name , kind) -> object
set (_item , _obj , _key ) -> key index for parent object's array
add (_obj , _key , _item ) -> key index for parent object's array
write (object , kind ) -> stringified object // (enter kind to cut off key )
============================================
obj
obj Object storage container/item
Fields:
key : (string ) item name
kind : (string ) item's type(for writing)
item : (string ) item (converted to string)
keys : (string ) keys of all sub-items and objects
items : (obj ) nested obj off individual subitems (for later...)
============================================
new(_name, _kind)
create multitype object
Parameters:
_name : (string) Name off object
_kind : (string) Preset Type (_OBJECT if a container item)
Returns: object container/item 2-in-1
============================================
add(_item, _obj, _key)
Set item to object obj item (same as set, prep for future Pine methods)
Parameters:
_item : ( int / float / bool / string )
_obj : (obj multi-type-item object)
_key : ( string )
set(_item, _obj, _key)
Set item to object obj item (same as add, prep for future Pine methods)
Parameters:
_item : ( int / float / bool / string )
_obj : (obj multi-type-item object)
_key : ( string )
addstore(_parent, _child)
Add a object as a subobject to storage (Future upgrade to write/edit)
Parameters:
_parent : to insert obj into
_child : to be inserted
setstore(_child, _parent)
Add a object as a subobject to storage (Future upgrade to write/edit)
Parameters:
_child : to be inserted
_parent : to insert obj into
add(_parent, _child)
Add a object as a string rendered item
Parameters:
_parent : to insert obj into
_child : to be inserted
set(_child, _parent)
Add a object as a string rendered item
Parameters:
_child : to be inserted
_parent : to insert obj into
============================================
write(_object, _key, _itemname)
Write object to string Object
Parameters:
_object : (obj)
_key : (array<(string/int)> )/(string)
_itemname : (string)
Returns: stringified flattened object.
clean_output(_str)
Clean JSON final output
Parameters:
_str : string json item
Returns: cleaned string
POALibrary "POA"
This library is a client script for making a webhook signal formatted string to POABOT server.
entry_message(password, percent, leverage, kis_number)
Create a entry message for POABOT
Parameters:
password : (string) The password of your bot.
percent : (float) The percent for entry based on your wallet balance.
leverage : (int) The leverage of entry. If not set, your levereage doesn't change.
kis_number : (int) The number of koreainvestment account.
Returns: (string) A json formatted string for webhook message.
close_message(password, percent, kis_number)
Create a close message for POABOT
Parameters:
password : (string) The password of your bot.
percent : (float) The percent for close based on your wallet balance.
kis_number : (int) The number of koreainvestment account.
Returns: (string) A json formatted string for webhook message.
exit_message(password, percent)
Create a exit message for POABOT
Parameters:
password : (string) The password of your bot.
percent : (float) The percent for exit based on your wallet balance.
Returns: (string) A json formatted string for webhook message.
in_trade(start_time, end_time)
Create a trade start line
Parameters:
start_time : (int) The start of time.
end_time : (int) The end of time.
Returns: (bool) Get bool for trade based on time range.
PlurexSignalStrategyLibrary "PlurexSignalStrategy"
Provides functions that wrap the built in TradingView strategy functions so you can seemlessly integrate with Plurex Signal automation.
NOTE: Be sure to:
- set your strategy default_qty_value to the default entry percentage of your signal
- set your strategy default_qty_type to strategy.percent_of_equity
- set your strategy pyramiding to some value greater than 1 or something appropriate to your strategy in order to have multiple entries.
long(secret, budgetPercentage, priceLimit, marketOverride)
Open a new long entry. Wraps strategy function and sends plurex message as an alert.
Parameters:
secret : The secret for your Signal on plurex
budgetPercentage : Optional, The percentage of budget to use in the entry.
priceLimit : Optional, The worst price to accept for the entry.
marketOverride : Optional, defaults to the syminfo for the ticker. Use the `plurexMarket` function to build your own.
longAndFixedStopLoss(secret, stop, budgetPercentage, priceLimit, marketOverride)
Open a new long entry. Wraps strategy function and sends plurex message as an alert. Also sets a gobal stop loss for full open position
Parameters:
secret : The secret for your Signal on plurex
stop : The trigger price for the stop loss. See strategy.exit documentation
budgetPercentage : Optional, The percentage of budget to use in the entry.
priceLimit : Optional, The worst price to accept for the entry.
marketOverride : Optional, defaults to the syminfo for the ticker. Use the `plurexMarket` function to build your own.
longAndTrailingStopLoss(secret, trail_offset, trail_price, trail_points, budgetPercentage, priceLimit, marketOverride)
Open a new long entry. Wraps strategy function and sends plurex message as an alert. Also sets a gobal trailing stop loss for full open position. You must set one of trail_price or trail_points.
Parameters:
secret : The secret for your Signal on plurex
trail_offset : See strategy.exit documentation
trail_price : See strategy.exit documentation
trail_points : See strategy.exit documentation
budgetPercentage : Optional, The percentage of budget to use in the entry.
priceLimit : Optional, The worst price to accept for the entry.
marketOverride : Optional, defaults to the syminfo for the ticker. Use the `plurexMarket` function to build your own.
short(secret, budgetPercentage, priceLimit, marketOverride)
Open a new short entry. Wraps strategy function and sends plurex message as an alert.
Parameters:
secret : The secret for your Signal on plurex
budgetPercentage : Optional, The percentage of budget to use in the entry.
priceLimit : Optional, The worst price to accept for the entry.
marketOverride : Optional, defaults to the syminfo for the ticker. Use the `plurexMarket` function to build your own.
shortAndFixedStopLoss(secret, stop, budgetPercentage, priceLimit, marketOverride)
Open a new short entry. Wraps strategy function and sends plurex message as an alert. Also sets a gobal stop loss for full open position
Parameters:
secret : The secret for your Signal on plurex
stop : The trigger price for the stop loss. See strategy.exit documentation
budgetPercentage : Optional, The percentage of budget to use in the entry.
priceLimit : Optional, The worst price to accept for the entry.
marketOverride : Optional, defaults to the syminfo for the ticker. Use the `plurexMarket` function to build your own.
shortAndTrailingStopLoss(secret, trail_offset, trail_price, trail_points, budgetPercentage, priceLimit, marketOverride)
Open a new short entry. Wraps strategy function and sends plurex message as an alert. Also sets a gobal trailing stop loss for full open position. You must set one of trail_price or trail_points.
Parameters:
secret : The secret for your Signal on plurex
trail_offset : See strategy.exit documentation
trail_price : See strategy.exit documentation
trail_points : See strategy.exit documentation
budgetPercentage : Optional, The percentage of budget to use in the entry.
priceLimit : Optional, The worst price to accept for the entry.
marketOverride : Optional, defaults to the syminfo for the ticker. Use the `plurexMarket` function to build your own.
closeAll(secret, marketOverride)
Close all positions. Wraps strategy function and sends plurex message as an alert.
Parameters:
secret : The secret for your Signal on plurex
marketOverride : Optional, defaults to the syminfo for the ticker. Use the `plurexMarket` function to build your own.
closeLongs(secret, marketOverride)
close all longs. Wraps strategy function and sends plurex message as an alert.
Parameters:
secret : The secret for your Signal on plurex
marketOverride : Optional, defaults to the syminfo for the ticker. Use the `plurexMarket` function to build your own.
closeShorts(secret, marketOverride)
close all shorts. Wraps strategy function and sends plurex message as an alert.
Parameters:
secret : The secret for your Signal on plurex
marketOverride : Optional, defaults to the syminfo for the ticker. Use the `plurexMarket` function to build your own.
closeLastLong(secret, marketOverride)
Close last long entry. Wraps strategy function and sends plurex message as an alert.
Parameters:
secret : The secret for your Signal on plurex
marketOverride : Optional, defaults to the syminfo for the ticker. Use the `plurexMarket` function to build your own.
closeLastShort(secret, marketOverride)
Close last short entry. Wraps strategy function and sends plurex message as an alert.
Parameters:
secret : The secret for your Signal on plurex
marketOverride : Optional, defaults to the syminfo for the ticker. Use the `plurexMarket` function to build your own.
closeFirstLong(secret, marketOverride)
Close first long entry. Wraps strategy function and sends plurex message as an alert.
Parameters:
secret : The secret for your Signal on plurex
marketOverride : Optional, defaults to the syminfo for the ticker. Use the `plurexMarket` function to build your own.
closeFirstShort(secret, marketOverride)
Close first short entry. Wraps strategy function and sends plurex message as an alert.
Parameters:
secret : The secret for your Signal on plurex
marketOverride : Optional, defaults to the syminfo for the ticker. Use the `plurexMarket` function to build your own.
PlurexSignalCoreLibrary "PlurexSignalCore"
General purpose functions and helpers for use in more specific Plurex Signal alerting scripts and libraries
plurexMarket()
Build a Plurex market string from a base and quote asset symbol.
Returns: A market string that can be used in Plurex Signal messages.
tickerToPlurexMarket()
Builds Plurex market string from the syminfo
Returns: A market string that can be used in Plurex Signal messages.
simpleMessage(secret, action, marketOverride)
Builds Plurex Signal Message json to be sent to a Signal webhook
Parameters:
secret : The secret for your Signal on plurex
action : The action of the message. One of .
marketOverride : Optional, defaults to the syminfo for the ticker. Use the `plurexMarket` function to build your own.
Returns: A json string message that can be used in alerts to send messages to Plurex.
entryMessage(secret, isLong, budgetPercentage, priceLimit, marketOverride)
Builds Plurex Signal Entry Message json to be sent to a Signal webhook with optional parameters for budget and price limits.
Parameters:
secret : The secret for your Signal on plurex
isLong : The action of the message. true for LONG, false for SHORT.
budgetPercentage : Optional, The percentage of budget to use in the entry.
priceLimit : Optional, The worst price to accept for the entry.
marketOverride : Optional, defaults to the syminfo for the ticker. Use the `plurexMarket` function to build your own.
Returns: A json string message that can be used in alerts to send messages to Plurex.
long(secret, budgetPercentage, priceLimit, marketOverride)
Builds Plurex Signal LONG Message json to be sent to a Signal webhook with optional parameters for budget and price limits.
Parameters:
secret : The secret for your Signal on plurex
budgetPercentage : Optional, The percentage of budget to use in the entry.
priceLimit : Optional, The worst price to accept for the entry.
marketOverride : Optional, defaults to the syminfo for the ticker. Use the `plurexMarket` function to build your own.
Returns: A json string message that can be used in alerts to send messages to Plurex.
short(secret, budgetPercentage, priceLimit, marketOverride)
Builds Plurex Signal SHORT Message json to be sent to a Signal webhook with optional parameters for budget and price limits.
Parameters:
secret : The secret for your Signal on plurex
budgetPercentage : Optional, The percentage of budget to use in the entry.
priceLimit : Optional, The worst price to accept for the entry.
marketOverride : Optional, defaults to the syminfo for the ticker. Use the `plurexMarket` function to build your own.
Returns: A json string message that can be used in alerts to send messages to Plurex.
closeAll(secret, marketOverride)
Builds Plurex Signal CLOSE_ALL Message json to be sent to a Signal webhook.
Parameters:
secret : The secret for your Signal on plurex
marketOverride : Optional, defaults to the syminfo for the ticker. Use the `plurexMarket` function to build your own.
Returns: A json string message that can be used in alerts to send messages to Plurex.
closeShorts(secret, marketOverride)
Builds Plurex Signal CLOSE_SHORTS Message json to be sent to a Signal webhook.
Parameters:
secret : The secret for your Signal on plurex
marketOverride : Optional, defaults to the syminfo for the ticker. Use the `plurexMarket` function to build your own.
Returns: A json string message that can be used in alerts to send messages to Plurex.
closeLongs(secret, marketOverride)
Builds Plurex Signal CLOSE_LONGS Message json to be sent to a Signal webhook.
Parameters:
secret : The secret for your Signal on plurex
marketOverride : Optional, defaults to the syminfo for the ticker. Use the `plurexMarket` function to build your own.
Returns: A json string message that can be used in alerts to send messages to Plurex.
closeFirstLong(secret, marketOverride)
Builds Plurex Signal CLOSE_FIRST_LONG Message json to be sent to a Signal webhook.
Parameters:
secret : The secret for your Signal on plurex
marketOverride : Optional, defaults to the syminfo for the ticker. Use the `plurexMarket` function to build your own.
Returns: A json string message that can be used in alerts to send messages to Plurex.
closeLastLong(secret, marketOverride)
Builds Plurex Signal CLOSE_LAST_LONG Message json to be sent to a Signal webhook.
Parameters:
secret : The secret for your Signal on plurex
marketOverride : Optional, defaults to the syminfo for the ticker. Use the `plurexMarket` function to build your own.
Returns: A json string message that can be used in alerts to send messages to Plurex.
closeFirstShort(secret, marketOverride)
Builds Plurex Signal CLOSE_FIRST_SHORT Message json to be sent to a Signal webhook.
Parameters:
secret : The secret for your Signal on plurex
marketOverride : Optional, defaults to the syminfo for the ticker. Use the `plurexMarket` function to build your own.
Returns: A json string message that can be used in alerts to send messages to Plurex.
closeLastShort(secret, marketOverride)
Builds Plurex Signal CLOSE_LAST_SHORT Message json to be sent to a Signal webhook.
Parameters:
secret : The secret for your Signal on plurex
marketOverride : Optional, defaults to the syminfo for the ticker. Use the `plurexMarket` function to build your own.
Returns: A json string message that can be used in alerts to send messages to Plurex.
libcompressLibrary "libcompress"
numbers compressor for large output data compression
compress_fp24()
converts float to base64 (4 chars) | 24 bits: 1 sign + 5 exponent + 18 mantissa
Returns: 4-character base64_1/5/18 representation of x
compress_ufp18()
converts unsigned float to base64 (3 chars) | 18 bits: 5 exponent + 13 mantissa
Returns: 3-character base64_0/5/13 representation of x
compress_int()
converts int to base64
FrostyBotLibrary "FrostyBot"
JSON Alert Builder for FrostyBot.js Binance Futures and FTX orders
github.com
More Complete Version Soon.
TODO: Comment Functions and annotations from command reference ^^
TODO: Add additional whitelist and symbol mappings.
leverage()
buy()
sell()
cancelall()
closelong()
closeshort()
traillong()
trailshort()
long()
short()
takeprofit()
stoploss()
PineHelperLibrary "PineHelper"
This library provides various functions to reduce your time.
recent_opentrade_entry_bar_index()
get a recent opentrade entry bar_index
Returns: (int) bar_index
recent_closedtrade_entry_bar_index()
get a recent closedtrade entry bar_index
Returns: (int) bar_index
recent_closedtrade_exit_bar_index()
get a recent closedtrade exit bar_index
Returns: (int) bar_index
all_opnetrades_roi()
get all aopentrades roi
Returns: (float) roi
bars_since_recent_opentrade_entry()
get bars since recent opentrade entry
Returns: (int) number of bars
bars_since_recent_closedtrade_entry()
get bars since recent closedtrade entry
Returns: (int) number of bars
bars_since_recent_closedtrade_exit()
get bars since recent closedtrade exit
Returns: (int) number of bars
recent_opentrade_entry_id()
get recent opentrade entry ID
Returns: (string) entry ID
recent_closedtrade_entry_id()
get recent closedtrade entry ID
Returns: (string) entry ID
recent_closedtrade_exit_id()
get recent closedtrade exit ID
Returns: (string) exit ID
recent_opentrade_entry_price()
get recent opentrade entry price
Returns: (float) price
recent_closedtrade_entry_price()
get recent closedtrade entry price
Returns: (float) price
recent_closedtrade_exit_price()
get recent closedtrade exit price
Returns: (float) price
recent_opentrade_entry_time()
get recent opentrade entry time
Returns: (int) time
recent_closedtrade_entry_time()
get recent closedtrade entry time
Returns: (int) time
recent_closedtrade_exit_time()
get recent closedtrade exit time
Returns: (int) time
time_since_recent_opentrade_entry()
get time since recent opentrade entry
Returns: (int) time
time_since_recent_closedtrade_entry()
get time since recent closedtrade entry
Returns: (int) time
time_since_recent_closedtrade_exit()
get time since recent closedtrade exit
Returns: (int) time
recent_opentrade_size()
get recent opentrade size
Returns: (float) size
recent_closedtrade_size()
get recent closedtrade size
Returns: (float) size
all_opentrades_size()
get all opentrades size
Returns: (float) size
recent_opentrade_profit()
get recent opentrade profit
Returns: (float) profit
all_opentrades_profit()
get all opentrades profit
Returns: (float) profit
recent_closedtrade_profit()
get recent closedtrade profit
Returns: (float) profit
recent_opentrade_max_runup()
get recent opentrade max runup
Returns: (float) runup
recent_closedtrade_max_runup()
get recent closedtrade max runup
Returns: (float) runup
recent_opentrade_max_drawdown()
get recent opentrade maxdrawdown
Returns: (float) mdd
recent_closedtrade_max_drawdown()
get recent closedtrade maxdrawdown
Returns: (float) mdd
max_open_trades_drawdown()
get max open trades drawdown
Returns: (float) mdd
recent_opentrade_commission()
get recent opentrade commission
Returns: (float) commission
recent_closedtrade_commission()
get recent closedtrade commission
Returns: (float) commission
qty_by_percent_of_equity(percent)
get qty by percent of equtiy
Parameters:
percent : (series float) percent that you want to set
Returns: (float) quantity
qty_by_percent_of_position_size(percent)
get size by percent of position size
Parameters:
percent : (series float) percent that you want to set
Returns: (float) size
is_day_change()
get bool change of day
Returns: (bool) day is change or not
is_in_trade()
get bool using number of bars
Returns: (bool) allowedToTrade
discord_message(name, message)
get json format discord message
Parameters:
name : (string) name of bot
message : (string) message that you want to send
Returns: (string) json format string
telegram_message(chat_id, message)
get json format telegram message
Parameters:
chat_id : (string) chatId of bot
message : (string) message that you want to send
Returns: (string) json format string
PlurexSignalLibrary "PlurexSignal"
Provides functions that wrap the built in TradingView strategy functions so you can seemlessly integrate with Plurex Signal automation.
NOTE: Be sure to set your strategy close_entries_rule="ANY" and pyramiding=20 or some other amount appropriate to your strategy in order to have multiple entries.
plurexMarket()
Build a Plurex market string from a base and quote asset symbol.
Returns: A market string that can be used in Plurex Signal messages.
tickerToPlurexMarket()
Builds Plurex market string from the syminfo
Returns: A market string that can be used in Plurex Signal messages.
simpleMessage(secret, action, marketOverride)
Builds Plurex Signal Message json to be sent to a Signal webhook
Parameters:
secret : The secret for your Signal on plurex
action : The action of the message. One of .
marketOverride : Optional, defaults to the syminfo for the ticker. Use the `plurexMarket` function to build your own.
Returns: A json string message that can be used in alerts to send messages to Plurex.
long(secret, marketOverride, qty)
Open a new long entry. Wraps strategy function and sends plurex message as an alert.
Parameters:
secret : The secret for your Signal on plurex
marketOverride : Optional, defaults to the syminfo for the ticker. Use the `plurexMarket` function to build your own.
qty : Corresponds to strategy.entry qty
short(secret, marketOverride, qty)
Open a new short entry. Wraps strategy function and sends plurex message as an alert.
Parameters:
secret : The secret for your Signal on plurex
marketOverride : Optional, defaults to the syminfo for the ticker. Use the `plurexMarket` function to build your own.
qty : Corresponds to strategy.entry qty
closeAll(secret, marketOverride)
Close all positions. Wraps strategy function and sends plurex message as an alert.
Parameters:
secret : The secret for your Signal on plurex
marketOverride : Optional, defaults to the syminfo for the ticker. Use the `plurexMarket` function to build your own.
closeLongs(secret, marketOverride)
Close all longs. Wraps strategy function and sends plurex message as an alert.
Parameters:
secret : The secret for your Signal on plurex
marketOverride : Optional, defaults to the syminfo for the ticker. Use the `plurexMarket` function to build your own.
closeShorts(secret, marketOverride)
Close all shorts. Wraps strategy function and sends plurex message as an alert.
Parameters:
secret : The secret for your Signal on plurex
marketOverride : Optional, defaults to the syminfo for the ticker. Use the `plurexMarket` function to build your own.
closeLastLong(secret, marketOverride)
Close last long entry. Wraps strategy function and sends plurex message as an alert.
Parameters:
secret : The secret for your Signal on plurex
marketOverride : Optional, defaults to the syminfo for the ticker. Use the `plurexMarket` function to build your own.
closeFirstLong(secret, marketOverride)
Close first long entry. Wraps strategy function and sends plurex message as an alert.
Parameters:
secret : The secret for your Signal on plurex
marketOverride : Optional, defaults to the syminfo for the ticker. Use the `plurexMarket` function to build your own.
closeLastShort(secret, marketOverride)
Close last short entry. Wraps strategy function and sends plurex message as an alert.
Parameters:
secret : The secret for your Signal on plurex
marketOverride : Optional, defaults to the syminfo for the ticker. Use the `plurexMarket` function to build your own.
closeFirstShort(secret, marketOverride)
Close first short entry. Wraps strategy function and sends plurex message as an alert.
Parameters:
secret : The secret for your Signal on plurex
marketOverride : Optional, defaults to the syminfo for the ticker. Use the `plurexMarket` function to build your own.
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)
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
ccIndicatorLibrary "ccIndicator"
isMACD_bullCondition()
isMACD_bearCondition()
getProfitPrice()
getLossPrice()
isTouchProfitPrice()
isTouchLossPrice()