Advertisement
xmd79

Microfast HFT with ZigZag and Elliott Points

Jun 3rd, 2024
238
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.37 KB | None | 0 0
  1. //@version=5
  2. indicator("Microfast HFT with ZigZag and Elliott Points", shorttitle="Microfast HFT", overlay=true)
  3.  
  4. // Input parameters
  5. waveLength = input.int(21, "Wave Length")
  6. lookBack = input.int(100, "Look Back Period")
  7. projectionLength = input.int(50, "Projection Length")
  8. threshold = input.float(0.5, "ZigZag Threshold") // Adjust based on market volatility
  9.  
  10. // Elliott Wave calculation function
  11. getElliottWave() =>
  12. highestHigh = ta.highest(high, waveLength)
  13. lowestLow = ta.lowest(low, waveLength)
  14. waveRange = highestHigh - lowestLow
  15. waveCount = math.log(waveRange) / math.log(2) * 10 // Adjust this multiplier based on your preference
  16. waveCount
  17.  
  18. // Custom ZigZag calculation function
  19. getZigZag() =>
  20. var float lastHigh = na
  21. var float lastLow = na
  22. var bool isHigh = na
  23. var float zigzagValue = na
  24.  
  25. if high[1] > high and high[1] > high[2]
  26. lastHigh := high[1]
  27. isHigh := true
  28. if low[1] < low and low[1] < low[2]
  29. lastLow := low[1]
  30. isHigh := false
  31.  
  32. if isHigh
  33. zigzagValue := lastLow
  34. else
  35. zigzagValue := lastHigh
  36.  
  37. zigzagValue
  38.  
  39. // Main code
  40. waveCount = request.security(syminfo.tickerid, "D", getElliottWave())
  41. zigzag = request.security(syminfo.tickerid, "D", getZigZag())
  42.  
  43. // Plotting
  44. plot(zigzag, color=color.blue, linewidth=2, title="ZigZag")
  45.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement