Rewrite Entire Code and Fix: Mismatched input 'end of line without line continuation'…
- User
Rewrite Entire Code and Fix: Mismatched input 'end of line without line continuation' expecting ')': //@version=5 indicator("Flexible Candlestick Patterns V5 with Shortcodes", overlay=true)
// Calculate body size bodySize = math.abs(close - open)
// Calculate wick sizes upperWick = open > close ? high - open : high - close lowerWick = open > close ? close - low : open - low
// Variables var int numberOfCandles = input(5, "Number of Candles") // Input for the number of last candles to consider var float maxVolume = na
// Function to find maximum volume within the specified number of last candles if bar_index >= numberOfCandles - 1 maxVolume := volume for i = 1 to numberOfCandles - 1 maxVolume := math.max(maxVolume, volume[i])
// Input parameters for flexibility shootingStarBodyRatio = input.float(0.35, title="Shooting Star Body Ratio") shootingStarWickMultiplier = input.float(3, title="Shooting Star Wick Multiplier") hammerUpperWickRatio = input.float(0.25, title="Hammer Upper Wick Ratio") hammerBodyRatio = input.float(0.35, title="Hammer Body Ratio") dojiBodyRatio = input.float(0.05, title="Doji Body Ratio") dragonflyDojiWickRatio = input.float(0.05, title="Dragonfly Doji Wick Ratio") gravestoneDojiWickRatio = input.float(0.05, title="Gravestone Doji Wick Ratio") hangingManBodyRatio = input.float(0.35, title="Hanging Man Body Ratio") spinningTopBodyRatio = input.float(0.3, title="Spinning Top Body Ratio") insidePatternBodyRatio = input.float(0.4, title="Inside Pattern Body Ratio")
// Checkboxes to enable/disable each pattern showShootingStar = input(true, title="Show Shooting Star") showHammer = input(true, title="Show Hammer") showInvertedHammer = input(true, title="Show Inverted Hammer") showDoji = input(true, title="Show Doji") showDragonflyDoji = input(true, title="Show Dragonfly Doji") showGravestoneDoji = input(true, title="Show Gravestone Doji") showHangingMan = input(true, title="Show Hanging Man") showSpinningTop = input(true, title="Show Spinning Top") showInsidePattern = input(true, title="Show Inside Pattern")
// Define Candlestick Patterns with refined conditions isShootingStar = showShootingStar and bodySize < (high - low) * shootingStarBodyRatio and upperWick > lowerWick * shootingStarWickMultiplier and volume == maxVolume isHammer = showHammer and close > open and (high - close) < (open - low) * hammerUpperWickRatio and bodySize < (high - low) * hammerBodyRatio and volume == maxVolume isInvertedHammer = showInvertedHammer and open > close and (high - open) < (close - low) * hammerUpperWickRatio and bodySize < (high - low) * hammerBodyRatio and volume == maxVolume isDoji = showDoji and bodySize <= (high - low) * dojiBodyRatio and math.abs(open - close) <= 0.001 and volume == maxVolume isDragonflyDoji = showDragonflyDoji and isDoji and close > open and (high - close) < (open - low) * dragonflyDojiWickRatio and volume == maxVolume isGravestoneDoji = showGravestoneDoji and isDoji and open > close and (high - open) < (close - low) * gravestoneDojiWickRatio and volume == maxVolume isHangingMan = showHangingMan and isHammer and close < open and bodySize < (high - low) * hangingManBodyRatio and volume == maxVolume isSpinningTop = showSpinningTop and bodySize < (high - low) * spinningTopBodyRatio and upperWick < (high - low) * spinningTopBodyRatio and lowerWick < (high - low) * spinningTopBodyRatio and volume == maxVolume isInsidePattern = showInsidePattern and high <= high[1] and low >= low[1] and bodySize < (high - low) * insidePatternBodyRatio
- Assistant