如何绘制以前的OHLC4 HMA Candle Wick High和Low for Stoploss ??? pinescript

发布于 2025-02-13 23:51:45 字数 1285 浏览 1 评论 0原文

我绘制了蜡烛,我只是想用先前的蜡烛wick高和低点绘制我的牛油。较低,长短短。

我可以使用真正的Close和Heikien Ashi来绘制它,但是我想将止动物放在图表上的HMA蜡烛上。

保罗

    //@version=5
    strategy("Hull Candles", overlay=true, margin_long=100, 
    margin_short=100)

len = input(10, title= "Hull Length")
lenclose = input(1, title="Hull Close Lenth")

//Candle values

o = ta.hma(open,len)
c = ta.hma(close,len)
h = ta.hma(high,len)
l = ta.hma(low,len)
t = ticker.new(syminfo.prefix, syminfo.ticker)
t2 = ticker.heikinashi(t)


ohlcFour = ta.hma(ohlc4,len)

colorBody = ohlcFour > ohlcFour[1] ? color.white : #6F00FF
plotcandle(o,h,l,c, color=colorBody, title= "Hull Candles")

//Stoploss labels
longstoploss = request.security(ohlc4, timeframe.period, low[1])
shortstoploss = request.security(ohlc4, timeframe.period, high[1])
longstop = str.tostring(longstoploss)
shortstop = str.tostring(shortstoploss)

Longstoplabel = label.new(x=bar_index,y=na, text = longstop, yloc = yloc.belowbar,textcolor=color.white, color=#000000,size = size.normal,style = label.style_none)
Shortstoplabel = label.new(x=bar_index,y=na, text = shortstop, yloc = yloc.abovebar,textcolor= #6F00FF, color=#000000,size = size.normal,style = label.style_none)

label.delete(Longstoplabel[1])
label.delete(Shortstoplabel[1])

I have the candles plotted and I'm just trying to plot my stoploss in ticks with the previous candles wick high and low. Low for Longs and High for Shorts.

I can get it to plot using the real close and heikien ashi but I would like to have the stoploss with the plotted HMA candles that are on the chart.

Any help would be awesome and big time thanks in advance,

Paul

    //@version=5
    strategy("Hull Candles", overlay=true, margin_long=100, 
    margin_short=100)

len = input(10, title= "Hull Length")
lenclose = input(1, title="Hull Close Lenth")

//Candle values

o = ta.hma(open,len)
c = ta.hma(close,len)
h = ta.hma(high,len)
l = ta.hma(low,len)
t = ticker.new(syminfo.prefix, syminfo.ticker)
t2 = ticker.heikinashi(t)


ohlcFour = ta.hma(ohlc4,len)

colorBody = ohlcFour > ohlcFour[1] ? color.white : #6F00FF
plotcandle(o,h,l,c, color=colorBody, title= "Hull Candles")

//Stoploss labels
longstoploss = request.security(ohlc4, timeframe.period, low[1])
shortstoploss = request.security(ohlc4, timeframe.period, high[1])
longstop = str.tostring(longstoploss)
shortstop = str.tostring(shortstoploss)

Longstoplabel = label.new(x=bar_index,y=na, text = longstop, yloc = yloc.belowbar,textcolor=color.white, color=#000000,size = size.normal,style = label.style_none)
Shortstoplabel = label.new(x=bar_index,y=na, text = shortstop, yloc = yloc.abovebar,textcolor= #6F00FF, color=#000000,size = size.normal,style = label.style_none)

label.delete(Longstoplabel[1])
label.delete(Shortstoplabel[1])

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

深海夜未眠 2025-02-20 23:51:45

不确定您需要什么,但是如果您想要船体蜡烛低,

Hull_Candle_low = ta.valuewhen(close,l,0)

因此,如果要将止动物放在上一个船体蜡烛低的地方,那就是hull_candle_low [1

]

Hull_Candle_high = ta.valuewhen(close,h,0)

和以前的船体蜡烛高是hull_candle_high [1]

not sure what you need, but if you want the hull candle low,

Hull_Candle_low = ta.valuewhen(close,l,0)

so if you want to put the stoploss at the previous hull candle low, that would be Hull_Candle_low[1]

same thing with shorts/high

Hull_Candle_high = ta.valuewhen(close,h,0)

and the previous hull candle high is Hull_Candle_high[1]

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文