The 2001 Bonus Issue of STOCKS & COMMODITIES contained an article titled "Three-Line Break Reversal Signals." No EasyLanguage code was included with the article, and TradeStation doesn't provide an option to create a three-line break chart. Thus, I'd like to share the following EasyLanguage code for a PaintBar study that simulates a three-line break chart.
Here's the EasyLanguage code I've devised to implement the squelch indicator, which you can read about elsewhere in this issue. This code is identical to the Hilbert period code from my March 2000 article, with the addition of the squelch threshold and the display being implemented as a paintbar -- that is, a bar on the chart being colored, depending on the squelch's value.
Here's EasyLanguage code to implement the squelch control as a paintbar:
The two PaintBar Studies given next also focus on the RSI oscillator, but produce different visual results. When the RSI calculation is above 50, the price bar will be painted blue. When the RSI calculation is below 50, the price bar will be painted red. The color of the price bar indicates the direction of the current/historical trend. When the color changes as a result of an RSI cross above or below zero, an alert will be triggered. Here, then, is the Power Editor code for the two PaintBar Studies:
The r-squared calculation that Jack Karczewski focuses on in "Identifying market trends" is very useful in identifying trending and nontrending periods in the markets. This month, I'll present a revised version of the r-squared indicator given in Jon Andersen's September 1996 STOCKS & COMMODITIES article, "Standard error bands." I'll also include two PaintBar studies that identify trending and nontrending periods by painting the price bars. All three studies reference a function named "coeffR" for their basic calculation.
The NLR Indicator uses non-linear regression analysis to estimate a curve through price data. Potential applications include but are not limited to:
1) estimates of next price(s)
2) price envelopes and/or channels
3) moving average replacements
To implement the strategies from my article, "Mutated variables, volatility and a new market paradigm," first write the programs that will generate studies and systems. Begin by building a function that indicates the current state of the market. Use this function to build indicators, paintbars and systems. Use of the BollingerBand function saves some programming time, but you could also insert your own standard deviation function here if you want to be more precise.
New market paradigm paintbar studies
This is a variation that paints the bar on the main chart. I can't provide an ELD since I only use TS2000i.
Here's an enhancement to the original code you might consider. This modification compares current bar open-to-close range (bar body) with prior bars. If current body is within a prior bar body (you select how far back to look) then color remains the same.
This is beneficial if you choose to exit a major trend move on first color change and don't want to exit prematurely due to a minor pullback. The drawback is a possible later entry and later exit.