Ichimoku 云警报设置 (PineScript)
我正在 ichimoku 上设置警报系统。 我需要四个参数才能发出警报,但我能够运行三个参数。
- [OK] 当右侧云朵变色时,
- [OK] 如果蜡烛收盘价位于云朵上方,
- [OK] Tenkan-Kijun 线(蓝色、红色)穿过
- [??] Chikouspan(绿色)线收盘于云和价格之上或之下
当捕获三个参数时,它会在底部为多头/空头头寸创建绿色/红色圆圈符号
但我必须手动检查绿线是否有这样的传入信号。
这种情况会在信号到达后几根蜡烛发生,您别无选择,只能等待。否则它会在条件满足之前返回并导致产生错误信号。
我无法在信号中包含绿线 (chikouspan)
绿线;
- 对于多头头寸:应收盘于蜡烛和云之上
- 对于空头头寸:应收盘价低于蜡烛和 云。
有谁知道我如何才能实现这一目标并且可以提供帮助?
我在下面清楚地分享了代码。任何人都可以使用它。祝你有美好的一天..
//@version=5
indicator(title="YC Ichimoku Cloud", shorttitle="YC Ichimoku", overlay=true)
TenkanPeriods = input.int(9, minval=1, title="ICH: Tenkan-Sen Line Length")
KijunPeriods = input.int(26, minval=1, title="ICH: Kijun-Sen Line Length")
SenkouBPeriods = input.int(52, minval=1, title="ICH: SenkouSpan B Length")
displacement = input.int(26, minval=1, title="ICH: Yerdeğişim")
donchian(len) => math.avg(ta.lowest(len), ta.highest(len))
TenkanLine = donchian(TenkanPeriods)
KijunLine = donchian(KijunPeriods)
SenkouA = math.avg(TenkanLine, KijunLine)
SenkouB = donchian(SenkouBPeriods)
plot(TenkanLine, color=color.new(color.blue,20), title="ICH: Tenkan-Sen Line")
plot(KijunLine, color=color.new(#f83444,20), title="ICH: Kijun-Sen Line")
plot(close, offset = -displacement + 1, color=color.new(#48a84d, transp=30), title="ICH: ChikouSpan")
p1 = plot(SenkouA, offset = displacement - 1, color=color.new(#A5D6A7, transp=80),
title="ICH: Senkou Span A")
p2 = plot(SenkouB, offset = displacement - 1, color=color.new(#EF9A9A, transp=80),
title="ICH: Senkou Span B")
fill(p1, p2, color = SenkouA > SenkouB ? color.rgb(67, 160, 71, 92) : color.rgb(244, 67, 54, 92))
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
BulutuBekle = input.bool(true, title='ICH: Bulut Onayını Bekle')
LongSgn = input.bool(true, title='ICH: Long Sinyal')
ShortSgn = input.bool(true, title='ICH: Short Sinyal')
SsHigh = math.max(SenkouA[displacement - 1], SenkouB[displacement - 1])
SsLow = math.min(SenkouA[displacement - 1], SenkouB[displacement - 1])
TkL = TenkanLine > KijunLine
TkS = TenkanLine < KijunLine
CsL = ta.mom(close, displacement -1) > 0
CsS = ta.mom(close, displacement -1) < 0
FiyatBulutUstu = close > SsHigh
FiyatBulutAlti = close < SsLow
AlSinyal = TkL and CsL and FiyatBulutUstu
SatSinyal = TkS and CsS and FiyatBulutAlti
YesilBulut = SenkouA > SenkouB ? true : false
if BulutuBekle
AlSinyal := AlSinyal and YesilBulut
SatSinyal := SatSinyal and not YesilBulut
SatSinyal
InLong = false
InLong := InLong[1]
InShort = false
InShort := InShort[1]
open_long = AlSinyal and not InLong
open_short = SatSinyal and InLong
if open_long
InLong := true
InLong
if open_short
InLong := false
InLong
plotchar(open_long and LongSgn, title = 'ICH: Long Sgn', char='•', color = color.new(color.lime, transp = 30) ,location = location.bottom, size = size.tiny)
plotchar(open_short and ShortSgn, title = 'ICH: Short Sgn', char='•', color = color.new(color.red, transp = 10) ,location = location.bottom, size = size.tiny)
I'm setting up an alarm system on ichimoku.
I need four parameters for it to alarm but I was able to run three parameters.
- [OK] when the cloud on the right changes color,
- [OK] if the candle close is above the cloud,
- [OK] Tenkan-Kijun lines (blue, red) crossing
- [??] Chikouspan (green) line closing above or below the cloud and price
when three parameters are captured, it creates the green/red circle symbol for the Long/Short position at the bottom
but i have to manually check the green line for incoming signals like this.
this occurs a few candles after the signal arrives and you have no choice but to wait. or it will return before the conditions are met and cause it to produce a false signal.
I can't include the green line (chikouspan) in the signal
The green line;
- For long position: should close above candles and cloud
- For the short position: it should close below the candles and the cloud.
Does anyone know how I can achieve this and can help?
I am sharing the codes clearly below. Anyone can use it. Have a good day..
//@version=5
indicator(title="YC Ichimoku Cloud", shorttitle="YC Ichimoku", overlay=true)
TenkanPeriods = input.int(9, minval=1, title="ICH: Tenkan-Sen Line Length")
KijunPeriods = input.int(26, minval=1, title="ICH: Kijun-Sen Line Length")
SenkouBPeriods = input.int(52, minval=1, title="ICH: SenkouSpan B Length")
displacement = input.int(26, minval=1, title="ICH: Yerdeğişim")
donchian(len) => math.avg(ta.lowest(len), ta.highest(len))
TenkanLine = donchian(TenkanPeriods)
KijunLine = donchian(KijunPeriods)
SenkouA = math.avg(TenkanLine, KijunLine)
SenkouB = donchian(SenkouBPeriods)
plot(TenkanLine, color=color.new(color.blue,20), title="ICH: Tenkan-Sen Line")
plot(KijunLine, color=color.new(#f83444,20), title="ICH: Kijun-Sen Line")
plot(close, offset = -displacement + 1, color=color.new(#48a84d, transp=30), title="ICH: ChikouSpan")
p1 = plot(SenkouA, offset = displacement - 1, color=color.new(#A5D6A7, transp=80),
title="ICH: Senkou Span A")
p2 = plot(SenkouB, offset = displacement - 1, color=color.new(#EF9A9A, transp=80),
title="ICH: Senkou Span B")
fill(p1, p2, color = SenkouA > SenkouB ? color.rgb(67, 160, 71, 92) : color.rgb(244, 67, 54, 92))
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
BulutuBekle = input.bool(true, title='ICH: Bulut Onayını Bekle')
LongSgn = input.bool(true, title='ICH: Long Sinyal')
ShortSgn = input.bool(true, title='ICH: Short Sinyal')
SsHigh = math.max(SenkouA[displacement - 1], SenkouB[displacement - 1])
SsLow = math.min(SenkouA[displacement - 1], SenkouB[displacement - 1])
TkL = TenkanLine > KijunLine
TkS = TenkanLine < KijunLine
CsL = ta.mom(close, displacement -1) > 0
CsS = ta.mom(close, displacement -1) < 0
FiyatBulutUstu = close > SsHigh
FiyatBulutAlti = close < SsLow
AlSinyal = TkL and CsL and FiyatBulutUstu
SatSinyal = TkS and CsS and FiyatBulutAlti
YesilBulut = SenkouA > SenkouB ? true : false
if BulutuBekle
AlSinyal := AlSinyal and YesilBulut
SatSinyal := SatSinyal and not YesilBulut
SatSinyal
InLong = false
InLong := InLong[1]
InShort = false
InShort := InShort[1]
open_long = AlSinyal and not InLong
open_short = SatSinyal and InLong
if open_long
InLong := true
InLong
if open_short
InLong := false
InLong
plotchar(open_long and LongSgn, title = 'ICH: Long Sgn', char='•', color = color.new(color.lime, transp = 30) ,location = location.bottom, size = size.tiny)
plotchar(open_short and ShortSgn, title = 'ICH: Short Sgn', char='•', color = color.new(color.red, transp = 10) ,location = location.bottom, size = size.tiny)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您必须考虑位移。由于 chikouspan 只是移至过去的当前收盘值,我们可以使用
close
作为比较的一方面。因此,对于您的长期条件,您将使用
close > high[chikoudisplacement]
以确定 chikou 是否高于历史蜡烛。为了确定chikou是否在云之上,需要将chikou和云的位移值相加
close >云[chikou位移+云位移]
You have to factor in the displacements. Since the chikouspan is just the current close value displaced into the past we can just use
close
as one side of the comparison.So for your long condition you would use
close > high[chikou displacement]
in order to determine if the chikou is above the historical candle.In order to determine if the chikou is above the cloud, you need to add the displacement values for the chikou and the cloud
close > cloud[chikou displacement + cloud displacement]