Reputation: 11
There is a great trailing stop example at the following link.
I really like it as it avoids having to use the standard in-built trailing stop in the strategy.exit function.
I can convert the majority of it to pine script version 4. However, this is specific function.
plot(series=(strategy.position_size > 0) ? longStopPrice : na,
color=color.fuchsia, style=shape.cross,
linewidth=2, title="Long Trail Stop")
I can convert the main parameters, but the plot function does not like accepting the "series" input.
I'm wondering if anyone can help me to overcome this plot issue.
Cheers, Matt
Upvotes: 1
Views: 197
Reputation: 8789
Your style=
argument wasn't correct. Use the refman to validate your use of functions. You can just CTRL-click on keywords from the editor or search the refman for plot()
plot(series=(strategy.position_size > 0) ? longStopPrice : na,
color=color.fuchsia, style=plot.style_cross,
linewidth=2, title="Long Trail Stop")
Upvotes: 1