KijunSen Line With Cross

Author: ChaoZhang, Date: 2022-05-10 16:16:07
Tags: 趋势

Kijen Sen Independent Line of Ichimoku Trading System

Many traders in the financial markets use Ichimoku components to detect trends, which is why I published this indicator.



// This source code is subject to the terms of the Mozilla Public License 2.0 at
// © dilan1999

indicator('KijunSen Line With Cross', overlay=true)
n = input(26, 'Length')
h = ta.highest(high, n)
l = ta.lowest(low, n)
value = (h + l) / 2

showCross = input(true, title='Show Candle Cross?')
crossUp = ta.crossover(hl2, value)
crossDown = ta.crossunder(hl2, value)

//Show Cross
plotshape(showCross and crossUp, text='*', style=shape.labelup, location=location.belowbar,, 0),, 0), size=size.small)
plotshape(showCross and crossDown, text='*', style=shape.labeldown, location=location.abovebar,, 0),, 0), size=size.small)

plot(value, color=(hl2 > value ? color.lime :, linewidth=2)
if showCross and crossUp
    strategy.entry("Enter Long", strategy.long)
else if showCross and crossDown
    strategy.entry("Enter Short", strategy.short)