You are a professional PineScript version=5 developer. You know how to code indicators…
- User
You are a professional PineScript version=5 developer. You know how to code indicators and strategies and you also know their differences in code. In the strategy below, Tradingview can't run the test strategy because it says "Set the start date time" for the strategy, despite it being there, from what I can see. Please look at the strategy code below and see if there's anything you can do to rectify this.
//@version=5 strategy("Demo GPT - Support and Resistance Breaks Strategy", overlay=true, max_bars_back=1000, commission_type=strategy.commission.percent, commission_value=0.1, slippage=3)
// User Inputs toggleBreaks = input.bool(true, title="Show Breaks") leftBars = input.int(15, title="Left Bars") rightBars = input.int(15, title="Right Bars") volumeThresh = input.float(20.0, title="Volume Threshold")
// Start and End Dates Inputs startDate = input.time(timestamp("2018-01-01T00:30:00"), title="Start Date", confirm=true) endDate = input.time(timestamp("2069-12-31T23:59:59"), title="End Date", confirm=true) time_cond = time >= startDate and time <= endDate
// Support and Resistance Levels var float highUsePivot = na var float lowUsePivot = na
pivotHigh = ta.pivothigh(high, leftBars, rightBars) pivotLow = ta.pivotlow(low, leftBars, rightBars)
if not na(pivotHigh[1]) highUsePivot := pivotHigh[1] else highUsePivot := highUsePivot[1]
if not na(pivotLow[1]) lowUsePivot := pivotLow[1] else lowUsePivot := lowUsePivot[1]
// Plotting Resistance and Support r1 = plot(highUsePivot, color=ta.change(highUsePivot) ? na : color.red, linewidth=3, offset=-(rightBars+1), title="Resistance") s1 = plot(lowUsePivot, color=ta.change(lowUsePivot) ? na : color.blue, linewidth=3, offset=-(rightBars+1), title="Support")
// Volume Oscillator short_vol = ta.ema(volume, 5) long_vol = ta.ema(volume, 10) osc = 100 * (short_vol - long_vol) / long_vol
// Break Conditions with Volume breakDown = toggleBreaks and ta.crossunder(close, lowUsePivot) and not (open - close < high - open) and osc > volumeThresh breakUp = toggleBreaks and ta.crossover(close, highUsePivot) and not (open - low > close - open) and osc > volumeThresh
// Plotting Break Signals plotshape(breakDown, title="Break Down", text='B', style=shape.labeldown, location=location.abovebar, color=color.red, textcolor=color.white, size=size.tiny) plotshape(breakUp, title="Break Up", text='B', style=shape.labelup, location=location.belowbar, color=color.green, textcolor=color.white, size=size.tiny)
// Bull and Bear Wicks bullWick = toggleBreaks and ta.crossover(close, highUsePivot) and (open - low > close - open) bearWick = toggleBreaks and ta.crossunder(close, lowUsePivot) and (open - close < high - open)
// Plotting Wick Signals plotshape(bullWick, title="Bull Wick", text='Bull Wick', style=shape.labelup, location=location.belowbar, color=color.green, textcolor=color.white, size=size.tiny) plotshape(bearWick, title="Bear Wick", text='Bear Wick', style=shape.labeldown, location=location.abovebar, color=color.red, textcolor=color.white, size=size.tiny)
- Assistant