Modifica este codigo para que el adx cambie de color a amarillo si cae por debajo de 20…
- User
Modifica este codigo para que el adx cambie de color a amarillo si cae por debajo de 20 puntos y blanco si sube por encima: // @version=4 study(title="Squeeze M. + ADX + TTM (TradingLatino & John F. Carter) by [Rolgui]", shorttitle="SQZ+ADX+TTM [R]", overlay=false) // 1) Squeeze Momentum Oscillator // original code section by @ LazyBear show_SQZ = input(true, title="Show Squeeze Oscillator") allLengthValue = input(20, title="BB Length", type=input.integer) BB_mult = input(2.0,title="BB MultFactor") lengthKC=input(20, title="KC Length") multKC = input(1.5, title="KC MultFactor") linearMomentum = input(20, title="Linear Momentum", type=input.integer) useTrueRangeM = true // Calculate BB source = close BB_basis = sma(source, allLengthValue) dev = BB_mult * stdev(source, allLengthValue) upperBB = BB_basis + dev lowerBB = BB_basis - dev // Calculate KC KC_basis = sma(source, lengthKC) range = useTrueRangeM ? tr : (high - low) devKC = sma(range, allLengthValue) upperKC = KC_basis + devKC * multKC lowerKC = KC_basis - devKC * multKC sqzOn = (lowerBB > lowerKC) and (upperBB < upperKC) sqzOff = (lowerBB < lowerKC) and (upperBB > upperKC) noSqz = (sqzOn == false) and (sqzOff == false) val = linreg(source - avg(avg(highest(high, linearMomentum), lowest(low, linearMomentum)),sma(close,linearMomentum)), linearMomentum,0) bcolor = iff( val > 0, iff( val > nz(val[1]), color.rgb(46, 245, 39, 0), color.rgb(16, 120, 13, 0)), iff( val < nz(val[1]), color.rgb(217, 6, 6, 0), color.rgb(98, 0, 0, 0))) sz = linreg(source - avg(avg(highest(high, allLengthValue), lowest(low, allLengthValue)), sma(close, allLengthValue)), allLengthValue, 0) //***************************************************************************************************************************************************************************************// // Draw plots section by visibility order. // TTM Waves plot(histA, color=color.new(color.teal, 80), style=plot.style_area, title="Wave A", linewidth=1) plot(histB, color=color.new(color.orange, 90), style=plot.style_area, title="Wave B", linewidth=1) plot(histC, color=color.new(color.yellow, 90), style=plot.style_area, title="Wave C", linewidth=1) // Squeeze Oscillator plot(show_SQZ ? val : na, title="Squeeze Oscillator", color=bcolor, style=plot.style_columns, linewidth=4) // Key Level plot(show_ADX ? far1 * scaleADX : na, color=color.white, title="Key Level", linewidth = 1) // Squeeze Momentum plot(showTTMSQZ? 0 : na, title='Squeeze Momentum', color=sq_color, style=plot.style_line, linewidth=2) // ADX p1 = plot(show_ADX ? adx_scale2 * scaleADX : show_ADX ? adx_scale * scaleADX : na, color = color.white, title = "ADX", linewidth = 2)
- Assistant
Modifica este código para que el ADX cambie de color a amarillo si cae por debajo de 20 puntos y blanco si sube por encima:
p1 = plot(show_ADX ? adx_scale2 * scaleADX : show_ADX ? adx_scale * scaleADX : na, color = adxValue > 20 ? color.white : color.yellow, title = "ADX", linewidth = 2)Se agrega una condición para verificar si el valor de ADX es mayor a 20. Si es mayor, el color será blanco, de lo contrario, será amarillo.
- User
integra la modificación al codigo por favor
- Assistant
- User
study(title="ADX INDICATOR V2", shorttitle="ADX V2", overlay=true)
- Assistant
Aquí tienes el código modificado con el título y shorttitle actualizados:
study(title="ADX INDICATOR V2", shorttitle="ADX V2", overlay=true) // 1) Squeeze Momentum Oscillator // original code section by @ LazyBear show_SQZ = input(true, title="Show Squeeze Oscillator") allLengthValue = input(20, title="BB Length", type=input.integer) BB_mult = input(2.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.