DYO: Tutorial


The Design Your Own (DYO) study feature can be used to implement Boolean logic and mathematical equations. The feature can be used to create and plot custom indicators, or show special visual effects. The variety and complexity of the things being created by customers with the DYO feature are truly amazing.

Add DYO to a Chart:

With a chart showing, click on the Study button and select Design Your Own on the drop down list.  This adds a DYO study to the chart's collection of studies, alerts and draw tools.

 

 

DYO Property Form:

Press CTRL-O to show the Chart Object list.  Double click on the Design Your Own entry on the list.  

The DYO property form will be displayed so properties can be set.  The following picture is an example.

 

 Each part of the DYO Property form will be discussed.

Study Name:

Change the Study Name field to give your DYO a custom name.  This name will show on the Chart Objects list and be used as the label in a sub-window.   The Study Name can be up to 15 characters in length.

Study Location:

This selects the panel where the Markers and Labels will be displayed.   In the Stochastic example the study lines are drawn in the 3rd sub-window.

 

 

Marker Location:

The Marker Location selection would be None to plot a curve at a value.   This is the selection in the Stochastic example so that the study lines plot at the calculated values.

The other positions can be used to place markers on the chart or sub-window at a particular position, such as in rows along the Top or Bottom of the panel.

The selections of Last, Above High, Below Low, Open, and Midpoint will use that position on the chart's bar.

      

Study Scale:

Use the Study Scale selection to pick the scale that is appropriate for the data to be plotted.

Chart prices plotted on the chart would typically use Chart Scale.  An example would be the plotting of a moving average study.

Data plotted in an existing sub-window would typically use the sub-window's scale.

The Data Set selection will determine the scale from the data by looking for the highest high and the lowest low value in the data set.   This is a common selection for plotting studies from user created formulas.

The Fixed Range selection will show additional boxes to enter a custom scale.

Data 0 Centerline will balance the scale so zero plots at the center of the panel.

Data 50 Centerline will balance the scale so 50 plots at the center of the panel.  This is the selection used in the Stochastic example because this study moves on both sides of 50 in a range with zero as the minimum value and 100 as the maximum value.

0 to Max Data will use zero as the scale low and determine scale high from the data set.   This would be a good selection for plotting histogram bars for volume values.

The last four selections are similar to those described.  The scale range is increased to create a 5 percent margin at both the top and bottom of the range.

 

 

 

Message Location:

Ensign Windows has a sub-window at the bottom of the chart that is divided into seven Sections.  This area can be used to show messages, study and chart values.

The DYO can display a message in one of the seven Sections.  Select None to disable the section feature.

read more » DYO:  Section Fonts Options
read more » DYO:  Tick Volume Ticker Example
read more » Alerts:  Study Consensus Example

 

 

 

Line Logic:

The Line Logic selection identifies which DYO Line controls the Section background color.  When the Line Logic is True, the section background will use the True color.  When the Line Logic is False, the background will be colored the False color.  The message text will show in the Font color.

Line A through Line J can be a Boolean result that will control the Section color and the message is from the Message Text edit box.   Example

Selections 'A & B Labels' through 'I & J Labels' will use the Boolean logic of the two lines as a pair.   Which ever line of the pair was most recently True is the line whose label will be displayed in the Section as the message text.  The Section background color will be the Line's Show color.

'A Label True' through 'J Label True' will show the label from these lines only when the Line evaluates to a true.  When the Line is a False, nothing is done.

'A or B or Blank' through 'I or J or Blank' will show the Line's label when either Line evaluates to True and use the Line's Show color.  When both lines are False, the Section is Blank and colored using the False color.   Example

'A or B or C' through 'H or I or J' will  will show the Line's label when one of the Lines evaluates to True and use the Line's Show color.  

    

          

Message Text:

The Message Text can be shown in a Section at the bottom of a chart.  Text to be shown on multiple lines is separated by a comma character.   Example

The text can contain a message to show when the Line Logic is True and a message to show when the Line Logic is False.  Separate the two messages with a vertical line character.   Example

The example illustrates a 3 line message with insertions at the  [..]  reference tags.
[A] through [J] will insert the DYO's Line value.   The example shows the value from Line A by using [A].

[0] through [255] will insert a Global Variable value.  The example shows the value in Global Variable twenty by using [20].

Boolean flags will show 'True' or 'False'.

Formatting  -  Add a $ suffix to format the value as a price using the chart's scale.   Add a ` character suffix to format the value as an integer.   Examples:   [A$]  and  [A`]

The  `   character shares the key with the ~  tilda character.   When   `   is inside of the [ ] it changes the format to integer.  When it follows the [ ] it adds the degree symbol to the string.  Example:   [A]`

Reference Tags  -  Chart and Bar values can be referenced and inserted in the Message Text, a Label, and used in the Number field to return a value.  The Message Text example used [$S] to print the Chart's Symbol in the Section display.   A short list of tags is shown here.   Click the read more link to see the full list of tags.

[$S] Chart symbol
[$O],[$H],[$L],[$C] Bar Open, High, Low, Close
[$V],[$T] Bar Volume, Tick Count
[$N],[$R] Bar Net, Range
[$A],[$B] Ask Volume, Bid Volume

 read more » DYO:  Reference Tags

 

 

Example Section display:

Edit Buttons:

Use the edit buttons to manage the DYO's Line A through Line J.   The first step is to click on a line in the Category field.   The line will be selected and the letter by this line will be changed to a darker color.

Click the Insert Line button to insert a blank line above the selected line.

Click the Delete Line button to delete the selected line.

The Swap Lines and Copy To buttons need two lines to be identified.   Step one is to click on a line in the Category field.  Step two is to click on a second line in the Category field.

Clicking the Swap Lines button will swap these two lines.

Clicking the Copy To button will copy the first line to the second line.  The content of the second line will be lost.  The content of the first line will remain unchanged.

Click the Reset Form button to return Line A through Line J to the None Category.

Line A through Line J:

Use the DYO Lines to implement logic and math operations.  The lines will be evaluated in sequence from Line A through Line J.   When more lines are needed to complete a design, simply add more DYO studies to the chart and continue the implementation.

 

 

 

 


 

Category:

Several thousand DYO statements have been grouped into 31 Categories.  The first step to implementing a design is to select a category on a line, which then displays appropriate additional control boxes. 

Bar Value - Values associated with individual bars on the chart can be read.   Select the value to be returned in the Selection list which shows more than 80 choices.   Many statements include that ability to add the value in the Number field, or multiply by the value in the Number field.   The following example reads the bar's Close value, and adds the Number field value which is a negative of the bar's Low value.   The calculation stored in Global Variable [1] is the bar's  Close - Low.

Bar Flag - This category contains Boolean relationships between bars and their values.   For example, the Selection list has 'Higher High' which will return a Boolean True when a bar's high is higher than the prior bar.   The selection list has over 130 relationships that can be read as Boolean flags.

Study Value - The values from studies that are present on a chart ahead of the DYO on the chart's object list can be read.  Select the Study from the Selection drop-down list.  Select the particular study's value from the 3rd drop-down list.  For example, you could select the 'Stochastic' study from the Selection list, and then select the '%D Value' from the 3rd list.

Study Flag - Studies that are placed on the chart will report a variety of conditions.  These conditions are Boolean flags that can be used in an implementation.  Select the Study from the Selection drop-down list.  Select the desired Study Flag from the 3rd drop-down list.  For example, you could select 'Stochastic' from the Selection list, and select '%D Rising' from the 3rd list.

The notation of 'X>' means 'cross above' and the Boolean flag would be True on a single bar as an event.  The notation of '>' means 'greater than' and the Boolean flag is a relationship that could be True on several bars in sequence.   Example 1   Example 2   Example 3

Notation Meaning Type
X> Cross Above Event
X< Cross Below Event
>,   >= Greater than, Greater than or equal to Relationship
=,   <> Equal to, Not Equal Relationship
<,   <= Less than, Less than or equal to Relationship

Number - Use this category to read a value from the Number field.

Always True - This Line will always execute.  Possibly it is showing a Marker.   The following example shows a marker on Line D which requires 2 colors.  The 1st color comes from the Color box on Line D and the 2nd color comes from the Color box on the next line, which is Line E.   Line E used the Always True category as a place holder for the purpose of showing the 2nd color box.

 

Expression - This category offers over 60 mathematical expressions for adding, subtracting, mutiplying and dividing values typically stored in Global Variables or the Number field.  This is an oft used category.

Value' will refer to the Global Variable (GV)  at the location indicated by the Read GV spinner value.
'Next' will refer to the next GV in sequence.   'Value' and 'Next' are adjacent GVs.
'3rd' will refer to the third GV in sequence.  'Value', 'Next' and '3rd' are adjacent GVs.

'#' will refer to the value in the Number field.
'[#]' will refer to a set of values, where # is the size of the set and is the value in the Number field.
If  [xx]  is used in the Number field, then the value from the GV reference is used as the number.
Chart and bar values referenced by the [..] tags can be used in the Number field.   Add a minus sign prefix to change the value to a negative number for subtraction.

read more » DYO:  Reference Tags

Function - This category contains more than 50 mathematical functions such as Sqrt for Square Root.

read more » DYO:  Functions Category

Global Flag - Look in this category for Boolean logic statements testing relationships between values, and operations with other Boolean flags.

read more » DYO:  Global Flags
read more » DYO:  Boolean Logic Examples

Global Action - This category contains statements for manipulating Global Variables, complex IF statements, and controlling various actions in the Ensign Windows program.

read more » DYO:  Global Action 

Chart Value - This category list statements that deal with values obtained from the chart's data set such as the Maximum High for a set of bars, values for Today's and Yesterday's High, Low, and Close, etc.  The notation like  Min Low[#]  will return the Lowest Low value from a set of chart bar's where the set size is the value in the number field.  The start of the set is with the current bar and progresses leftward.   Example:  Min Low[#] with #=2 will return the lower of this bar's low or the prior bar's low.

read more » DYO:  Time Frame Type Values

Chart Flag -  This category contains Boolean flags the deal with the chart, such as whether a bar is in a particular time period.  There are tests for a bar's time stamp and its index position in the array of chart bars.   Example

Quote Value - This category can be used to read any of the fields from the quote page.  Leave the Selection field blank to have the Line default to the chart's symbol.   Enter a Symbol in the Selection field to read values for some other symbol.   Since values are obtained in real-time, the values will be for the content presently on the quote page.  There is no back history for what the quote page might have had as a value say 30 minutes ago.   Example

Quote Flag - Use this category to test the relationship of quote page values and return a Boolean flag.

DYO Value - This category has mathematical formulas that can be applied to the data array contained in another DYO Line.   In the Stochastic example, Line C contained the raw stochastic values, and Line D was used to plot an Exponential Moving Average of the Line C values.  The parameter for the average was the content of the Number field, which in the example was a 7.

In the next example, Line A contains an array of bar midpoints.   Line B will find the highest midpoint in a set of 7 values from Line A.   Line C will find the lowest midpoint in the set of 7 values from Line A.

DYO Flag - This category has Boolean flags for other DYO Lines, such as the flag on another DYO Line changes its Boolean state, or changes direction in its study values.   Example 1   Example 2

None - Use this category selection when a DYO line is not used.   This selection hides the selection boxes for the Line.  Also, when the DYO is evaluated, a Line with a None category selection is skipped.

Do Next IF - Use this category selection to conditionally execute or skip the next DYO Line.    If the Boolean test evaluates to a True, the next DYO Line is executed.   The next DYO Line is skipped if the text evaluates to a False.  

Abort IF False - Further execution through the DYO Lines is aborted if the Boolean text evaluates to a False.  Execution continues when the test is True.

Go To x IF - The statements in these categories implement conditional branching of program execution to another DYO line.  Multiple lines can be skipped or branching can loop back to an earlier DYO line.

read more » DYO:  Go To and Looping

 

 

 

 

Number Field:

A fixed numeric value can be entered.   The example shows a value of 32.50.

Chart, bar, Sim-Broker, and quote values can be referenced in the Number field, except [$S].   Click the read more link for a full list of the available reference tags.

Example:  To reference a bar's close in the number field, use  [$C].  
Example:  To reference the value calculated on a DYO Line, use [A] through [J] in the Number field.

The number field can reference a Global Variable value by enclosing the GV number in square brackets.  Example:  [5]  will get the number value from GV[5].  Permitted GV references are [0] through [255].   A value can be made negative by preceding the reference with a minus sign.

read more » DYO:  Reference Tags

Bar Offset:

A Bar Offset can be specified to reference earlier bar data.  For example, a Bar Offset value of -1 would read data from the prior bar.  A value of -5 would indicate 5 bars back.   An offset of zero is the current bar.  Example

 

 

Read GV and Write GV:

Global Variables can be read and written using these spinner boxes.   The first action a DYO Line does is to read the Global Variable referenced by the Read GV.   The last action a DYO Line does is to write the result from the Line to the Global Variable referenced by the Write GV.

Many of the DYO statements use the words Value, Next and 3rd in the statement description.   Value refers to the contents of the Global Variable reference by the Read GV setting.   Next refers to the contents of the Global Variable in the next sequential Global Variable.  And 3rd refers to the Global Variable which follows Next.  In the example which shows Read GV = 2,  Value is the contents of GV[2], Next would be the contents of GV[3], and 3rd would be the contents of GV[4].

read more » DYO:  Global Variables

 

 

Show Marker and Label:

Each DYO Line can show a Marker and/or Label in the selected color.    When the Show box is checked, category statements that generate a value will always plot the Marker or Label.   But category statements that return a Boolean flag will only show the Marker or Label when the Boolean result is True .

The Label may have a combination of text and references tags as documented on the Reference Tags page.  Labels will show in the margin to the right of the last bar on the chart at the Label Location position.  Text to be shown on multiple lines is separated by a comma character.    Example

[A] through [J] will insert the DYO's Line value.   The example shows the value from Line A by using [A].   Example 1   Example 2
[0] through [255] will insert a Global Variable value.

read more » DYO:  Markers
read more » DYO:  Reference Tags

Double click on the Color square to show the Color Dialog form to change the color selection.

read more » DYO:  Select a Marker's Color

Double click in the Label field to erase the label and reset the Show checkbox to being unchecked.  The Marker is removed and the Color is reset to white.

The Label text can contain a prefix that specifies a Section window for the label.  The prefix is in the format of  |x|  where x is the number of the Section window in the range of 1..7.   Example:    |1|Last=[$C]  will put   Last=1325.50  in Section 1.

read more » DYO:  Tick Volume Ticker Example  

When showing a Label in a Section, if the Line evaluates to True, the True color is used for the Section background.  If False, the False color is used for the Section background.  See the Line Logic documentation for setting these 2 colors. 

There is limited space for text that is shared by the Study Name, Message Text, and all Labels.  If a label's text disappears, the solution is to shorten text elsewhere, such as study name.   Labels do not need to have the prices entered, and a [A] reference may work just as well, and be fewer number of characters.   All text shares a storage space of around 75 characters, which includes some non-visible delimiter characters. 

 

 

Label Location:

The Label text can be shown in the right side margin of the chart in 10 predefined horizontal positions.  The most common location for the label would be in the Column 1 position. 

read more » DYO:  Font Size for Labels, Sections

Learn More by Studing DYO Examples:

read more » DYO:  Examples Library
read more » DYO:  Statement Cross Reference
watch video » Design Your Own

 

 


Last modified 8/31/09 2:57 PM