Elliott Wave Strategy
Discover our Elliott Wave Strategy Pine Script template, designed for traders seeking to identify potential wave extensions using Fibonacci levels. Easily backtest on TradingView and live execute this template on AlgoTest, adjusting inputs like Fibonacci level, target points, and stop loss points to suit your trading preferences.
info
To learn how to add this pinescript in TradingView, click here.
Elliott Wave Indicator Pinescript​
warning
These strategies are for demonstration purposes only and are not intended for actual trading. AlgoTest is not responsible for any profit or loss arising from the use of these sample strategies.
//@version=5
strategy("Elliott Wave Strategy", overlay=true)
// Input parameters
fib_level = input.float(1.618, title="Fibonacci Level")
length = input.int(10, "Length of Historical Candles")
target_points = input.int(100, title="Target Points")
stop_loss_points = input.int(50, title="Stop Loss Points")
// Calculate Fibonacci retracement levels
wave_high = ta.highest(high, 10)
wave_low = ta.lowest(low, 10)
wave_range = wave_high - wave_low
fib_0 = wave_high
fib_100 = wave_low
fib_1618 = fib_0 - fib_level * wave_range
// Plot Fibonacci retracement levels
plot(fib_0, color=color.blue, title="Fib 0.0")
plot(fib_100, color=color.red, title="Fib 100.0")
plot(fib_1618, color=color.green, title="Fib 161.8")
// Strategy logic
long_condition = ta.crossover(close, fib_1618)
short_condition = ta.crossunder(close, fib_1618)
// Strategy entry
if long_condition
strategy.entry("Long", strategy.long)
if short_condition
strategy.entry("Short", strategy.short)
// Calculate target and stop loss levels
long_target = close + target_points
long_stop_loss = close - stop_loss_points
short_target = close - target_points
short_stop_loss = close + stop_loss_points
// Strategy exit
strategy.exit("Long Exit", "Long", limit=long_target, stop=long_stop_loss)
strategy.exit("Short Exit", "Short", limit=short_target, stop=short_stop_loss)