ESPL: Creating ESPL DLLs

The Delphi used in this article is Embarcadero Delphi 2010.  Any compiler and language can be used to make a DLL as long as the output is in flat “C”-type format (eg. No Objects, Classes or Strings, being passed as parameters or returned).

Step 1:  Make the DLL in Delphi

Click File | New | Other | Dynamic Link Library

This is the code for a DLL named ESPL_DLL.

library ESPL_DLL;
const ESPL_NAME = ‘ESPL_DLL.DLL’;

{$R *.res}

function ESPL_Sum(AValue1: real; AValue2: real): real; stdcall;
begin
  result := AValue1 + AValue2;
end;

function ESPL_Max(AValue1: real; AValue2: real): real; stdcall;
begin
  if (AValue1 >= AValue2) then
    result := AValue1
  else
    result := AValue2;
end;

exports
ESPL_Sum,
ESPL_Max;

begin
end.

Step 2:  Make the ESPL Form

Here is the form in Ensign 10′s ESPL IDE, with 2 buttons and a memo component.

Step 3:  Add the source code

{$FORM TfrmMain, Main.sfm}

uses  Classes, Graphics, Controls, Forms, Dialogs, StdCtrls;

 

function ESPL_Sum(AValue1: real; AValue2: real): real; stdcall; external ‘ESPL_DLL.dll’;

function ESPL_Max(AValue1: real; AValue2: real): real; stdcall; external ‘ESPL_DLL.dll’;

procedure btnSumClick(Sender: TObject);
var rValue: real;
begin
 
rValue := ESPL_Sum(3.5, 7.2);
 
Memo1.Lines.Add(rValue);
end;

procedure btnMaxClick(Sender: TObject);
var rValue: real;
begin
  rValue := ESPL_Max(8.7, 10.1);
  Memo1.Lines.Add(rValue);
end;

procedure frmMainShow(Sender: TObject);
begin
  Memo1.Clear();
end;

begin
end;

Step 4:  Run the program script

  1. Click the ESPL Run button
  2. Click the Sum button
  3. Click the Max button

Treasure Bond Butterfly Pattern

Larry Pesavento: ‘Treasury bonds are forming a butterfly pattern along with a three drive pattern at the 149-150 level basis in March treasury bonds. This pattern is easily identified by looking at the formations tool that gives you the AB equal CD pattern. In addition, the Gartley tool allows you to see the expansion pattern forming the butterfly which also comes in at the 1.27 level. The cycle tool illustrates the 24 day cycle that is repeated twice and is due to crest in the middle of the cycle around January 23 which is the new moon and the start of the Chinese new year the year of the Dragon. Should treasury bonds get above the 152 level this trade would most probably be wrong and the loss taken.  There is also an ETF for the 30 year treasury bond that has good liquidity, symbol TBT, and it could be bought at $16.80 per share with a stop of $14.80.’

Transfer Ensign 10 to New Computer

Q: How do I transfer Ensign 10 onto a new computer?

A:  1. Copy the entire ENSIGN 10 folder from the old computer to the new computer.

2. Download and install Ensign 10 on the new computer from our website at: http://www.ensignsoftware.com/downloads.php

This will update the registry entries to the folder you copied over.

3.  Contact  billing@ensignsoftware.net  and report the new Ensign ID that shows on the Setup | Security form so that this computer can be authorized for your subscription to Ensign.

Market Trends from 2-Bar Swings

2-bar swings require 2 higher highs or 2 lower lows without an interrupting counter move.  They are an indication that the underlying trend may change or simply a correction swing (between 1-period and 3-period) and the trend will continue when price breaks the nearest peak or valley.  With more than 3 consecutive sets of swing periods, either up swings or down swings, a high probability trade change has evolved at least temporarily.

Trend Change Swings

Up Trend and Down Trend

Gann x-Bar Swings

Swing trading takes advantage of the tendency for prices to ebb and flow in the short-term, to move in directions against the trend, and to reestablish that trend again.  Wait for the counter trends to occur and then trade in the direction of the trend.

One of the simplest of Gann’s methodologies is the use of swing chart patterns as a study of market swings.  The construction of a swing chart results in what Gann called a trend line indicator.  Using the high and low for the period, whichever exceeds the previous period becomes the trend line indicator.  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.

The illustration shows a 2-bar swing concept.  A 2-bar swing chart measures swings only after the market has made two higher highs or two lower lows without an interrupting counter move.   A 3-bar swing chart requires three higher highs and three lower lows.

Swing Chart Rules

Gann swings are shown in Ensign using the Pesavento Patterns draw tool.   Go to the Pesavento Patterns property form and change the Study Mode to one of the 5 Gann selections.  Ensign can display 1-bar swings through 5-bar swings.

The Gann swings look like this 2-bar swing example.  The counts are shown using the colors selected for the Up Trend Marker and the Down Trend Marker.  The Pesavento Patterns, Support and Resistance levels, and Fibonacci levels can optionally be added to the swings.

Gann Swing Chart

US Dollar Index

Larry Pesavento: ‘The US Dollar Index (USDX) is an index (or measure) of the value of the United States dollar relative to a basket of foreign currencies.  It is a weighted geometric mean of the dollar’s value compared only with:

  • Euro (EUR), 58.6% weight
  • Japanese Yen (JPY), 12.6% weight
  • Pound sterling (GBP), 11.9% weight
  • Canadian dollar (CAD), 9.1% weight
  • Swedish krona (SEK), 4.2% weight
  • Swiss franc (CHF), 3.6% weight

This description of the US dollar index from Wikipedia shows the tremendous weight of the Euro versus the US dollar. There is virtually no one willing to take a position on the long side of the Euro versus US Dollar at this point. The past 10 weeks has been a steady downward movement and we’re getting very close to the first target at 125 in the Euro versus the Dollar. As you can see from the long-term weekly chart the Dollar Index is completing a head and shoulders pattern.  A rally can not be ruled out. The US dollar index is making a retracement in a bear market and is due for a correction.’

Weekly Range on a Daily Chart

Q:  I want to overlay a weekly bar over the daily bars.  Any suggestions?

A:   This clever DYO that will show a weekly range on a daily bar chart.

On the first bar of each week, ie Monday, the DYO will look in the forward direction for the other bars in the week, find the Maximum High and Minimum Low, and plot these values. The key to this is the Offset used for the comparison. For example,  Line C compares the current bar’s high on the top row with Offset = 0 with the High on the 2nd row of the entry boxes where Offset = 1.  The +1 offset references tomorrow’s bar. High[2] is the High 2 bars in the future from the evaluation bar, and High[3] is 3 bars into the future.

Layering Charts in Ensign 10

Q:  In Ensign Windows I have large charts on top of each other and use CTRL/Tab keys to bring a chart to the forefront.  I don’t know how to expose a chart if it is hidden behind another Ensign 10.

A:  The CTRL/Tab feature is a function of the operating system, not Ensign, for MDI (multiple document interface) child windows.   That was lost in the redesign of Ensign 10. 

May I suggest that you take a look at using the Layer feature in Ensign 10 as an alternative. Put a large chart on each layer and then click on the layer buttons on the main ribbon to switch charts. This would handle up to 9 such charts.

The other suggestion is to stack the charts with the stack feature. Then you bring the chart to the surface using the buttons that show on the stack for the members. Most use the stack feature.

Open several charts, have them overlap each other, and click the Stack button on the main ribbon. This makes the stack. You can double click on the button on the stack to remove a chart from the stack. Or overlap the stack with another chart and click the stack button to add it to the stack.

Clock in Ensign 10

Q:  I’m using Ensign Windows and starting to learn Ensign 10.  I use a feature in Ensign Windows called the “Clock Toolbar” .   It sits right above one of my charts, nice and prominent, and it is a key feature in helping me make trades. Where is this feature in Ensign 10?

A:  Thank you for evaluating Ensign 10. We think you will like the program a lot as you get more familiar with it.  The clock is on the Setup ribbon, like this.  Click the button to show the clock form, which can be resized and moved around.

Object Files in Time Frame Change

Q:  I have multiple currency charts in a stack. I use a time group to simultaneously switch them all from 20 min to 240 min, daily and weekly.   I add draw tools to each chart in each time frame and because I save the layout often the layout will potentially save all charts in either the 20, 240, daily or weekly timeframe.

I send the layout file to many students and members. They have confirmed that opening the layout file they see my stacks/charts etc BUT only the lines for the timeframe that was visible when the layout file was saved. So, if the layout file was saved showing the 20 min charts then the recipient does indeed see all 20 min lines, pitchforks, commentary etc BUT when they switch to the 240, daily or weekly timeframes they see blank charts.

 I suspect those lines are included in the files in the study folder but I don’t know how to ‘include’ those drawing objects. In short all I am trying to do is share my layout so that members/students can see drawing objects on each time frame.  Can you advise?

I am happy to include studies files or other files/folders in a package which I can share with them if need be. The requirement obviously being that my lines do not wipe out their existing lines in their own layouts.

A: The layout file controls which charts open, where to position them, and how to dress them. That is what you see for the 20 min charts if the layout was saved with the 20 min charts showing.  The work you do on other charts in the symbol or time frame change is not saved in the layout.  However, those objects are saved in other files found in the Study folder. These other files have an ‘_ ‘ character preceding the filename as in this example.

The _ES #F.5 and the _ES #F.30 would be 2 such files that were made by symbol or time frame change while in the layout. You would find similar files for your symbols in the other time frames you mention. Package these files with your layout for distribution to your students. Use the package feature as that method of installation by the students will put the files in the correct folders.

However, installation of your files will overwrite any files the users created for their own objects. I do not have a way for the chart to combine both your draw tools and their own draw tools.