Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //@version=5
- indicator("Microfast HFT with ZigZag and Elliott Points", shorttitle="Microfast HFT", overlay=true)
- // Input parameters
- waveLength = input.int(21, "Wave Length")
- lookBack = input.int(100, "Look Back Period")
- projectionLength = input.int(50, "Projection Length")
- threshold = input.float(0.5, "ZigZag Threshold") // Adjust based on market volatility
- // Elliott Wave calculation function
- getElliottWave() =>
- highestHigh = ta.highest(high, waveLength)
- lowestLow = ta.lowest(low, waveLength)
- waveRange = highestHigh - lowestLow
- waveCount = math.log(waveRange) / math.log(2) * 10 // Adjust this multiplier based on your preference
- waveCount
- // Custom ZigZag calculation function
- getZigZag() =>
- var float lastHigh = na
- var float lastLow = na
- var bool isHigh = na
- var float zigzagValue = na
- if high[1] > high and high[1] > high[2]
- lastHigh := high[1]
- isHigh := true
- if low[1] < low and low[1] < low[2]
- lastLow := low[1]
- isHigh := false
- if isHigh
- zigzagValue := lastLow
- else
- zigzagValue := lastHigh
- zigzagValue
- // Main code
- waveCount = request.security(syminfo.tickerid, "D", getElliottWave())
- zigzag = request.security(syminfo.tickerid, "D", getZigZag())
- // Plotting
- plot(zigzag, color=color.blue, linewidth=2, title="ZigZag")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement