Walmart’s 7-Year Nonlinear Market Trend using ‘Stealth Curves’

[This article was first published on, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

For anyone who missed my nonlinear trending R-Blogger post of the wheat market (symbol = WEAT), reference it here.

Be certain to place the following single line of code at the top of that original post which was mistakenly omitted (Only the interactive charting is affected.).  The ‘Rcharts’ library makes use of the ‘hPlot’ R command.

The code below generates the current 7-year, nonlinear market trend of Walmart’s (WMT) price evolution. 

Walmart’s 7-Year Nonlinear Market Trend

The graphic indicates the following characteristics with respect to Walmart’s share price:

  1. The trend is upward sloping.
  2. Extension of the Stealth Channel into future periods indicates the potential for increased price volatility (expanding channel) provided price evolution continues to adhere to the established trend.
Stealth Curves are used to identify 1) nonlinear market trending not easily discernible on a price chart and 2) ‘time and price’ points where price reversals may occur in future periods. Failure of markets to reverse at/near established Stealth Curves also frequently provides key market insight.

Though the 2 depicted Stealth Curves have not been ‘tested’ to the degree of the declining WEAT Stealth Support Curve in the prior post, this Stealth Channel does capture numerous years of market action.

Daily low prices are used in this example as matter of personal preference. As the WEAT post indicates, the user can generally use any price definition (open, high, low, close, average, etc.) provided it is consistently applied in the analysis.

Download WMT price data from my personal GitHub site, save to a local disk, and read into a ‘wmt’ tibble.

# Original data source -

# Download reformatted data (columns/headings) from github and save to a local drive

wmt <- read_excel("/Users/brianlee/Dropbox/__Blogs-and-Posts/__r_bloggers/WMT_nasdaq_com_data_reformatted.xlsx")

# Convert 'Date and Time' to 'Date' column
wmt[["Date"]] <- as.Date(wmt[["Date"]])

bars <- nrow(wmt)

# Add bar indicator as first tibble column

wmt <- wmt %>%
  add_column(t = 1:nrow(wmt), .before = "Date")
View tibble

Prior to developing Stealth Curve charts, it is often advantageous to view the raw data in an interactive chart, as Stealth Curves are defined by selecting 3 data points representing market pivots.

# Interactive Pricing Chart (Low prices)

xmin <- 1              
ymin <- 0   
ymax_low <- ceiling(max(wmt[["Low"]]))

interactive_low <- hPlot(x = "t", y = "Low", data = wmt, type = "line",
                     ylim = c(ymin, ymax_low),
                     xlim = c(xmin, bars),
                     xaxt="n",   # suppress x-axis labels
                     yaxt="n",   # suppress y-axis labels,
                     ann=FALSE)  # x and y axis titles

interactive_low$set(height = 600)

interactive_low$set(width = 700)

interactive_low$plotOptions(line = list(color = "green"))

interactive_low$chart(zoomType = "x")   # Highlight range of chart to zoom in

Interactive Pricing Chart WMT Daily Low Prices 

Highlight any range to zoom data and view price on any bar number.

Interactive Chart WMT Daily Low Prices (Zoomed)

Prior to plotting using the ‘Plot’ command, add 400 additional rows to the tibble in preparation for extending the calculated Stealth Curve into future periods.  An advantage of Stealth Curves is they can be projected into future periods as well as back-casted to prior periods.

# Add 400 future days to the tibble for projection of the Stealth Curve once added

future <- 400

wmt <- wmt %>%
  add_row(t = (bars+1):(bars+future))
Chart the WMT daily low prices with 400 days of padding.

# Market Pivot Lows using 'Low' Prices

# Chart 'Low' WMT prices

background <- c("azure1")

chart_title_low <- c("Walmart (WMT) \nDaily Low Prices ($)")

u <- par("usr") 

rect(u[1], u[3], u[2], u[4], col = background) 



t <- wmt[["t"]]
Price <- wmt[["Low"]]

plot(x=t, y=Price, main = chart_title_low, type="l", col = "blue", 
     ylim = c(ymin, ymax_low) ,
     xlim = c(xmin, (bars+future )) )    

Emphasis going forward is on the shaded region where the market is nonlinearly trending.  The horizontal axis represents time (t) stated as bar numbers (t1=1 = bar 1 = Date 1/3/2000).  This starting ‘t1=1‘ value is entirely arbitrary and does not impact the position of a calculated Stealth Curve on a chart.  Stealth Curve equation parameterization is impacted whenever the ‘t1‘ value is changed, though the curve’s charted position remains unchanged.  Note the equation parameters in this post are based on a ‘t1=1‘ assumption.

The Stealth Support Curve is defined by the following equation.

  Add this Stealth Support Curve to the tibble.

# Stealth Support Curve parameters
a <- -432687.30  
b <-     -57.52 
c <-   -7794.36  

wmt <- wmt %>%
  mutate(Stealth_Curve_Low = a/(t + c) + b)
Add NA padding where the curve does not apply.

# Omit Stealth Support Curve values from charting 

wmt[["Stealth_Curve_Low"]][1:3900] <- NA   
Add the calculated Stealth Support Curve to a zoomed chart.

# Chart Low wmt prices

u <- par("usr") 

rect(u[1], u[3], u[2], u[4], col = background) 



chart_title_low <- c("Walmart (WMT) \nDaily Low Prices ($)")

t <- wmt[["t"]]
Price <- wmt[["Low"]]

# Focus only on the last 7 years 
xmin = 3700

plot(x=t, y=Price, main = chart_title_low, type="l", col = "blue", 
     ylim = c(ymin, ymax_low + 100) ,
     xlim = c(xmin, (bars+future )) )  

# Add Stealth Support Curve to chart

lines(t, wmt[["Stealth_Curve_Low"]])
  Daily Low Prices with Stealth Support Curve

Next, add the Stealth Resistance Curve to the tibble. The Stealth Resistance Curve is defined as follows:

# Stealth Resistance Curve parameters

a <-  -102950.40  
b <-       47.63  
c <-    -6252.63  

# Add Stealth Curve to tibble

wmt <- wmt %>%
  mutate(Stealth_Curve_High = a/(t + c) + b)

# Omit Stealth Curve values from charting

wmt[["Stealth_Curve_High"]][1:3700] <- NA

# Add Stealth Resistance Curve to chart

lines(t, wmt[["Stealth_Curve_High"]])
7-Year Walmart Stealth Channel

For those interested in numerous Stealth Curve examples applied to various other markets, simply view this LinkedIn post.  Full details of Stealth Curve equation parameterization are described in my latest Amazon publication, Stealth Curves: The Elegance of ‘Random’ Markets.

Brian K. Lee, MBA, PRM, CMA, CFA
Feel free to contact me directly on my LinkedIn site.  


Walmart’s 7-Year Nonlinear Market Trend using ‘Stealth Curves’ was first posted on October 28, 2021 at 11:17 pm.

To leave a comment for the author, please follow the link and comment on their blog: offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)