make this breakout strategy for my tradingview to test. //@version=5 indicator('Weekly…
- User
make this breakout strategy for my tradingview to test. //@version=5 indicator('Weekly Fib Levels with Magic MA', overlay=true, max_bars_back=2000)
// Inputs for Weekly Fib Levels firstLength = input.int(50, title='ADR Calculation Period (Days)') calcType = input.string("Basic", title="Fibs Calculation", options=["Basic", "Standard Deviation", "Variance"])
showFib1 = input.bool(true, title='', group='Fibonacci Levels', inline='1') fibLevel1 = input.float(0.2, title='', group='Fibonacci Levels', inline='1') fib1Color = input.color(color.new(#F44336, 0), title='', group='Fibonacci Levels', inline='1') showFib1_line = input.bool(true, title='Line', group='Fibonacci Levels', inline='1') fib1Alert = input.bool(false, title='Alert', group='Fibonacci Levels', inline='1')
// Additional Fibonacci levels and inputs truncated for brevity...
dynamic = input.bool(false, title='Dynamically Show Zones Outside ADR')
// Inputs for Magic MA type3 = input.string(defval="HullMA", title="Slow MA Type: ", options=["SMA", "EMA", "WMA", "VWMA", "SMMA", "DEMA", "TEMA", "HullMA", "ZEMA", "TMA", "SSMA"]) len3 = input.int(defval=57, minval=1, title="Slow Length") RSIsrc = input(close, title="Source") RSILen = input.int(6, title='RSI Length') SF = input.int(3, title='RSI Smoothing Factor') QQE = input.float(2.618, title='Fast QQE Factor') threshhold = input.int(10, title="RSI Threshhold") filter = input.bool(false, title="Use Moving Average Filter")
// Calculate daily open, high, and low using request.security function
i_timeframe = input.timeframe(title='Custom Timeframe', defval='D') ticker = syminfo.tickerid
dayOpen = request.security(ticker, i_timeframe, open, barmerge.gaps_off, barmerge.lookahead_on) dayHigh = request.security(ticker, i_timeframe, high, barmerge.gaps_off, barmerge.lookahead_on) dayLow = request.security(ticker, i_timeframe, low, barmerge.gaps_off, barmerge.lookahead_on)
dayRange = dayHigh - dayLow avgRange_1 = request.security(ticker, i_timeframe, ta.sma(dayRange, firstLength))
// Calculate Fibonacci levels based on ADR fibRange_1 = avgRange_1 * fibLevel1
adr_fib_high_1 = plot(showFib1 ? dayOpen + fibRange_1 : na, color=color.new(fib1Color, 50), title="ADR Fib 1 High") adr_fib_low_1 = plot(showFib1 ? dayOpen - fibRange_1 : na, color=color.new(fib1Color, 50), title="ADR Fib 1 Low")
// Function for Magic MA moving averages variant(type, src, len) => switch type "EMA" => ta.ema(src, len) "WMA" => ta.wma(src, len) "VWMA" => ta.vwma(src, len) "SMMA" => ta.sma(src, len) "HullMA" => ta.wma(2 * ta.wma(src, len / 2) - ta.wma(src, len), math.round(math.sqrt(len))) => ta.sma(src, len) // Default case if no condition is met
// Calculate slow MA ma_slow = variant(type3, RSIsrc, len3) plot(ma_slow, title="MA Slow", color=color.blue, linewidth=2)
// QQE Calculation based on RSI Rsi = ta.rsi(RSIsrc, RSILen) RSIndex = ta.ema(Rsi, SF) AtrRsi = math.abs(RSIndex[1] - RSIndex) // Use of math.abs instead of ta.abs MaAtrRsi = ta.ema(AtrRsi, RSILen) DeltaFastAtrRsi = ta.ema(MaAtrRsi, RSILen) * QQE
- Assistant
- User
2 trades a day, and alos make strategy tester for tradingview
- Assistant
- User
fix line 28 Undeclared identifier 'showFib1', fix line 70 Undeclared identifier 'showFib1' , line 56 The
conditionparameter of theifaccepts a 'bool' argument. To avoid potential unexpected results, pass a 'bool' value or expression to this parameter - Assistant
- User
fix line 71 Undeclared identifier 'strategy' , line 56 The
conditionparameter of theifaccepts a 'bool' argument. To avoid potential unexpected results, pass a 'bool' value or expression to this parameter. - Assistant
- User
fix line 70 and 56
- Assistant