Guest User

Untitled

a guest
Aug 22nd, 2024
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.56 KB | None | 0 0
  1. //Variables
  2. bigHigh = ta.highest(200)
  3. bigLow = ta.lowest(200)
  4. atr200 = ta.atr(200)
  5. type cycle
  6. int startCycle
  7. int endCycle
  8. line cycleLine
  9. label cycleLabel
  10. var array<cycle> Cycles = array.new<cycle>()
  11.  
  12. //Draw
  13. getCurrentType() =>
  14. if cycleType == "TK"
  15. if tenkanCross
  16. 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))
  17. array.unshift(Cycles, newCycle)
  18. if kijunCross
  19. 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))
  20. array.unshift(Cycles, newCycle)
  21.  
  22. if (tenkanCross or kijunCross) and array.size(Cycles) > 1
  23. previousCycle = array.get(Cycles, 1)
  24. previousCycle.endCycle := bar_index
  25. duration = previousCycle.endCycle - previousCycle.startCycle
  26. line.set_x2(previousCycle.cycleLine, bar_index)
  27. label.set_x(previousCycle.cycleLabel, previousCycle.startCycle + duration / 2)
  28. label.set_text(previousCycle.cycleLabel, str.tostring(duration))
  29.  
  30. if array.size(Cycles) > cycleLength + 1
  31. oldestCycle = array.pop(Cycles)
  32. line.delete(oldestCycle.cycleLine)
  33. label.delete(oldestCycle.cycleLabel)
  34.  
Advertisement
Add Comment
Please, Sign In to add comment