PHP Code:
//@version=6
indicator('Dynamic Grid Range V9 (Final)', overlay = true)
// --- User Inputs ---
// NEW: Added the "20/20 Profile (Ultra-Safe)" option.
profile = input.string('20/20 Profile (Ultra-Safe)', 'Select Profile', options = ['20/20 Profile (Ultra-Safe)', '16/16 Profile (Safe)', '12/12 Profile (Balanced)', '8/8 Profile (Aggressive)', 'Custom'], group = 'Grid Calculation')
// These inputs are now only used when "Custom" is selected.
customRangePercent = input.float(6.3, title = 'Custom Range as % of Price', group = 'Grid Calculation')
customGridCount = input.int(12, title = 'Custom Grid Count', group = 'Grid Calculation')
// Style Inputs
gridColor = input.color(color.new(color.gray, 60), title = 'Grid Line Color', group = 'Line Style')
gridWidth = input.int(1, title = 'Grid Line Width', minval = 1, maxval = 5, group = 'Line Style')
gridStyleString = input.string('Dotted', title = 'Grid Line Style', options = ['Solid', 'Dashed', 'Dotted'], group = 'Line Style')
// --- Variable Declarations ---
var array<line> gridLines = array.new_line()
var array<label> priceLabels = array.new_label()
var float finalRangePercent = 0.0
var int finalGridCount = 0
// --- Logic to select parameters based on profile ---