Spaces:
Running
26272829
Browse files// Adaptive SSL Filter based on volatility
atrValue = ta.atr(14)
atrRatio = atrValue / close * 100
volatilityFactor = math.max(1, math.min(3, atrRatio * 3))
sslUp = sslBaseUp + (atrValue * 0.5 * volatilityFactor)
sslDown = sslBaseDown - (atrValue * 0.5 * volatilityFactor)
// Multi-Timeframe SuperTrend Confirmation
[supertrendTrend, supertrendDir] = request.security(syminfo.tickerid, "15",
ta.supertrend(3, 10)[1] > close ? -1 : 1)
Syntax error at input "end of line without line continuation"
5:36:59 AM "Untitled script" opened
5:38:38 AM Compiling...
5:38:39 AM Error at 47:60 Could not find function or function reference 'security'
5:40:18 AM Compiling...
5:40:20 AM Compiled.
5:40:20 AM Updated on chart.
5:48:44 AM Compiling...
5:48:45 AM Error at 65:65 The "strategy.entry" function does not have an argument with the name "when"
5:48:45 AM Error at 69:67 The "strategy.entry" function does not have an argument with the name "when"
5:50:50 AM Compiling...
5:50:52 AM Compiled.
5:50:52 AM Updated on chart.
6:03:34 AM Compiling...
6:03:35 AM Error at 29:77 Syntax error at input "end of line without line continuation"
6:04:16 AM Compiling...
6:04:16 AM Error at 29:77 Syntax error at input "end of line without line continuation"
6:04:30 AM Compiling...
6:04:31 AM Error at 43:35 Syntax error at input "end of line without line continuation"
6:04:51 AM Compiling...
6:04:52 AM Error at 89:44 Syntax error at input "end of line without line continuation"
6:05:08 AM Compiling...
6:05:10 AM Error at 93:46 Syntax error at input "end of line without line continuation"
6:05:30 AM Compiling...
6:05:31 AM Error at 29:81 Cannot call "operator SQBR" with argument "expr0"="call "ta.supertrend" ([series float, series float])". An argument of "[series float, series float]" type was used but a "series na" is expected.
6:05:31 AM Error at 97:6 Undeclared identifier "hullTrend"
6:06:37 AM Compiling...
6:06:38 AM Error at 29:77 Syntax error at input "end of line without line continuation"
- ssl-hybrid-bot.pine +16 -17
|
@@ -26,12 +26,12 @@ volatilityFactor = math.max(1, math.min(3, atrRatio * 3))
|
|
| 26 |
sslUp = sslBaseUp + (atrValue * 0.5 * volatilityFactor)
|
| 27 |
sslDown = sslBaseDown - (atrValue * 0.5 * volatilityFactor)
|
| 28 |
// Multi-Timeframe SuperTrend Confirmation
|
| 29 |
-
[supertrendTrend, supertrendDir] = request.security(syminfo.tickerid, "15",
|
| 30 |
-
|
| 31 |
// Volume Weighted Trend Confirmation
|
| 32 |
volumeAvg = ta.sma(volume, 20)
|
| 33 |
volumeFactor = volume > volumeAvg * 1.5 ? 1.5 : volume > volumeAvg ? 1 : 0.5
|
| 34 |
-
trendDirection =
|
| 35 |
// Candlestick Pattern Confirmation
|
| 36 |
engulfingBullish = close[1] < open[1] and close > open and close > open[1] and open < close[1]
|
| 37 |
engulfingBearish = close[1] > open[1] and close < open and close < open[1] and open > close[1]
|
|
@@ -86,23 +86,22 @@ if strategy.closedtrades > 0
|
|
| 86 |
isNewsTime = dayofweek == dayofweek.friday and hour >= 13 and hour <= 15
|
| 87 |
// Enhanced Strategy Execution with Time Filters
|
| 88 |
isOptimalTime = (hour >= 8 and hour <= 18) or (dayofweek != dayofweek.saturday and dayofweek != dayofweek.sunday)
|
| 89 |
-
|
| 90 |
if time > timestamp(2020, 1, 1, 0, 0)
|
| 91 |
-
if (autoTradeLong and (not inputUseNewsFilter or not isNewsTime) and barstate.isconfirmed and isOptimalTime)
|
| 92 |
-
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
|
| 98 |
|
| 99 |
if (autoTradeShort and (not inputUseNewsFilter or not isNewsTime) and barstate.isconfirmed and isOptimalTime)
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
|
| 106 |
// Enhanced Plotting with Candlestick Alignment
|
| 107 |
plot(sslUp, color=color.new(color.green, 0), linewidth=2, title="SSL Up")
|
| 108 |
plot(sslDown, color=color.new(color.red, 0), linewidth=2, title="SSL Down")
|
|
|
|
| 26 |
sslUp = sslBaseUp + (atrValue * 0.5 * volatilityFactor)
|
| 27 |
sslDown = sslBaseDown - (atrValue * 0.5 * volatilityFactor)
|
| 28 |
// Multi-Timeframe SuperTrend Confirmation
|
| 29 |
+
[supertrendTrend, supertrendDir] = request.security(syminfo.tickerid, "15", ta.supertrend(3, 10))
|
| 30 |
+
supertrendDirection = supertrendDir[1] > close ? -1 : 1
|
| 31 |
// Volume Weighted Trend Confirmation
|
| 32 |
volumeAvg = ta.sma(volume, 20)
|
| 33 |
volumeFactor = volume > volumeAvg * 1.5 ? 1.5 : volume > volumeAvg ? 1 : 0.5
|
| 34 |
+
trendDirection = supertrendDirection * volumeFactor
|
| 35 |
// Candlestick Pattern Confirmation
|
| 36 |
engulfingBullish = close[1] < open[1] and close > open and close > open[1] and open < close[1]
|
| 37 |
engulfingBearish = close[1] > open[1] and close < open and close < open[1] and open > close[1]
|
|
|
|
| 86 |
isNewsTime = dayofweek == dayofweek.friday and hour >= 13 and hour <= 15
|
| 87 |
// Enhanced Strategy Execution with Time Filters
|
| 88 |
isOptimalTime = (hour >= 8 and hour <= 18) or (dayofweek != dayofweek.saturday and dayofweek != dayofweek.sunday)
|
|
|
|
| 89 |
if time > timestamp(2020, 1, 1, 0, 0)
|
| 90 |
+
if (autoTradeLong and (not inputUseNewsFilter or not isNewsTime) and barstate.isconfirmed and isOptimalTime)
|
| 91 |
+
strategy.entry("Long", strategy.long, qty=positionSize)
|
| 92 |
+
strategy.exit("Long Exit", "Long",
|
| 93 |
+
stop=longTrailPrice,
|
| 94 |
+
limit=takeProfitLong,
|
| 95 |
+
trail_points=close * 0.005,
|
| 96 |
+
trail_offset=close * 0.003)
|
| 97 |
|
| 98 |
if (autoTradeShort and (not inputUseNewsFilter or not isNewsTime) and barstate.isconfirmed and isOptimalTime)
|
| 99 |
+
strategy.entry("Short", strategy.short, qty=positionSize)
|
| 100 |
+
strategy.exit("Short Exit", "Short",
|
| 101 |
+
stop=shortTrailPrice,
|
| 102 |
+
limit=takeProfitShort,
|
| 103 |
+
trail_points=close * 0.005,
|
| 104 |
+
trail_offset=close * 0.003)
|
| 105 |
// Enhanced Plotting with Candlestick Alignment
|
| 106 |
plot(sslUp, color=color.new(color.green, 0), linewidth=2, title="SSL Up")
|
| 107 |
plot(sslDown, color=color.new(color.red, 0), linewidth=2, title="SSL Down")
|