-
-
Notifications
You must be signed in to change notification settings - Fork 52
Open
Description
Test case:
//@version=6
indicator("Supertrend Strategy", overlay=true)
// Supertrend settings
atrPeriod = 10
factor = 3.0
[supertrend, direction] = ta.supertrend(factor, atrPeriod)
// EMA 200 for trend filter
ema200 = ta.ema(close, 200)
plot(ema200, color=color.blue, title="EMA 200", linewidth=2)
// Plot Supertrend
bodyMiddle = plot((open + close) / 2, display=display.none)
upTrend = plot(direction < 0 ? supertrend : na, "Up Trend", color = color.green, style=plot.style_linebr)
downTrend = plot(direction < 0? na : supertrend, "Down Trend", color = color.red, style=plot.style_linebr)
// Fill background
fill(bodyMiddle, upTrend, color.new(color.green, 90), fillgaps=false)
fill(bodyMiddle, downTrend, color.new(color.red, 90), fillgaps=false)
// Buy/Sell Signals
plotshape(direction < 0 and direction[1] > 0, title="Buy", style=shape.labelup, location=location.belowbar, color=color.green, text="BUY", textcolor=color.white, size=size.small)
plotshape(direction > 0 and direction[1] < 0, title="Sell", style=shape.labeldown, location=location.abovebar, color=color.red, text="SELL", textcolor=color.white, size=size.small)in case of non-title bodyMiddle:
bodyMiddle = plot((open + close) / 2, display=display.none)It will fail on test:
PineTS/src/namespaces/utils.ts
Lines 5 to 7 in a073796
| function isPlot(arg: any) { | |
| return typeof arg === 'object' && arg.title !== undefined && arg.data !== undefined && arg.options !== undefined; | |
| } |
And causes series consequence. For example, cannot be correctly parsed by: parseArgsForPineParams during:
PineTS/src/namespaces/Plots.ts
Lines 426 to 434 in a073796
| export class FillHelper { | |
| constructor(private context: any) { } | |
| param(source: any, index: number = 0, name?: string) { | |
| return Series.from(source).get(index); | |
| } | |
| any(...args) { | |
| const callsiteId = extractCallsiteId(args); | |
| const _parsed = parseArgsForPineParams<FillOptions>(args, FILL_SIGNATURE, FILL_ARGS_TYPES); | |
| const { plot1, plot2, color, title, editable, show_last, fillgaps, display } = _parsed; |
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels