Skip to content

Tutorial 170 | Looking for a chart pattern on several symbols using PSPs

Tutorial 170 demonstrates how multiple symbols can be loaded on a chart by using several price series providers (PSPs) to test for a specific condition (in this example a simple hammer pattern).

With tutorial 170 a list of stocks is stored in a text file stored on the local computer. This file is read into the program using the StreamReader and the names of the stocks stored in a TokenList after having been checked by another method that they are a valid symbol. Once the data has been downloaded a loop creates a PSP for each symbol in turn. The PSPs are stored in a vector. Update and state changed events are also created for each PSP.

Tutorial 170 monitors the state changed and update events for each PSP. When the PSP is first loaded and when each PSP closes, it performs a calculation to see if a simple candlestick pattern has occurred.

The tutorial contains some of the same techniques as _QuickTip37 (see https://markplex.com/free-tutorials/)
Program 71 (see https://markplex.com/easylanguage-programs/program-71-multiple-timeframe-averages-analysis/)
and Tutorial 168 (see https://markplex.com/free-tutorials/tutorial-168-calculating-moving-averages-on-radarscreen-for-different-intervals-using-price-series-providers/)

Hammer pattern

The open and close of the bar must be in the region above the middle line
Markples “hammer” pattern.The open and close of the bar must be in the region above the middle line

In this program, the hammer pattern is defined as when the body of the candle is relatively small compared to the wick and occurs above the middle horizontal line shown in the image to the right. A user input: BarPercentage determines the exact position of the middle horizontal line.

Similarly, an inverse hammer pattern is defined as when the body of the candle is relatively small compared to the wick and occurs below the middle horizontal line. For inverse hammer patterns the position of the middle line is measured from the high of the bar.

The formulae for determining the patterns are:

Hammer definition

HiBar = Open > ( ( High – Low ) * BarPercentage / 100 ) + Low and Close > ( ( High – Low ) * BarPercentage / 100 ) + Low;

Inverse hammer definition

LoBar = Open < High – ( ( High – Low ) * BarPercentage / 100 ) and Close < High – ( ( High – Low ) * BarPercentage / 100 );

It would be relatively straightforward to modify this if you required a more stringent definition of a hammer (for example, if the close or open had to be near or at the top of the bar for a hammer pattern).

Tutorial 170 uses a lot of resources, depending on the number of symbols loaded, how much history is included and the bar interval. This resource requirement can be decreased by reducing the number of symbols and history however, in testing, there were occasional problems with TradeStation hanging due to excessive resource use when the program was left to run.  Probably the best way to use this program would be to run it, see the results for the latest bar, and then turn the status to off. Retests of future bars can be done by changing the status to on.

Download Tutorial 170

The unprotected and commented tutorial program (i.e. the TradeStation EasyLanguage Indicator):

_Tutorial170 download is available for immediate download for $19.95 by clicking the following ‘add to cart’ button where you may pay with a credit card or by using PayPal.

The program is compatible with versions TradeStation 10. It is not compatible with MultiCharts.

THE TRADING APPS, INDICATORS, SHOW ME STUDIES, STRATEGIES AND OTHER PROGRAMS HAVE BEEN INCLUDED SOLELY FOR EDUCATIONAL PURPOSES.

TO THE BEST OF MARKPLEX CORPORATION’S KNOWLEDGE, ALL OF THE INFORMATION ON THIS PAGE IS CORRECT, AND IT IS PROVIDED IN THE HOPE THAT IT WILL BE USEFUL. HOWEVER, MARKPLEX CORPORATION ASSUMES NO LIABILITY FOR ANY DAMAGES, DIRECT OR OTHERWISE, RESULTING FROM THE USE OF THIS INFORMATION AND/OR PROGRAM(S) DESCRIBED, AND NO WARRANTY IS MADE REGARDING ITS ACCURACY OR COMPLETENESS. USE OF THIS INFORMATION AND/OR PROGRAMS DESCRIBED IS AT YOUR OWN RISK.

ANY EASYLANGUAGE OR POWERLANGUAGE TRADING STRATEGIES, TRADING APPS, SIGNALS, STUDIES, INDICATORS, SHOWME STUDIES, PAINTBAR STUDIES, PROBABILITYMAP STUDIES, ACTIVITYBAR STUDIES, FUNCTIONS (AND PARTS THEREOF) AND ASSOCIATED TECHNIQUES REFERRED TO, INCLUDED IN OR ATTACHED TO THIS TUTORIAL OR PROGRAM DESCRIPTION ARE EXAMPLES ONLY, AND HAVE BEEN INCLUDED SOLELY FOR EDUCATIONAL PURPOSES. MARKPLEX CORPORATION. DOES NOT RECOMMEND THAT YOU USE ANY SUCH TRADING STRATEGIES, SIGNALS, STUDIES, INDICATORS, SHOWME STUDIES, PAINTBAR STUDIES, PROBABILITYMAP STUDIES, ACTIVITYBAR STUDIES, FUNCTIONS (OR ANY PARTS THEREOF) OR TECHNIQUES. THE USE OF ANY SUCH TRADING STRATEGIES, SIGNALS, STUDIES, INDICATORS, SHOWME STUDIES, PAINTBAR STUDIES, PROBABILITYMAP STUDIES, ACTIVITYBAR STUDIES, FUNCTIONS AND TECHNIQUES DOES NOT GUARANTEE THAT YOU WILL MAKE PROFITS, INCREASE PROFITS, OR MINIMIZE LOSSES.