Template:Interactive calculator/doc

This template calculates a Tax Withholding Ratio (TWR) for an ETF when held by a US nonresident alien, from values entered into the page by the user. The definition of TWR is:

TWR = (Yield × L1TW) + ((Yield × (1 - L1TW) - TER) × L2TW)

Where:
 * L1TW: Percentage of tax withholding by a security's home country on dividends distributed by that security to the fund (Level 1).
 * L2TW: Percentage of tax withholding by the country where the fund is domiciled on the dividends distributed to the investor by the fund (Level 2).
 * Yield: Annual yield of the fund.
 * TER: The fund's Total Expense Ratio.

This template uses JavaScript to provide live in-page calculations. The computed TWR is updated on pressing the 'Calculate' button, or when the user changes any of the input values.

Usage
Invoke with:

This template takes no arguments. The default input values are currently hardcoded. This template may be transcluded multiple times on a single page.

Examples
These two calculators should operate correctly and independently of each other:

Source code
For technical reasons, this template wraps its source code in Base64 encoding. This means that it is not directly visible in the wikitext editor. A listing of the decoded source code is shown below. For more on why this is necessary, and for general notes on how this template is designed and how to work with its JavaScript code, see Template Talk:TWR Calculator.