PureRebalanceLibrary "PureRebalance"
A rebalance function that is pure.
Depends only on its arguments to perform the necessary calculations.
rebalance(token_price, portfolio_token_amount, portfolio_fiat_amount, rebalance_ratio) Rebalances a portfolio made of tokens and fiat to a given ratio of tokens per fiat
Parameters:
token_price : The value of a single unit (1) token
portfolio_token_amount : The number of tokens in the portfolio
portfolio_fiat_amount : Fiat available in the portfolio
rebalance_ratio : The ratio of token value / fiat that the portfolio should have after the rebalance (0.5 is used if no argument is supplied).
Returns: The number of tokens to buy or sell in order to achieve the desired portfolio ratio passed as argument (a positive value is returned if the tokens are to be bought, and negative value if the tokens are to be sold).
Strategies
MHCustomSpotTradingLibraryLibrary "MHCustomSpotTradingLibrary"
HMA(float, float)
Parameters:
float : _src price data
float : _length Period
Returns: Hull Moving Average
EHMA(float, float)
Parameters:
float : _src price data
float : _length Period
Returns: EHMA Moving Average
THMA(float, float)
Parameters:
float : _src price data
float : _length Period
Returns: THMA Moving Average
HullMode(string, float, float)
Parameters:
string : modeSwitch Hull type
float : _src price data
float : _length Period
Returns: A Moving Average
start_Dates(int, int, int)
Parameters:
int : year
int : month
int : day
Returns: Start Date
stop_Dates(int, int, int)
Parameters:
int : year
int : month
int : day
Returns: Stop Date
f_print(string, int, int)
Parameters:
string : _text
int : col
int : row
Returns: Nothing
showStats()
greenCandle()
redCandle()
getDecimals()
truncate()
toWhole()
toPips()
getMA()
getEAP()
barsAboveMA()
barsBelowMA()
barsCrossedMA()
getPullbackBarCount()
getBodySize()
getTopWickSize()
getBottomWickSize()
getBodyPercent()
isHammer()
isStar()
isDoji()
isBullishEC()
isBearishEC()
timeFilter()
dateFilter()
dayFilter()
atrFilter()
fillCell()
GenericTradingLibrary "GenericTrading"
This library aims to collect rare but useful operations for
get_most_recent_long_or_short_position_closed_index() : returns most recent long/short closed bar index.
get_most_recent_long_or_short_position_open_index() : returns most recent long/short closed bar index.
These two functions designed to help to speed up the coding for strategies that contains "re-enter" logic.
These two functions also could applies in the situations where time-count is needed in your condition.