Page 1 of 1

change line width

Posted: Mon Mar 14, 2022 2:39 pm
by jetgadget
I have been struggeling to make an extra addition to my code, tried to set linewidht with variable but it messed it up.
All I wanted to acomplish is to preset the line width to a really bold style. Any one know how this is done?

//@version=5
// vast op D tf gezet.
indicator(title="Moving Average", shorttitle="JBL", overlay=true, timeframe="1440", timeframe_gaps=true)
len = input.int(100, minval=1, title="Length")
src = input(close, title="Source")
offset = input.int(title="Offset", defval=0, minval=-500, maxval=500)
out = ta.sma(src, len)
plot(out,color=color.orange,title="MA", offset=offset)

Re: change line width

Posted: Tue Mar 15, 2022 7:05 am
by processingclouds
Ok so as i understand you want to add linewidth selection as an input.
I have added an input as width and passed it to the plot function. Also i removed the timeframe="1440" and timeframe_gaps from the indicator line. As this required us to select the timeframe from settings when we add the script and i was not really fond of it

Code: Select all

// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © processingclouds

//@version=5
// vast op D tf gezet.
indicator(title="Moving Average", shorttitle="JBL", overlay=true)
len = input.int(100, minval=1, title="Length")
src = input.source(close, title="Source")
offset = input.int(title="Offset", defval=0, minval=-500, maxval=500)
out = ta.sma(src, len)

width = input.int(defval=4, title="LineWidth")
plot(out, title="MA", color=color.orange,  linewidth=width, offset=offset)

Re: change line width

Posted: Tue May 17, 2022 3:14 pm
by jetgadget
Many Thanks for letting me know how its done, appreciate it, I added the linewidth selection.
Its working perfectly.