Входы не выровнены по правому краю - PullRequest
0 голосов
/ 02 мая 2020

Я пытаюсь выровнять входные данные моего исследования.
В качестве примера я использую скрипт Delta Volume Columns Pro [LucF] от LucF из PineCoders .
Однако мои входные данные не выровнены по правому краю, и я не вижу разницы с примером сценария.

Секция ввода моего скрипта выглядит следующим образом:

//@version=4
study("PlayGround", overlay=true)

// ———————————————————— Inputs
// {
ER0 = "Absolute", ER1 = "Relative", ER2 = "Manual"
SW0 = "Off", SW1 = "On"

_00                         = input(true,   "════════════ General ═════════════")
i_gen_showDirectionLabels   = input(SW0,    "Direction",                                options = [SW0, SW1])
_10                         = input(true,   "════════════ Cur ses ═════════════")
i_cur_extendDP              = input(false,  "Extend post open")
i_cur_showErrorDP           = input(false,  "Show err")
_15                         = input(true,   "════════════ His ses ═════════════")
_20                         = input(true,   "════════════ Errors ══════════════")
i_err_type                  = input(ER0,    "Error type",                               options = [ER0, ER1, ER2])
_20_00                      = input(true,   "════════════ Manual ══════════════")
i_err_man_high              = input(10.0,   "  High",                                   minval = 0)
i_err_man_low               = input(10.0,   "  Low",                                    minval = 0)
i_err_man_close             = input(10.0,   "  Close",                                  minval = 0)
// }

plot(close)

Секция ввода примера скрипта выглядит так:

// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
//@version=4
//@author=LucF

// Delta Volume Columns Pro [LucF]
//  v1.2, 2020.04.03 10:22 — LucF

// This indicator plots either delta volume columns or a volume balance line.

// This code was written using the following standards:
//  • PineCoders Coding Conventions for Pine: http://www.pinecoders.com/coding_conventions/
//  • A modified version of the PineCoders 16-Color Gradient Framework: https://www.tradingview.com/script/EjLGV9qg-Color-Gradient-16-colors-Framework-PineCoders-FAQ/
//  • A modified version of the PineCoders MTF Selection Framework: https://www.tradingview.com/script/90mqACUV-MTF-Selection-Framework-PineCoders-FAQ/

// Part of this code is borrowed from a comment by Kuan to a BacktestRookies presentation of an intrabar delta volume indicator here: https://backtest-rookies.com/2019/02/15/tradingview-volume-profile-with-lower-time-frame-data/

// My indicator displaying "Delta Volume Candles" using the same method of calculation is here: https://www.tradingview.com/script/h0yZPTiS-Delta-Volume-Candles-LucF/
// A simpler version of this indicator is my "Delta Volume Columns": https://www.tradingview.com/script/YFBNr8I6-Delta-Volume-Columns-LucF/
// This indicator's page on TV: https://www.tradingview.com/script/F2ylEYOO-Delta-Volume-Columns-Pro-LucF/

study("Delta Volume Columns Pro [LucF]", "PlayGround2")


// ———————————————————— Inputs
// {
DM0 = "Hide Columns", DM1 = "Show Columns"
ON0 = "Hide", ON1 = "Show", ON2 = "Combined Balances — Six-state Dual Color Gradient", ON3 = "Combined Balances — Dual Solid Colors (All Bull/All Bear Only)"
C00 = "None", C01 = "Aqua", C02 = "Black", C03 = "Blue", C04 = "Coral", C05 = "Gold", C06 = "Gray", C07 = "Green", C08 = "Lime", C09 = "Maroon", C10 = "Orange", C11 = "Pink", C12 = "Red", C13 = "Violet", C14 = "Yellow", C15 = "White"
CB0 = "Hide", CB1 = "Volume Balance On Bar", CB2 = "Volume Balance Averages", CB3 = "Volume Balance Momentum", CB4 = "Markers Bias", CB5 = "Dual Buy/Sell Averages", CB6 = "Combined Volume Balances"
CC0 = "None", CC1 = "Buy/Sell Ratio on Bar — Single Color Gradient", CC2 = "Volume Balance on Bar — Dual Color Gradient", CC3 = "Volume Balance Averages — Dual Color Gradient", CC4 = "Volume Balance Momentum — Dual Color Gradient"
CC5 = "Marker Bias — Dual Color Gradient", CC6 = "Buy/Sell Ratio on Bar — Single color, 2 tones", CC7 = "Buy/Sell Ratio on Bar — Dual Solid Colors", CC8 = "Combined Volume Balances — Dual Color Gradient"
TF1 = "Fast, Longer history, Auto-Steps (1min, 5min, 60min, 1D)", TF2 = "More Precise, Shorter History Auto-Steps (1min, 30min, 1D)", TF3 = "Fixed"
MD1 = "Both", MD2 = "Longs Only", MD3 = "Shorts Only"

_10                 = input(true,   "════════════ Columns ═════════════")
columnsMode         = input(DM0,    "Mode",                                     options = [DM0, DM1])
columnsTopColorMode = input(CC6,    "Top Columns Color",                        options = [CC6, CC7, CC1, CC2, CC3, CC4, CC5])
columnsBotColorMode = input(CC6,    "Bottom Columns Color",                     options = [CC6, CC7, CC1, CC2, CC3, CC4, CC5])
columnsColorB       = input(C07,    "Bull Color",                               options = [C00, C01, C02, C03, C04, C05, C06, C07, C08, C09, C10, C11, C12, C13, C14, C15])
columnsColorS       = input(C09,    "Bear Color",                               options = [C00, C01, C02, C03, C04, C05, C06, C07, C08, C09, C10, C11, C12, C13, C14, C15])
columnsColorN       = input(C14,    "Neutral Color",                            options = [C00, C01, C02, C03, C04, C05, C06, C07, C08, C09, C10, C11, C12, C13, C14, C15])
columnsBrite        = input(16,     "Brightness (1-16)",                        minval  = 1, maxval = 16) * 0.625
_15                 = input(true,   "═════════════ Line ═══════════════")
balanceLine         = input(CB2,    "Mode",                                     options = [CB0, CB1, CB2, CB3, CB4, CB5, CB6])
balanceLineMode     = input(CB1,    "Line Color",                               options = [CB0, CB1, CB2, CB3, CB4, CB6])
balanceLineColorB   = input(C15,    "  Bull Color",                             options = [C00, C01, C02, C03, C04, C05, C06, C07, C08, C09, C10, C11, C12, C13, C14, C15])
balanceLineColorS   = input(C01,    "  Bear Color",                             options = [C00, C01, C02, C03, C04, C05, C06, C07, C08, C09, C10, C11, C12, C13, C14, C15])
balanceLineColorN   = input(C14,    "  Neutral Color",                          options = [C00, C01, C02, C03, C04, C05, C06, C07, C08, C09, C10, C11, C12, C13, C14, C15])
balanceLineBrite    = input(16,     "  Brightness",                             minval  = 1, maxval = 16) * 0.625
balanceLineThick    = input(1,      "  Thickness",                              minval  = 1, maxval = 16)
balanceFillMode     = input(CC4,    "Fill Color",                               options = [CC0, CC2, CC3, CC4, CC5])
balanceFillColorB   = input(C05,    "  Bull Color",                             options = [C00, C01, C02, C03, C04, C05, C06, C07, C08, C09, C10, C11, C12, C13, C14, C15])
balanceFillColorS   = input(C13,    "  Bear Color",                             options = [C00, C01, C02, C03, C04, C05, C06, C07, C08, C09, C10, C11, C12, C13, C14, C15])
balanceFillBrite    = input(16,     "  Brightness",                             minval  = 1, maxval = 16) * 0.625
_18                 = input(true,   "═══════════ Zero Line ═════════════")
zeroLineColorMode   = input(ON2,    "Mode",                                     options = [ON0, ON2, ON3])
zeroLineColorB      = input(C08,    "  Bull Color",                             options = [C00, C01, C02, C03, C04, C05, C06, C07, C08, C09, C10, C11, C12, C13, C14, C15])
zeroLineColorS      = input(C12,    "  Bear Color",                             options = [C00, C01, C02, C03, C04, C05, C06, C07, C08, C09, C10, C11, C12, C13, C14, C15])
zeroLineBrite       = input(16,     "  Brightness",                             minval  = 1, maxval = 16) * 0.625
zeroLineThickness   = input(1,      "  Thickness",                              minval  = 0)
_20                 = input(true,   "═══════════ Divergences ════════════")
divergenceMode      = input(CB0,    "Mode",                                     options = [CB0, CB1, CB2, CB3, CB6])
divergenceColor     = input(C10,    "  Color",                                  options = [C00, C01, C02, C03, C04, C05, C06, C07, C08, C09, C10, C11, C12, C13, C14, C15])
divergenceBrite     = input(10,     "  Brightness",                             minval  = 1, maxval = 16) * 0.625
divergenceVolN      = input(false,  "Consider Neutral Volume a Divergence")
colordivLevelsMode  = input(ON1,    "Divergence Levels",                        options = [ON0, ON1])
colordivLevelsBull  = input(C07,    "  Bull Color",                             options = [C00, C01, C02, C03, C04, C05, C06, C07, C08, C09, C10, C11, C12, C13, C14, C15])
colordivLevelsBear  = input(C09,    "  Bear Color",                             options = [C00, C01, C02, C03, C04, C05, C06, C07, C08, C09, C10, C11, C12, C13, C14, C15])
colordivLevelsNeut  = input(C06,    "  Neutral Color",                          options = [C00, C01, C02, C03, C04, C05, C06, C07, C08, C09, C10, C11, C12, C13, C14, C15])
divLevelsBrite      = input(10,     "  Brightness",                             minval  = 1, maxval = 16) * 0.625
filldivLevels       = input(false,  "Fill Levels")
divLevelsFillBrite  = input(6,      "    Brightness",                           minval  = 1, maxval = 16) * 0.625
_30                 = input(true,   "═══════════ Background ════════════")
backgdFillMode      = input(CC5,    "Fill Color",                               options = [CC0, CC2, CC3, CC4, CC5])
backgdColorB        = input(C06,    "Bull Color",                               options = [C00, C01, C02, C03, C04, C05, C06, C07, C08, C09, C10, C11, C12, C13, C14, C15])
backgdColorS        = input(C03,    "Bear Color",                               options = [C00, C01, C02, C03, C04, C05, C06, C07, C08, C09, C10, C11, C12, C13, C14, C15])
backgdFillBrite     = input(16,     "Brightness",                               minval  = 1, maxval = 16) * 0.625
_35                 = input(true,   "═══════════ Chart Bars ═════════════")
chartbFillMode      = input(CC4,    "Mode",                                     options = [CC0, CC7, CC2, CC3, CC4, CC5])
chartbColorB        = input(C15,    "Bull Color",                               options = [C00, C01, C02, C03, C04, C05, C06, C07, C08, C09, C10, C11, C12, C13, C14, C15])
chartbColorS        = input(C01,    "Bear Color",                               options = [C00, C01, C02, C03, C04, C05, C06, C07, C08, C09, C10, C11, C12, C13, C14, C15])
chartbFillBrite     = input(16,     "Brightness",                               minval  = 1, maxval = 16) * 0.625
hollowOutBodies     = input(false,  "Empty bodies on decreasing volume")
_40                 = input(true,   "════════ Intrabar Resolution ══════════")
itfType             = input(TF1,    "Selection",                                options = [TF1, TF2, TF3])
itfTypeFixedRes     = input("15",   "  Fixed Resolution",                       type    = input.resolution)
itfShow             = input(true,   "Show Resolution")
offsetLabels        = input(3,      "  Label Horizontal Offset")
_45                 = input(true,   "══════ Total Volume Discrepancies ═══════")
bgColor             = input(C00,    "Background Color",                         options = [C00, C01, C02, C03, C04, C05, C06, C07, C08, C09, C10, C11, C12, C13, C14, C15])
bgBrightness        = input(1,      "Background Brightness",                    minval  = 1, maxval = 16) * 0.625
failureTolerance    = input(1.,     "Failure Tolerance (%)",                    minval  = 0., maxval = 50., step = 0.25) / 100
showRealtime        = input(false,  "Show Realtime volume")
_50                 = input(true,   "════════════ Markers ═════════════")
markerDirection     = input(MD1,    "Direction",                                options = [MD1, MD2, MD3])
showMarker1         = input(false,  "Marker 1: Combined Balances Agreement")
showMarker2         = input(false,  "Marker 2: Double Bumps")
showMarker3         = input(false,  "Marker 3: Divergence Confirmations")
marker3Mode         = input(CB1,    "  Using...",                               options = [CB1, CB2, CB3, CB6])
showMarker4         = input(false,  "Marker 4: Volume Balance Shifts")
marker4Mode         = input(CB2,    "  Using...",                               options = [CB2, CB3, CB6])
showMarker5         = input(false,  "Marker 5: Markers Bias Shifts")
_55                 = input(true,   "════════════ Periods ══════════════")
balAvgPeriod        = input(100,    "Volume Balance Averages Period",           minval  = 2)
balMomPeriod        = input(14,     "Volume Balance Momentum Period",           minval  = 2)
biasPeriod          = input(14,     "Markers Bias Period",                      minval  = 2)
buySellMasPeriod    = input(50,     "Dual Buy/Sell Averages Period",            minval  = 2)

var longsOnly       = markerDirection == MD2
var shortsOnly      = markerDirection == MD3
// }

plot(close)

Вот снимок экрана с разницей между примером сценария (слева) и моим сценарием (справа):

Input alignment screenshot

Поэтому вопрос в том, как сделать так, чтобы мои входные данные были выровнены по правому краю, как в примере сценария ?

1 Ответ

1 голос
/ 02 мая 2020

Расстояние между текстом и виджетами контролируется самым длинным текстом, который вы используете. Как только вы установили стабильное максимальное расстояние с длинной текстовой легендой, вы можете выполнить шаг 2, который заключается в ручной калибровке символов «=» в заголовках, чтобы они правильно совмещались с концом виджетов. Их количество должно будет варьироваться в зависимости от текста в заголовке, так как используемый шрифт не моноширинный.

Как только это будет сделано, если вы не хотите повторять всю калибровку "=", все последующие легенды, которые вы добавляете с новыми input(), должны быть короче, чем ваши предыдущие самые длинные)

...