User Study ParametersThis page contains documentation for the 'Properties' window for User-Defined studies.User-Defined Studies Click the Studies button on the main button bar and then select User Defined to activate a User-Defined study on a chart. User-Defined studies are programmed in the 'Script Editor' window, using the ESPL programming language. The programming code in the Script Editor window is executed when the User-Defined study is activated on a chart. To program a new User-Defined study, or to load a previously saved study,
click the Script Editor button on the main button bar. The Script Editor
window will be displayed. User-Defined Study Properties Window After activating a User-Defined study on a chart, click the Chart Objects button, select User-Defined Study, and then click Properties to view the properties window. Click the Remove button in the properties window to remove the study from the chart. If more than one User-Defined study is activated on the chart, then click Remove All to remove all the studies. Parameters Three entry boxes are available to the ESPL language. Enter values that the ESPL programming code can use. For example, a User-Defined study can calculate moving averages. The 'Parameters' panel entries could be used to specify the length of the moving averages, or how many bars to include in the average. 1st - Enter a value. The value can be accessed from the ESPL program with the
GETUSER(eParm1) command. A sample of main program code is shown below. This sample assumes that there are three programs in the Script Editor window. They are named 'DrawMyAverage', 'ShowTrades', and 'SetAlerts'. Set the Who to 51, 52, or 53 to specify which study to run on the chart. {----- MAIN PROGRAM -----} Colors The color of User-Defined study lines can be changed in the 'Color' panel. Three chart arrays are available in the ESPL language for storing price data. The data in the three chart arrays can be 'Drawn' on a chart, and 'Shown' in the chart study window. The colors for the '1st Study', '2nd Study', and '3rd Study' will correspond to the three chart arrays. The following ESPL program calculates the mid-point of each bar and stores the value in chart array 1 using the 'SetUser' command. The mid-point line will automatically draw on the chart using the color of '1st Study'. procedure MidPointLine; //Name the
program Draw Line The 'Draw Line' panel is used to specify whether to draw the values of the three ESPL chart arrays on the chart. Check the 1, 2, or 3 boxes to indicate that the values in the chart arrays should be drawn. Many ESPL programs don't even use the chart arrays, so these settings are irrelevant in those cases. However, when storing values in the chart arrays, sometimes it may not be desirable to draw the price values on the chart. The 'Draw Line' panel is used to select which chart arrays will draw to the chart. Show Value The 'Show Value' panel is similar to the 'Draw Line' panel. The price values of the three chart arrays can be 'Shown' in the Studies sub-window at the left edge of a chart. Check the 1, 2, or 3 boxes to indicate that the values in the chart arrays should be shown or not. The chart array values for each bar will display in the sub-window as the mouse is moved around a chart. Many ESPL programs don't even use the chart arrays, so these settings are irrelevant in those cases. The 'Show Value' panel is used to select which chart arrays will display their values in the sub-window. Plot Percent and Use as Default Check Boxes Check the 'Plot Percent' box to draw the three chart array values using a percent scale. The three chart array values will draw to the chart scaled from 0 to 100 (instead of the price scale). If a User-Defined study is calculating a percent index or ratio from 0 to 100, then check the 'Plot Percent' box so that the chart array values scale properly on the chart when they are drawn. Check the 'Use as Default' box to save the properties window as the default for all subsequent User-Defined studies. Close Only Check Box Check the 'Close Only' box to specify that the ESPL code in the Script Editor window only execute at the completion of each bar (instead of every tick). For example, the MidPointLine example above is intended to calculate and draw the mid-point line at the completion of each bar. The 'Close Only' box should be checked for the MidPointLine program. If the 'Close Only' box were unchecked, then the mid-point line would recalculate with every tick, adding unnecessary overhead to the program. Spread and Spread Placement The 'Spread' panel is used to draw a spread histogram on a chart. The spread histogram displays the difference between the 1st and 2nd User-Defined chart array values. If values are stored to the 1st and 2nd chart arrays in the ESPL program, then the 'Spread' feature will automatically subtract the values and draw a spread histogram on the chart. Select 'Normal' to draw a histogram scaled with its actual prices. Select 'Larger' to increase the amplitude of the histogram lines (the actual spread values will not change but the spread lines will be drawn larger on the chart). Select 'None' to disable the spread histogram. Select 'Left', 'Center', or 'Right' in the 'Spread Placement' panel to shift the histogram lines one pixel to the left or right on the chart. This may be desirable if the histogram lines overlay and hide the chart bars. Shifting the histogram lines one pixel allows both the bars and the histogram to be displayed at the same time. Line Style Select 'Solid' or 'Dots' as the line style for the User-Defined study lines. The lines drawn on the chart from the three chart arrays will be either Solid or Dotted depending on the selection. |