我已经连续8个小时没有编写代码的经验了,但我发现很难识别这个错误,如果有人能帮我,我真的很感激。谢谢大家
不匹配的输入“)”应为“行尾无行延续”。
//@version=4 study(title="TMA Overlay", shorttitle="TMA Overlay", overlay=true) // ### Four Smoothed Moving Averages len1 = 21 //input(21, minval=1, title="Length 1", group = "Smoothed MA Inputs") src1 = close //input(close, title="Source 1", group = "Smoothed MA Inputs") smma1 = 0.0 sma_1 = sma(src1, len1) smma1 := na(smma1[1]) ? sma_1 : (smma1[1] * (len1 - 1) + src1) / len1 plot(smma1, color=color.white, linewidth=2, title="21 SMMA") len2 = 50 //input(50, minval=1, title="Length 2", group = "Smoothed MA Inputs") src2 = close //input(close, title="Source 2", group = "Smoothed MA Inputs") smma2 = 0.0 sma_2 = sma(src2, len2) smma2 := na(smma2[1]) ? sma_2 : (smma2[1] * (len2 - 1) + src2) / len2 plot(smma2, color=color.new(#6aff00,0), linewidth=2, title="50 SMMA") h100 = input(title="Show 100 Line", type=input.bool, defval=true, group = "Smoothed MA Inputs") len3 = 100 //input(100, minval=1, title="Length 3", group = "Smoothed MA Inputs") src3 = close //input(close, title="Source 3", group = "Smoothed MA Inputs") smma3 = 0.0 sma_3 = sma(src3, len3) smma3 := na(smma3[1]) ? sma_3 : (smma3[1] * (len3 - 1) + src3) / len3 sma3plot = plot(h100 ? smma3 : na, color=color.new(color.yellow,0), linewidth=2, title="100 SMMA") len4 = 200 //input(200, minval=1, title="Length 4", group = "Smoothed MA Inputs") src4 = close //input(close, title="Source 4", group = "Smoothed MA Inputs") smma4 = 0.0 sma_4 = sma(src4, len4) smma4 := na(smma4[1]) ? sma_4 : (smma4[1] * (len4 - 1) + src4) / len4 sma4plot = plot(smma4, color=color.new(#ff0500,0), linewidth=2, title="200 SMMA") // Trend Fill trendFill = input(title="Show Trend Fill", type=input.bool, defval=true, group = "Smoothed MA Inputs") ema2 = ema(close, 2) ema2plot = plot(ema2, color=#2ecc71, transp=100, style=plot.style_line, linewidth=1, title="EMA(2)", editable = false) fill(ema2plot, sma4plot, color=ema2 > smma4 and trendFill ? color.green : ema2 < smma4 and trendFill ? color.red : na, transp=85, title = "Trend Fill") alertcondition(bullishEngulfing != na, title = "Bullish Engulfing",) message = "[CurrencyPair] [TimeFrame], Bullish candle engulfing previous candle") alertcondition(bearishEngulfing != na, title = "Bearish Engulfing", message = "[CurrencyPair] [TimeFrame], Bearish candle engulfing previous candle") // ### 3 Line Strike bearS = input(title="Show Bearish 3 Line Strike", type=input.bool, defval=true, group = "3 Line Strike") bullS = input(title="Show Bullish 3 Line Strike", type=input.bool, defval=true, group = "3 Line Strike") bearSig = close[3] > open[3] and close[2] > open[2] and close[1] > open[1] and close < open[1] bullSig = close[3] < open[3] and close[2] < open[2] and close[1] < open[1] and close > open[1] plotshape(bearS ? bearSig : na, if bearS) (style=shape.triangledown, color=color.red, location=location.abovebar, size = size.small, text="3s-Bear", title="3 Line Strike Down") plotshape(bullS ? bullSig : na, if bullS) (style=shape.triangleup, color=color.green, location=location.belowbar, size = size.small, text="3s-Bull", title="3 Line Strike Up") // End ### // Define variables smma = sma(close, 200) longCondition = close > smma shortCondition = close < smma // Define bullish engulfing and 3 line strike candles bullishEngulfing = close > open and open < smma[1] and close > smma[1] barcolor(bullishEngulfing) threeLineStrikeBullish = close[1] < open[1] and open > close and close > open // Define bearish engulfing and 3 line strike candles bearishEngulfing = close < open and open > smma[1] and close < smma[1] barcolor(bearishEngulfing) threeLineStrikeBearish = close[1] > open[1] and open < close and close < open // Buy signal if (longCondition and (bullishEngulfing or threeLineStrikeBullish)) ("Long", strategy.long) // Sell signal if (shortCondition and (bearishEngulfing or threeLineStrikeBearish)) ("Short", strategy.short)
我想为我的交易策略创建一个指标。所有的确认书都被钉住了,并且有效了,但当所有确认书都得到满足时,我很难很快做出买入或卖出的指示