Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Variables
- bigHigh = ta.highest(200)
- bigLow = ta.lowest(200)
- atr200 = ta.atr(200)
- type cycle
- int startCycle
- int endCycle
- line cycleLine
- label cycleLabel
- var array<cycle> Cycles = array.new<cycle>()
- //Draw
- getCurrentType() =>
- if cycleType == "TK"
- if tenkanCross
- newCycle = cycle.new(bar_index, na, line.new(bar_index, bigLow, bar_index, bigLow, color=color.green, width=1, style=line.style_arrow_right), label.new(bar_index, bigLow, "", style=label.style_none, color=color.green, textcolor=color.white))
- array.unshift(Cycles, newCycle)
- if kijunCross
- newCycle = cycle.new(bar_index, na, line.new(bar_index, bigLow, bar_index, bigLow, color=color.red, width=1, style=line.style_arrow_right), label.new(bar_index, bigLow, "", style=label.style_none, color=color.red, textcolor=color.white))
- array.unshift(Cycles, newCycle)
- if (tenkanCross or kijunCross) and array.size(Cycles) > 1
- previousCycle = array.get(Cycles, 1)
- previousCycle.endCycle := bar_index
- duration = previousCycle.endCycle - previousCycle.startCycle
- line.set_x2(previousCycle.cycleLine, bar_index)
- label.set_x(previousCycle.cycleLabel, previousCycle.startCycle + duration / 2)
- label.set_text(previousCycle.cycleLabel, str.tostring(duration))
- if array.size(Cycles) > cycleLength + 1
- oldestCycle = array.pop(Cycles)
- line.delete(oldestCycle.cycleLine)
- label.delete(oldestCycle.cycleLabel)
Advertisement
Add Comment
Please, Sign In to add comment