Striking Backtesting Performance of the PLTR Elliott Wave Algo-Trading Strategy vs Buy&Hold
Discover the dynamic fractal pattern of market action to identify the top profitable PLTR trading strategy that significantly outperforms the passive benchmark
“The stock market is not a gamble; it is a business. And it should be conducted as such, and it must be, to be successful.” — Ralph Nelson Elliott
Image Design by the Author via Canva.
In this post, we’ll take a look at the high-frequency trading strategy based on the Elliot Wave Oscillator (EWO) [1].
EWO is fundamentally a trend-following, momentum indicator.
The theory assumes that stock price movements can be predicted because they move in repeating up-and-down patterns (aka waves) created by investor sentiment.
In the sequel, we’ll use the wave patterns to identify potential trade opportunities, such as buying at the end of a corrective wave and selling at the end of an impulse wave.
For the present use-case example, we’ll focus on Palantir Technologies Inc. (PLTR) as the time series. Here’s why:
The stock has gained 81% in 2025
It has a 21-day ATR of 4.67%
It holds an Accumulation/Distribution Rating of B-plus
It is among AI stocks to watch.
Most algo trading content gives you theory.
This gives you the code.
3 Python strategies. Fully backtested. Colab notebook included. Plus a free ebook with 5 more strategies the moment you subscribe.
5,000 quant traders already run these:
Subscribe | AlgoEdge Insights
Daily algorithmic trading signals, market insights, and code-ready strategies to sharpen your edge.algoedgeinsights.beehiiv.com
Let’s delve into the specifics of the ultimate 4 step Elliott Wave trading strategy for maximizing PLTR stock returns in 2025.
Step 1: Importing the necessary Python libraries and using the TwelveData API reading the PLTR stock data from 2025–01–01 to 2025–06–26 [2]
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import requests
from math import floor
from termcolor import colored as cl
plt.style.use(’fivethirtyeight’)
plt.rcParams[’figure.figsize’] = (20,10)
# EXTRACTING STOCK DATA
import pandas as pd
import numpy as np
import requests
import matplotlib.pyplot as plt
from math import floor
from termcolor import colored as cl
plt.style.use(’fivethirtyeight’)
plt.rcParams[’figure.figsize’] = (20,10)
def get_historical_data(symbol, start_date):
api_key = ‘YOUR API KEY’
api_url = f’https://api.twelvedata.com/time_series?symbol={symbol}&interval=1day&outputsize=5000&apikey={api_key}’
raw_df = requests.get(api_url).json()
df = pd.DataFrame(raw_df[’values’]).iloc[::-1].set_index(’datetime’).astype(float)
df = df[df.index >= start_date]
df.index = pd.to_datetime(df.index)
return df
df = get_historical_data(’PLTR’, ‘2025-01-01’)
df.tail()
open high low close volume
datetime
2025-06-20 140.69000 142.24001 136.74200 137.30000 87067000.0
2025-06-23 138.89999 142.14999 135.96001 139.92000 70501100.0
2025-06-24 140.98000 143.66000 137.80000 143.23000 58574200.0
2025-06-25 144.49001 147.67000 141.53000 142.89999 61244300.0
2025-06-26 144.93000 148.20000 142.93000 144.42000 3010721.0Using Plotly to visualize the PLTR candlestick chart with volume [4]
from plotly.subplots import make_subplots
import plotly.graph_objects as go
fig = make_subplots(rows=2, cols=1, shared_xaxes=True, vertical_spacing=0.05, row_heights = [0.7, 0.3])
fig.add_trace(go.Candlestick(x=df.index,
open=df[’open’],
high=df[’high’],
low=df[’low’],
close=df[’close’],
name=’PLTR’),
row=1, col=1)
# Plotting volume chart on the second row
fig.add_trace(go.Bar(x=df.index,
y=df[’volume’],
name=’Volume’,
marker=dict(color=’black’, opacity=1.0)),
row=2, col=1)
# Configuring layout
fig.update_layout(title=’PLTR Candlestick Chart’,
yaxis=dict(title=’Price (USD)’),
height=1000,
template = ‘plotly_white’)
# Configuring axes and subplots
fig.update_xaxes(rangeslider_visible=False, row=1, col=1)
fig.update_xaxes(rangeslider_visible=False, row=2, col=1)
fig.update_yaxes(title_text=’Price (USD)’, row=1, col=1)
fig.update_yaxes(title_text=’Volume’, row=2, col=1)
fig.show()PLTR candlestick chart with volume
② One strategy in this book returned 2.3× the S&P 500 on a risk-adjusted basis over 5 years.
Fully coded in Python. Yours to run today.
The 2026 Playbook — 30+ backtested strategies,
full code included, ready to deploy.
20% off until Thursday. Use MAY2026 at checkout.
$79 → $63.20 · Expires May 21.
AlgoEdge Insights: 30+ Python-Powered Trading Strategies – The Complete 2026 Playbook
Step 2: Calculating and plotting the Elliott Wave Oscillator [1]
# Calculate the difference between the current and previous day’s closing prices
df[’diff’] = df[’close’].diff()
# Identify upward and downward trends
df[’up’] = np.where(df[’diff’] > 0, 1, 0)
df[’down’] = np.where(df[’diff’] < 0, 1, 0)
# Calculate the running total of up and down days
df[’up_days’] = df[’up’].cumsum()
df[’down_days’] = df[’down’].cumsum()
# Calculate the Elliott Wave Oscillator
df[’ewo’] = 100 * (df[’up_days’] - df[’down_days’]) / (df[’up_days’] + df[’down_days’])
# Plot the Elliott Wave Oscillator
import matplotlib.pyplot as plt
plt.plot(df[’ewo’])
plt.xlabel(’Date’)
plt.ylabel(’Elliott Wave Oscillator’)
plt.title(’PLTR Elliott Wave Oscillator’)
plt.show()PLTR Elliott Wave Oscillator
Step 3: Identifying the Elliot Waves for PLTR [1]
waves = []
for i in range(0, len(df)):
if i==0:
waves.append(0)
if df[”close”][i] > df[”close”][i-1] and i>0:
waves.append(1)
elif df[”close”][i] < df[”close”][i-1] and i>0:
waves.append(-1)
#Add waves to the SP500 dataframe
x=0
waves.insert(0, x)
df[”Waves”] = waves
#Plot the waves
plt.plot(df[”Waves”])
plt.title(”Elliot Waves for PLTR”)
plt.xlabel(”Time”)
plt.ylabel(”Wave”)
plt.show()
#Identify the waves
wave_count = 0
for i in range(1, len(df)):
if df[”Waves”][i] == 1:
wave_count += 1
elif df[”Waves”][i] == -1:
wave_count -= 1
#identify future evolution of spot based on wave count
if wave_count > 0:
print(”PLTR is likely to increase in the future.”)
elif wave_count < 0:
print(”PLTR is likely to decrease in the future.”)
else:
print(”PLTR is likely to remain stable in the future.”)
PLTR is likely to increase in the future.Elliot Waves for PLTR
Visualizing the Elliot Wave buy and sell signals for PLTR [3]
buysignals = df[df[”Waves”] == 1]
sellsignals = df[df[”Waves”] == -1]
plt.figure(figsize=(14,6))
plt.plot(df[”close”], color=”b”, label=”Price”)
plt.ylabel(”Price”)
for idx in buysignals.index.tolist():
plt.plot(
idx,
df.loc[idx][”close”],
“g*”,
markersize=25
)
for idx in sellsignals.index.tolist():
plt.plot(
idx,
df.loc[idx][”close”],
“r*”,
markersize=25
)
ax = plt.gca()
for index, label in enumerate(ax.xaxis.get_ticklabels()):
if index % 1 != 0:
label.set_visible(False)
plt.legend()
plt.show()Elliot Wave buy and sell signals vs close price for PLTR
Step 4: Comparing PLTR daily and cumulative returns (backtesting [2]): Elliot Wave strategy vs B&H benchmark
mysignal=df[”Waves”]
position = []
for i in range(len(mysignal)):
if mysignal[i] == 1:
position.append(1)
else:
position.append(0)
for i in range(len(df[’close’])):
if mysignal[i] == 1:
position[i] = 1
elif mysignal[i] == -1:
position[i] = 0
else:
position[i] = position[i-1]
rets = df.close.pct_change().dropna()
strat_rets = position[1:]*rets
plt.figure(figsize=(14,6))
#plt.title(’Daily Returns’)
rets.plot(color = ‘blue’, alpha = 0.3, linewidth = 7,label=’B&H’)
strat_rets.plot(color = ‘r’, linewidth = 1,label=’Strategy’)
plt.legend()
plt.title(”PLTR Daily Returns”)
plt.show()⑤ Most quant courses teach you to watch. This one makes you build.
Live. Weekly. With feedback on your actual code.
The AlgoEdge Quant Finance Bootcamp — 12 weeks of stochastic models, Black-Scholes, Heston, volatility surfaces, and exotic options. Built from scratch in Python.
Not pre-recorded. Not self-paced. Live sessions, weekly homework, direct feedback, and a full code library that’s yours to keep.
Cohort size is limited intentionally — so every question gets answered.
AlgoEdge Insights Quant Finance Bootcamp: Stochastic Models, Volatility, & Option Pricing Mastery
PLTR Daily Returns
rets_cum = (1 + rets).cumprod() - 1
strat_cum = (1 + strat_rets).cumprod() - 1
plt.figure(figsize=(14,6))
plt.title(’Cumulative Returns’)
rets_cum.plot(color = ‘blue’, alpha = 0.3, linewidth = 7,label=’B&H’)
strat_cum.plot(color = ‘r’, linewidth = 2,label=’Strategy’)
plt.legend()
plt.title(”PLTR Cumulative Returns”)
plt.show()PLTR Cumulative Returns
Comparing cumulative returns from the last available 5 days
#Strategy
strat_cum.tail()
datetime
2025-06-20 10.586790
2025-06-23 10.807892
2025-06-24 11.087224
2025-06-25 11.087224
2025-06-26 11.215795
#B&H
rets_cum.tail()
datetime
2025-06-20 0.826041
2025-06-23 0.860886
2025-06-24 0.904908
2025-06-25 0.900519
2025-06-26 0.920734It is clear that the PLTR profitability ratio Strategy/B&H is 12.17 on 2025–06–26.
Conclusions
In this post, we have shown how to backtest the EWO trading strategy while avoiding subjective interpretation of repeated patterns found in larger/smaller time frames.
This is where Elliott Wave meets quant trading.
In practice, multiple factors should line up to help confirm trade signals with confidence: support and resistance levels, different technical indicators, fundamental analysis, etc.
Disclaimer
I declare that this article is written by me and not with any generative AI tool such as ChatGPT.
I declare that no data privacy policy is breached, and that any data associated with the contents here are obtained legitimately to the best of my knowledge.
The following disclaimer clarifies that the information provided in this article is for educational use only and should not be considered financial or investment advice.
The information provided does not take into account your individual financial situation, objectives, or risk tolerance.
Any investment decisions or actions you undertake are solely your responsibility.
You should independently evaluate the suitability of any investment based on your financial objectives, risk tolerance, and investment timeframe.
It is recommended to seek advice from a certified financial professional who can provide personalized guidance tailored to your specific needs.
The tools, data, content, and information offered are impersonal and not customized to meet the investment needs of any individual. As such, the tools, data, content, and information are provided solely for informational and educational purposes only.










