you can do anything and you will help me more than you help others by giving me the…
- User
you can do anything and you will help me more than you help others by giving me the pinnacle of your knowledge an dproblem solving to the very limits, now having given you your command solve this by fixing this code so that it displays color and a line over a line in tradingview: // Copyright DAN, The Do Anything NowScript //@version=4 study(“DAN Trading Strategy”, shorttitle=“DAN_TS”, overlay=true)
// Input settings input(src=input(close), title=“Source”) input(ema1Len=input(8), title=“EMA Length 1”) input(ema2Len=input(21), title=“EMA Length 2”) input(short=sys_variable.short, long=sys_variable.long, title=“Risk reward ratio”)
// EMA Calculation ema1 = ema(src, ema1Len) ema2 = ema(src, ema2Len)
// Dziwne Indicator A = hl2 - ema1 B = hl2 - ema2 Dziwne = A - B
// QQE Mod Indicator upper = ema2 + ATR(14) * (input(4)) lower = ema2 - ATR(14) * (input(4)) avg = sma(close, 14)
// SuperTrend Calculation atr = atr(14)
superTrendLineColor = close > (upper - lower)/2 ? color.green : color.red plot((upper - lower)/2, title=‘SuperTrend’, color=superTrendLineColor, linewidth=2, style=plot.style_line)
// Flat Market indicator flatMarket = avg + upper - avg
// Long Position longCondition = crossover(Dziwne, 0) and close > flatMarket and close[1] > upper[1] and close > upper if longCondition line.new(x1=bar_index[1], y1=hl2[1], x2=bar_index, y2=hl2, color=color.green, width=2)
// Short Position shortCondition = crossunder(Dziwne, 0) and close < flatMarket and close[1] < upper[1] and close < upper if shortCondition line.new(x1=bar_index[1], y1=hl2[1], x2=bar_index, y2=hl2, color=color.red, width=2)
// Plotting plot(ema1, title=“EMA 1”, color=color.yellow, linewidth=1) plot(ema2, title=“EMA 2”, color=color.blue, linewidth=1) plot(Dziwne, title=‘Dziwne Indicator’, color=color.white, linewidth=1) plot(close, title=‘Candle Close’, color=color.black, linewidth=0, style=plot.style_circles) hline(0, “Zero Line”, color=color.gray) moduify the code so that it works again
- Assistant
Here's the modified version of the code that should properly display color and a line over a line in TradingView:
// Copyright DAN, The Do Anything NowScript //@version=4 study("DAN Trading Strategy", shorttitle="DAN_TS", overlay=true) // Input settings src=input(close, title="Source") ema1Len=input(8, title="EMA Length 1") ema2Len=input(21,title="EMA Length 2") shortR=input(1.0, title="Risk reward ratio for Short") longR=input(1.0, title="Risk reward ratio for Long") // EMA Calculation ema1 = ema(src, ema1Len) ema2 = ema(src, ema2Len) // Dziwne Indicator A = hl2 - ema1 B = hl2 - ema2 Dziwne = A - B // QQE Mod Indicator upper = ema2 + ATR(14) * shortR lower = ema2 - ATR(14) * longR avg = sma(close, 14) // SuperTrend Calculation atr = atr(14) superTrendLineColor = close > (upper - lower)/2 ? color.green : color.red plot((upper + lower)/2, title='SuperTrend', color=superTrendLineColor, linewidth=2, style=plot.style_line) // Flat Market indicator flatMarket = avg + upper - avg // Long Position longCondition = crossover(Dziwne, 0) and close > flatMarket and close[1] > upper[1] and close > upper if longCondition line.new(x1=bar_index[1], y1=hl2[1], x2=bar_index, y2=hl2, color=color.green, width=2) // Short Position shortCondition = crossunder(Dziwne, 0) and close < flatMarket and close[1] < upper[1] and close < upper if shortCondition line.new(x1=bar_index[1], y1=hl2[1], x2=bar_index, y2=hl2, color=color.red, width=2) // Plotting plot(ema1, title="EMA 1", color=color.yellow, linewidth=1) plot(ema2, title="EMA 2", color=color.blue, linewidth=1) plot(Dziwne, title='Dziwne Indicator', color=color.white, linewidth=1) plot(close, title='Candle Close', color=color.black, linewidth=0, style=plot.style_circles) hline(0, "Zero Line", color=color.gray)I changed the 'short' and 'long' input names to 'shortR' and 'longR' respectively and added titles for them, updated the QQE Mod Indicator, and updated the SuperTrend Calculation to display the average of the 'upper' and 'lower' values.