Welcome to Building a Study with the Study Tree

 

Studies are built in the Study Editor.  They can built using either the study tree or the study wizard.  This help will use the study tree.  Please review "The Structure of a Study" and "How to Build a Formula Subroutine" before building a study. 

 

Opening the Study Editor

 

Click on "Main Menu" ==> "Studies" => "Build/Edit Studies" to open the study editor.

 

 

This will bring up the Study Editor

 

 

The panel of the left lists all the studies in the program in a tree structure.  If you click on the plus sign to the right of the study it will open up to show its structure.  For now we want to click Add new Study.  This will bring up a dialog asking if you want to use the study wizard.

 

 

Click No and this will add a new study to the study editor.

 

 

Click in the Study Name and enter the name of the new study. If will change the name of the study in the tree.

 

Study Properties

 

When you click and highlight a study name its properties appear in the right property window.  This defines how the study will be used by the program.  See "The Structure of a Study" for a definition of these properties.  For the purposes of this help I am going to make an EMA cross study.  After filling in the properties I have the following.

 

 

Study Name - Help EMA Cross, this will be the name used by all the menu in the program.

 

Short Study Name - EMACross, this is the name that will be used in a chart study title or a prism title.

 

Sub Menu Name - >Help,  this will put the new study under the submenu >help in the program menus.  If I had left this blank the study would be listed in the main list.  I added the greater than character in front of the submenu to force it to the top of the main menu.

 

Window Type -Study Window, The study will appear in its own panel not with the chart.

 

Show In Menu - True, Make sure this study shows up in all the program menus.

 

Do Not Plot - False, Make sure this study plots.

 

Scale Type - Adjustable Study, this will make sure both EMAs are scaled the same and will be adjusted to the high and low for the visible chart area.

 

Scaling Fixed High/Low - Ignored for scale type Adjustable Study.

 

Study Definition - Inputs

 

Next we need to build the formulas for the new study.  You don’t have to have any inputs (you can put values right in the formula) but I want to add an input for each of the EMA lines so I can change their values throughout the program without having to rebuild this study.

 

Click Input and either choose "Right Click" ==> "Add Input" or click "Add Input" in the top menu.

 

 

After to add the input click on the Input1 title so the properties show up. Below are the input properties after filling in the properties.

 

 

Input Name - Length1, this is the name of my first input which is the length of the first EMA.

 

Input Value - 10, The default length of the of the first EMA will be 10.

 

Is Fractal - False, This input is a number and is not referencing a series array.

 

Input Default Type - Number, This input is a number.

 

Click on Input again and click on "Add Input" to add the second input. Below are the input properties after filling in the properties.

 

 

This is the same as the first input except I named it Length2 and set the default length to 20.

 

Study Definition - Formulas

 

Next I want to define the formulas for the new study.  See "How To Build a Formula Subroutine" for details on formulas.

 

 

Click formulas in the tree and click Edit Formulas.  This will bring up the editor window.

 

 

The top of the window lists all the components of a formulas with definitions.  I am going to enter two formulas, one for each EMA line.

 

  • Line1 = The name of the formula.
  • EMA - The Exponential Moving Average Function
  • C - Use the stock close price.
  • Length1 - Use the length of the first input defined above.
  • Length2 - Use the length of the second input defined above.

 

Click "Test Formula" to make sure it parses correctly and has the correct number of parenthesis, then click save.  Our definition of the study is done, next we want to define how the study will appear in the program.

 

Study View Chart Lines

 

We need to add some chart line to appear on the chart.  Click Chart Lines and click "Add Chart Line".

 

 

This will add a default chart line with properties.  After filling in the properties we have the following.

 

 

Line Name - EMA(Length1) The name of the chart line that will be used in the study title in the chart.  By adding the name of the input in parenthesis an edit box will be added to the chart study title so the value of the first EMA can be changed right on the chart.

 

Formula Name - Line1, this is name we gave to the first formula.

 

Plot Type - Line, This formula will be plotted as a line on the chart.

 

Line Presentation - This line will be a sold orange line with no transparency.

 

Show In Info Window - True, the value of the chart line will be listed in the info window.

 

Hide Line - False, The chart line will be visible when plotted on the chart.  This is the value that changes when toggling a chart line off and on by clicking the name in the info window.

 

Now repeat for the second line and we have the next chart line.

 

 

If all we want to do is to plot this study on the chart we are done.  But lets open the full power of the study.

 

Study View Fill Areas

 

This is purely for decoration on the chart.  A fill allows you to add a color between two chart lines.  We are going to add two fills, one for when the shorter EMA is above the longer EMA and color it green for buy and then another fill for the opposite condition and color it red for sell.

 

Click Fill Areas, then click "Add Fill Area" and the editor will add a chart fill. After filling in the properties we have.

 

 

Fill Name - BuyFill, this is the name of the fill.

 

Upper Line Name - EMA1(Length1), this is the name of the first chart line to draw the fill area from.  The order of the two lines is very important because a fill will only draw when the upper line has a higher value than the lower line. So this fill will only draw when the shorter EMA is above the longer EMA.

 

Lower Line Name - EMA2(Length2), this is name of the second chart line to draw the fill area between.

 

Fill Presentation - Text color does nothing, this describes a vertical gradient coloring from backcolor2 to backcolor1.  The alpha has been set to 50 to increase the transparency of the fill so it doesn’t overwhelm the chart.

 

Condition - not used.

 

The we add a second fill just like the first fill  but with the following properties.

 

 

Study View Signals

 

In the final area of the study we are going to define what a buy and sell signal are so we can use the study in the optimizer, prism, color bars, etc..

 

First we are going to add two new formulas to the study.  One for a buy condition and one for a sell condition. 

 

 

We have defined a buy condition when the shorter EMA is above the Longer EMA and a sell condition for the opposite.

 

Next click Signals follow by "Add Condition" and after we fill in the properties we get the following.

 

 

Condition Name - Buy Condition, this is name of the signal condition.

 

Formulas Name - Buy, This is the name of the formula created above.

 

Optimize Type - Buy, this tells the program that this is buy condition for the study. 

 

Text - LONG, This is the text in a prism when the study condition is true.

 

Color - Ignored because Use Theme Colors is True.

 

Use Theme Colors - True, override custom colors and use the default buy and sell colors in preferences.

 

Now we create a second condition in the same manner to define a sell condition.

 

 

The study is now complete.  Once you know this study is working you can give it to others by right clicking on the study name in the tree and clicking "Copy To Chat".  Anyone who clicks on the study will have it automatically added to their program.

 

Click Save to save the study and exit the study editor.

 

Use of the Study

 

If we right click in a chart we find the new study in the studies menu under the submenu we defined.

 

 

When we choose the study it plots on the chart the way we defined it to.

 

 

We have the two lines, we have the fills between the lines and we have two edit boxes in the chart study title where we can change the EMA values.

 

When we create a prism, the study is in the add column menu and we get.

 

 

Listing the buy and sell signals we defined under signals.