Trendoscope

eStrategy

Trendoscope Wizard 已更新   
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
版本注释:
v2

Added:
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
版本注释:
v3

Added:
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
版本注释:
v4

Updated: Added dividends to equation

Pine脚本库

本着真正的TradingView精神,作者将此Pine代码以开源脚本库发布,以便我们社区的其他Pine程序员可以重用它。向作者致敬!您可以私下或在其他开源出版物中使用此库,但在出版物中重用此代码受网站规则约束。

免责声明

这些信息和出版物并不意味着也不构成TradingView提供或认可的金融、投资、交易或其它类型的建议或背书。请在使用条款阅读更多信息。

想使用这个脚本库吗?

复制以下行并将其粘贴到您的脚本中。