How to Use MonthlyReturnTable

114
MonthlyReturnTable
  • https://kr.tradingview.com/script/HRuWLIsv/
  • Displays ROI, profit, maximum drawdown, and number of trades by month and year.
  • The results may not be accurate, so use them for reference only.
  • This script can be added to the bottom of a strategy script for use.
  • Written in PineScript version 6.


Settings
Mode : Value Type
  • ROI : Return on Investment(%)
  • Profit : Profit Amount
  • MDD : Maximum Drawdown(%)
  • Trade : Number of Trades

Position : Table Position - Displays the table in 9 locations on the chart, combining top/middle/bottom and left/center/right.
Precision : Value Precision - Specifies decimal precision (not applied to the number of trades).
Text : Font Size - 0 is automatic.
MARGIN : Sets the top, bottom, left, and right margins of the table.
COLOR : Sets the cell and text colors of the table.
  • Head : Title Cell
  • Bull : Positive Value Cell
  • Bear : Negative Value Cell
  • Zero : Zero Value Cell


How to Apply
  • Copy the script below and paste it at the bottom of the strategy script.
  • Cannot be applied to private scripts that are not publicly shared.
  • Comments can be removed.

Pine Script®
import CHULTOO/MonthlyReturnTable/1 // Output mode and table position string mode = input.string("ROI", title = "Mode", options = ["None", "ROI", "Profit", "MDD", "Trade"], group = "Monthly Return Table settings ──────────────", inline = "0", display = display.none) string tablePosition = input.string(position.bottom_right, "Position", options = [position.top_left, position.top_center, position.top_right, position.middle_left, position.middle_center, position.middle_right, position.bottom_left, position.bottom_center, position.bottom_right], group = "Monthly Return Table settings ──────────────", inline = "0", display = display.none) // Precision and font size int precision = input.int(2, "Precision", minval = 0, group = "Monthly Return Table settings ──────────────", inline = "1", display = display.none) int textSize = input.int(12, "Text", minval = 0, group = "Monthly Return Table settings ──────────────", inline = "1", display = display.none, tooltip = "Text size 0 = Auto") // Table margins int marginTop = input.int(0, "Top", minval = 0, group = "Margin", inline = "2", display = display.none) int marginBottom = input.int(0, "Bottom", minval = 0, group = "Margin", inline = "2", display = display.none) int marginLeft = input.int(0, "Left", minval = 0, group = "Margin", inline = "3", display = display.none) int marginRight = input.int(0, "Right", minval = 0, group = "Margin", inline = "3", display = display.none) // Table colors (header, profit, loss, principal) var color colorHead = input.color(#808080, title = "Head", group = "Color", inline = "1", display = display.none) var color colorBull = input.color(#089981, title = "Bull", group = "Color", inline = "1", display = display.none) var color colorBear = input.color(#F23645, title = "Bear", group = "Color", inline = "1", display = display.none) var color colorZero = input.color(#808080, title = "Zero", group = "Color", inline = "1", display = display.none) MonthlyReturnTable.get_table(mode, tablePosition, precision, textSize, marginTop, marginBottom, marginLeft, marginRight, colorHead, colorBull, colorBear, colorZero)


Application Method
  • If the variable name mode is already used in the existing strategy, change it to a different name such as dataType.
  • Removing precision, font size, and color settings - Since precision and font size are in the middle of the function parameters, you must delete them from the middle and explicitly specify the names of the subsequent parameters when calling the function.

Pine Script®
import CHULTOO/MonthlyReturnTable/1 // Output mode and table position string dataType = input.string("ROI", title = "Mode", options = ["None", "ROI", "Profit", "MDD", "Trade"], group = "Monthly Return Table settings ──────────────", inline = "0", display = display.none) string tablePosition = input.string(position.bottom_right, "Position", options = [position.top_left, position.top_center, position.top_right, position.middle_left, position.middle_center, position.middle_right, position.bottom_left, position.bottom_center, position.bottom_right], group = "Monthly Return Table settings ──────────────", inline = "0", display = display.none) // Table margins int marginTop = input.int(0, "Top", minval = 0, group = "Margin", inline = "2", display = display.none) int marginBottom = input.int(0, "Bottom", minval = 0, group = "Margin", inline = "2", display = display.none) int marginLeft = input.int(0, "Left", minval = 0, group = "Margin", inline = "3", display = display.none) int marginRight = input.int(0, "Right", minval = 0, group = "Margin", inline = "3", display = display.none) MonthlyReturnTable.get_table(dataType, tablePosition, marginTop = marginTop, marginBottom = marginBottom, marginLeft = marginLeft, marginRight = marginRight)

Disclaimer

The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.