PINE LIBRARY
已更新 eStrategy

Library "eStrategy"
Library contains methods which can help build custom strategy for continuous investment plans and also compare it with systematic buy and hold.
sip(startYear, initialDeposit, depositFrequency, recurringDeposit, buyPrice) Depicts systematic buy and hold over period of time
Parameters:
startYear: Year on which SIP is started
initialDeposit: Initial one time investment at the start
depositFrequency: Frequency of recurring deposit - can be monthly or weekly
recurringDeposit: Recurring deposit amount
buyPrice: Indicatinve buy price. Use high to be conservative. low, close, open, hl2, hlc3, ohlc4, hlcc4 are other options.
Returns: totalInvestment - initial + recurring deposits
totalQty - Quantity of units held for given instrument
totalEquity - Present equity
customStrategy(startYear, initialDeposit, depositFrequency, recurringDeposit, buyPrice, sellPrice, initialInvestmentPercent, recurringInvestmentPercent, signal, tradePercent) Allows users to define custom strategy and enhance systematic buy and hold by adding take profit and reloads
Parameters:
startYear: Year on which SIP is started
initialDeposit: Initial one time investment at the start
depositFrequency: Frequency of recurring deposit - can be monthly or weekly
recurringDeposit: Recurring deposit amount
buyPrice: Indicatinve buy price. Use high to be conservative. low, close, open, hl2, hlc3, ohlc4, hlcc4 are other options.
sellPrice: Indicatinve sell price. Use low to be conservative. high, close, open, hl2, hlc3, ohlc4, hlcc4 are other options.
initialInvestmentPercent: percent of amount to invest from the initial depost. Keep rest of them as cash
recurringInvestmentPercent: percent of amount to invest from recurring deposit. Keep rest of them as cash
signal: can be 1, -1 or 0. 1 means buy/reload. -1 means take profit and 0 means neither.
tradePercent: percent of amount to trade when signal is not 0. If taking profit, it will sell the percent from existing position. If reloading, it will buy with percent from cash reserve
Returns: totalInvestment - initial + recurring deposits
totalQty - Quantity of units held for given instrument
totalCash = Amount of cash held
totalEquity - Overall equity = totalQty*close + totalCash
Library contains methods which can help build custom strategy for continuous investment plans and also compare it with systematic buy and hold.
sip(startYear, initialDeposit, depositFrequency, recurringDeposit, buyPrice) Depicts systematic buy and hold over period of time
Parameters:
startYear: Year on which SIP is started
initialDeposit: Initial one time investment at the start
depositFrequency: Frequency of recurring deposit - can be monthly or weekly
recurringDeposit: Recurring deposit amount
buyPrice: Indicatinve buy price. Use high to be conservative. low, close, open, hl2, hlc3, ohlc4, hlcc4 are other options.
Returns: totalInvestment - initial + recurring deposits
totalQty - Quantity of units held for given instrument
totalEquity - Present equity
customStrategy(startYear, initialDeposit, depositFrequency, recurringDeposit, buyPrice, sellPrice, initialInvestmentPercent, recurringInvestmentPercent, signal, tradePercent) Allows users to define custom strategy and enhance systematic buy and hold by adding take profit and reloads
Parameters:
startYear: Year on which SIP is started
initialDeposit: Initial one time investment at the start
depositFrequency: Frequency of recurring deposit - can be monthly or weekly
recurringDeposit: Recurring deposit amount
buyPrice: Indicatinve buy price. Use high to be conservative. low, close, open, hl2, hlc3, ohlc4, hlcc4 are other options.
sellPrice: Indicatinve sell price. Use low to be conservative. high, close, open, hl2, hlc3, ohlc4, hlcc4 are other options.
initialInvestmentPercent: percent of amount to invest from the initial depost. Keep rest of them as cash
recurringInvestmentPercent: percent of amount to invest from recurring deposit. Keep rest of them as cash
signal: can be 1, -1 or 0. 1 means buy/reload. -1 means take profit and 0 means neither.
tradePercent: percent of amount to trade when signal is not 0. If taking profit, it will sell the percent from existing position. If reloading, it will buy with percent from cash reserve
Returns: totalInvestment - initial + recurring deposits
totalQty - Quantity of units held for given instrument
totalCash = Amount of cash held
totalEquity - Overall equity = totalQty*close + totalCash
發行說明
v2Added:
getEquityAthAndDrawdown(equity) Calculates max equity, current drawdown from equity ATH and max drawdown
Parameters:
equity: Present equity value
Returns: equityAth - Equity all time high
drawdown - Present drawdown percentage from equity ATH
maxDrawdown - Max drawdown percentage
發行說明
v3Added:
getAverageCashPercent(cash, equity) Calculates average cash holding percent for strategy
Parameters:
cash: Present cash holding
equity: Present equity value
Returns: currentCashPercent - Cash Percent of Equity
avgCashPercent - Average cash percent of equity
發行說明
v4Updated: Added dividends to equation
Pine腳本庫
秉持 TradingView 一貫的共享精神,作者將此 Pine 程式碼發佈為開源庫,讓社群中的其他 Pine 程式設計師能夠重複使用。向作者致敬!您可以在私人專案或其他開源發佈中使用此庫,但在公開發佈中重複使用該程式碼需遵守社群規範。
Trial - trendoscope.io/trial
Subscribe - trendoscope.io/pricing
Blog - docs.trendoscope.io
Subscribe - trendoscope.io/pricing
Blog - docs.trendoscope.io
免責聲明
這些資訊和出版物並不意味著也不構成TradingView提供或認可的金融、投資、交易或其他類型的意見或建議。請在使用條款閱讀更多資訊。
Pine腳本庫
秉持 TradingView 一貫的共享精神,作者將此 Pine 程式碼發佈為開源庫,讓社群中的其他 Pine 程式設計師能夠重複使用。向作者致敬!您可以在私人專案或其他開源發佈中使用此庫,但在公開發佈中重複使用該程式碼需遵守社群規範。
Trial - trendoscope.io/trial
Subscribe - trendoscope.io/pricing
Blog - docs.trendoscope.io
Subscribe - trendoscope.io/pricing
Blog - docs.trendoscope.io
免責聲明
這些資訊和出版物並不意味著也不構成TradingView提供或認可的金融、投資、交易或其他類型的意見或建議。請在使用條款閱讀更多資訊。