Dangerous Divergence

Larry Pesavento: ‘Pattern recognition is a viable method of determining the direction of the market within limits. It is far from an exact science but it does put the odds heavily in the favor of the pattern recognition trader. The work from Dr. Andrew Lo at the Massachusetts Institute of Technology proved this validity without a shadow of a doubt that eventually led to his book “The Non-Random Walk Down Wall Street“. 

In addition to pattern recognition there are other tools that the technician can use to help determine unusual trading opportunities. It is my opinion, we are at one of these significant points in the stock market. There are two charts accompanying this dialogue that deserve your attention. The first chart shows of the divergence between the NASDAQ market and the New York Stock Exchange index at the top of the market in 2007.

In 2007, the NASDAQ was making substantially higher highs whereas the New York Stock Exchange index was making a classical double top. Presently, we have a similar situation with the NASDAQ screaming into new high ground whereas the New York Stock Exchange index is barely making a 786 retracement of last year’s high. I will leave it up to the readers to determine if this is worthy of your attention, but patterns do repeat and it’s something to keep in the back of your mind.

So many things are coming together at present that it is hard to believe that the market could go higher from these current levels.  But the one thing we have learned from decades of experience is that market trends can last longer than your equity if you do not plan for risk and watch out for the safety of your capital.’

ESPL: ToolBar and ToolButton

The Ensign 10 ESPL IDE has received significant additions..

  1. Added TStringGrid component
  2. Added TToolBar component
  3. Added TToolButton component
  4. Added TPaintBox component
  5. Added StrUtils library
  6. Exposed 5 Ensign 10 TImageLists named:
    imgList16, imgList24, imgList32, imgMarker, and imgLine

This example shows a form using TToolBar, TToolButton and imgMarker.

At design time, a TToolBar object was added to the form and aligned for alTop. Then four TToolButtons were added to to the ToolBar.

At run time, the imgMarker list of images from Ensign 10 is assigned to the ToolBar images property, and the ImageIndex properties assigned for the ToolButtons.  See the ESPL documentation for the Marker indexes in the Appendix.

Of course, a TImageList can be added to the form, and one’s own images can be added to the component.  At design time, the TToolBar images property can be set to the TImageList on the form, and the ToolButton imageindex property set.

The click event for each of the toolbuttons can be written to perform a desired action.

ESPL: 2-Dimensional Arrays

Q:  How do I declare a 2-dimensional dynamic array in ESPL?   A dynamic array is one where I don’t know the bounds at compile time.  It grows dynamically as new array elements are added.

A:  ESPL supports a variety of arrays, each with different characteristics.  Let me summarize the choices.

  • Multi-diminsional arrays are declared with the [ ] construct at compile time.  See the ESPL manual, topic ‘Arrays’ on page 29.
  • TArrays are single dimensional and semi-automatic in their dimension.
  • Variant arrays can be dimensioned and redimensioned, but they also are single dimensional.
  • TLists and TStringLists are single dimension.  They dynamically grow as elements are added.
  • The TStringGrid object is 2-dimensional with RowCount and ColCount properties.  And these properties can be set at run time.   The values are written and read in the string grid cells.   See this example.

Tick Count in a Bar’s Range

Q:  I am wanting to know the number of ticks per bar. The total count from the high to the low. (Bonds are 1/32 so they are tricky).

A:  Ensign has a value called Tick Count for each bar, but I do not think that is what you seek since you mentioned 1/32nds. The Tick Count is the number of trade ticks received for the bar. I think you are wanting to count the number of price intervals in a bar’s range. For example, if the bar’s High is 109-040 and the bar’s Low is 109-020 the answer is 4 on a ZB bond chart because the difference is 4/64ths.  ZB trades in half 32nds.

This DYO example will make the calculation and show the price count above each bar.

The BAR marker selection will post the expression result as an integer value.  The Marker Location selection used was the Above High 5 location.

Overlay Daily Bar

Q:  Can Ensign overlay a Daily bar chart on a 120-minute bar chart?

A:  Ensign does not overlay charts with different time frames. Ensign overlays would be of the same timeframe for both charts.

However, this DYO example will plot a daily bar on the intra-day chart. It is not exactly what you requested but might be sufficient for your purposes.

The DYO made the daily bars which are shown in yellow. There are 3 other DYO marker  choices that can do a Standard bar, Candlestick, and Ensign Rocket. The example shows the Flute bar style.

The only line that is plotting is Line K.   Lines A, B, C, F and G which are not necessary for the example are included so that you can check their Show boxes and add more content to the visual, such as bands showing the day developing and High/Low values above the daily bar.

The core of the example is Line E, H, I, J, K.   Lines H through K are the 4 values needed by Line K’s marker which draws the Flute bar. Line E controls when the bar is drawn.

ESPL: Study Rising Falling Flag

The following ESPL example will plot GREEN circles when the Study Average is rising, and RED circles when the Study Average is falling.   This chart has an Ergodic study and the ESPL study applied.


The GetStudy statement references for 1st line, 2nd line, 3rd line, and 4th line refer to the various Lines that can be plotted by a Study.

  • The 1st line is the main study line.
  • The 2nd line is most often the Average of the main study line.
  • Sometimes there isn’t a 3rd line for a study….sometimes there is.
  • The 4th line is most often the Spread line values.

The example below is testing the GetStudy 15 value…. (Is the 2nd line Rising?)

   Classes, Graphics, Controls, Forms, Dialogs;
procedure CheckErg;
   i, iHandle:integer;
   iHandle := FindStudy(eERG); 
   for i := BarBegin to BarEnd do 
      if GetStudy(iHandle,15,i) then 
   if ESPL=100 then CheckErg;

Click ESPL button 100 to apply and run the ESPL study on the chart.

Dow Jones at 15,000

Larry Pesavento: ‘Past experience indicates that bold predictions on the front page of financial publications usually indicate a major shift in market direction, albeit in the opposite direction. This week’s cover of Barron’s magazine features Dow 15,000. This number may indeed come to pass, but with so many patterns that are still showing signs of the market topping in the near term, it is difficult for me to believe this will happen before a major correction takes place.

With this article is a chart of the McClellan oscillator, which points to the breadth of the market deteriorating badly. The market has been losing considerable breadth since late December. For those unfamiliar with the McClellan oscillator, it is a market breadth indicator derived through analysis of the New York Stock Exchange index and evaluates the rate of money entering or leaving the market. In other words, it can be interpreted as an indicator for overbought or oversold conditions in the market. The index was developed by Sherman McClellan back in the late 60’s and relies on an exponential moving average of the difference between advancing issues (stocks gaining in value) and declining issues (those that are falling) over 39- and 19-day periods.

Also, I have featured a chart from Doug Katz. It points out that two of the big “Perma Bears” (Drs. David Rosenberg and Nouriel Roubini) tend to make incorrect assessments of the market at critical turning points in the market. Incidentally, we now have both of these gentlemen capitulating to the bullish camp. Meanwhile, the NYSE index has also just completed a bearish Gartley pattern at the 786 retracement. The Nasdaq, which has been the market leader by far, has completed a bearish butterfly pattern. The VIX volatility index is still very oversold as it drifts back into the area of support from many months ago.

Thus, the market is showing just about every possible signal to move down that I can see. But I have also been saying this since late January. However, although the Nasdaq has motored into higher territory, the major market hasn’t gone up much during this time. Moreover, these bearish markets continue to be seen in the foreign markets e.g. Germany, U.K., and Asia.’

Long Term Refresh Available

Q:  Your Ensign 10 software is fantastic. I really enjoyed Ensign Windows; thought it was very good; and was hesistant to try your new Ensign 10 software because I liked it so much. After installing it over Christmas, and learning it, I find Ensign 10 to be a vast improvement.

Since I started with Ensign over a year ago, I have noticed that there is a restriction relative to how far back the eSignal data feed goes on the Ensign software.  Out of curiosity, last week I contacted eSignal to find out why they restricted the data re Ensign software. I was told that for a monthly fee of $10 such is available to 3rd party users. 

If we were able to get the extended data from esignal, it would be a tremendous help. I can’t stress the benefit. The ability to create pitchforks on 20 min and 240 min chart that would start further back in time would be a significant and very well received.   Is this feasible for Ensign to do?

A:  Ensign stores 1 minute database files on your hard disk from which we build your minute based charts such as 20 minutes and 240 minutes.   If you have the files, we should be able to build the charts.

The eSignal refresh controls how many days back the minute refresh is available.  This is a parameter they pass to us when we connect, and I see on my system it is currently set at 168 days back.   In a test of refreshing ES #F for the intraday, the refresh went back to Sep 8th, 2011, which I would estimate is the 168 days back.   It is my understanding that by paying the extra money you can get eSignal to change the limit on your subscription to be more than the 168 days back I am seeing.   So there should not be any change needed in Ensign to refresh earlier dates.

That said, let me comment there is a work around that will not cost you anything and works for most symbols.   Go to the Data Manager form for the symbol and change the refresh source to DTN Market Access.  Select an early date and pick a quantity such as 1 month and refresh.  DTN will refresh early dates so Ensign has the files.  In this manner you can get the database files from DTN for a few years back without subscribing to the extra service from eSignal. This is another value added item as part of your subscription with Ensign 10.

Example:  Here is my current folder with data from July 8th, 2011.

My next action was to change the Source to DTN Market Access, select 1 month, and click the refresh button. Now my database is extended back to have more files that are back in June 2011.

Be sure to upgrade to the latest version of Ensign 10 so you have the features as documented in these articles.

Gann 2-Bar Swings

CH Choong: ‘Despite Gann’s reputation for the many esoteric studies that he used to make his trading decisions, here is one study, the Gann’s mechanical trend indicator that is easy to understand and straightforward that works across all time frames. Recently, a couple of traders who are interested in Gann Swings asked me to share with them the basic of x-Bar Swings rules and I felt compelled to highlight some basic qualifications of Gann x-Bar Swings that is available in Ensign Windows and Ensign 10. While the rules govern the x-bar Swings may be slightly different, the results are virtually the same over the long term.

What is a Gann Swing Chart?

One of the simplest of Gann’s methodologies is the use of a swing chart pattern as a study of market swings that takes advantage of the tendency for prices to ebb and flow in the short-term. The construction of a swing chart results in what Gann called a trend line indicator that is based on price movement on a bar-by-bar that is constantly evolving. And I have this to say that it is a good and simple price based method for objectively defining market short-term price direction, whether the trend in force is likely to continue or is there a sign of a reversal are present and for any pullback analysis with noticeable price pattern (between 1 and 3-days/bars or periods) in an underlying strong trend. Using the high and low for the price bar or period, whichever exceeds the previous x-bar or x-period becomes the trend line indicator.

In a nutshell, market swings are the true reflection of price movement and that means we can all know that “Price tells the trend”. It’s the simplest way to keep our mind focused on market direction at the beginning of a new swing and exiting at or near the end of that swing to await the development of a new swing trading opportunity. And finally, swing charts help filter out market noise with significant swing pivot highs and swing pivot lows as peaks and valleys on the chart for easier identification of support and resistance, especially with price levels traders.

I have listed the qualifications of a 2-Bar Swings below and I hope it helps you re-discover this simple and effective method for defining market trend that is purely based on price behaviors without any optimization.

Qualifications of 2-Bar Swings.

From downswing to upswing: Two-consecutives bars or periods of higher highs will start the upswing.

From upswing to downswings: Two-consecutives bars or periods of lower lows will start the downswing.

Inside bar:  All inside bars, including equal high or equal low inside bars, are neutral and they are not counted. We are only interested in price making x-bar higher highs for upswing and price making x-bar lower lows for downswing.

Outside bar:  From downswing to upswing: Outside bar close must be above prior bar high to be valid as 1st upswing.

From upswing to downswing: Outside bar close must be below prior bar low to be valid as 1st downswing.

Special Case with breakout of nearest swing pivot high or swing pivot low:
This option takes large price movements into consideration if the high or low of a swing pivot is broken before the set number of x-bars has occurred.

For example, with 2-bar Swings, an extreme price range occurs on the 1st upswing or 1st downswing. Normally this would not be considered until the 2nd bar/period had formed to make a complete swing pivot where as the breakout rule takes this extreme price movement into consideration straight away. If not, we will missed the significant swing pivot high or low.’

Examples of 2-Bar Swings and 3-Bar Swings

Arms’ Ease of Movement Value

The Arms’ Ease of Movement Value (EMV) is an indicator based on Momentum which qualifies volume and price changes and tries to determine the ease the price is to move up or down.

An optimized moving average crossing above zero is a buy trigger (and is highlighted in green) and crossing below zero is a sell trigger (and highlighted in red).

The DYO uses a simple moving average with a period of 9.

If the EMV exceeds 60% then there is ‘Extreme Optimism’ in the ease. If EMV drops below 40% then there is ‘Extreme Pessimish’ in the ease. Black dots in the sub-window signify these areas.


EMV = ((High+Low)/2 – (Prior High+Prior Low)/2) / Volume / (High – Low)

A – Define period for the moving average on Line F.
B – Define a multiplier to counter the magnitude of the volume division on Line D.
D – Implement the EMV formula.
E – Rescale the EMV result by the multiplier. Optionally plots the EMV as a blue line.
F – Create a Simple Moving Average of the EMV and plot as a red line.
H, I – Show the Buy and Sell triggers for when the Average crosses zero.
J, K – Show when the Average is above 60 percent or below 40 percent of the scale.

This study as a template can be downloaded in Ensign 10 from the Ensign web site using the Package feature.

Credits:   Richard W. Arms, Jr.