Simple Editor

A paintbar, when it is created, is a "Simple" paintbar. That means that it is a collection of simple rules. Each rule is of the form

 

if (simple condition)

 set color or shape, trigger alert or set scan result

 [and stop]

otherwise

 set color or shape, trigger alert or set scan result

 [and stop]

 

 

(where the [and stop] is optional).

 

The Simple rules editor allows you to set up these rules without writing any code.

 

Example of a Simple Paintbar

 

PB - simple example

 

Here is an example of a simple paintbar - all it does is checks if the Close of a candle is above all of the three EMAs (with periods of 7, 21 and 40) and if it is, sets the paintbar color. In the next section we will see how to do the same thing with an Advanced paintbar.

 

 

Sections of Simple Paintbar Editor

 

PB - simple

 

 

General Info

         

In this section you enter the paintbar's ID, its name and short name (the short name shows up in legends on charts) and the description of the paintbar.

 

List of Rules

 

Here you manage the rules - you can add a rule, remove a rule and rearrange their order. The rules are executed from top to bottom, so the order of rules is important. Click on a rule to edit it.

 

Individual Rule Editor

 

Each rule consists of a condition and two optional sets of actions - one to be taken if the condition is true, and the other if the condition is false.

 

Individual Rule Editor - Condition

 

PB - expression

 

There is a Left and a Right variable an an Operator between them. The condition expression is built from these three components.

 

Possible variables

Possible Operators

Number - for example,  123.45

 

Candle Values - Open, High, Low, Close, BarVolume

 

Indicator Values - almost any indicator available in Medved Trader

<, >

less than, greater than

<=, >=

less than or equal, greater than or equal

=, !=

equal, not equal

Crosses

left value crosses right value

Crosses Up

left value crosses right value going up

Crosses Down

left value crosses right value going down

 

Candles Ago

 

PB - candle ago

By default, when you specify an indicator or a candle value in the conditional expression, the values for them are implicitly taken from the current candle bar that is being calculated. If you would like to refer to previous bars' values, you have to specify the candles ago number. A value of 1 means the candle before the current one, 2 - the second candle before the current one, etc.

 

 

Indicator Parameters

 

When you specify an indicator as the Left or Right variable, the question comes up what the parameters for the indicator should be. There are two ways to specify that in the editor:

 

Any Parameters option - let the paintbar use the existing indicator on the chart

 

PB - any parameters

When Any Params is selected, the paintbar, for that indicator, will take the first existing indicator of that type in the chart on which it is placed. This allows the user of the paintbar to manipulate the values of the indicator's parameters and gives more flexibility to the paintbar. If the paintbar is placed on a chart that has no such indicator, the default values for the indicator will be used.

 

 

Specify Parameters option - specify explicitly the parameters for the indicator

 

PB - ind parameters

When Any Params is unchecked and the specific parameters are set, the paintbar, for that indicator, will create, internally, an indicator with these parameters, and use it in the calculations.

 

Indicators - Sub-values

 

Some indicators only have one value (for example, SMA). But a lot of indicators have several values (corresponding to several lines on the chart). For example, Bollinger Bands indicator has three values, corresponding to the top line, the bottom line and the center line.

 

PB - bollinger

 

Because of that, when you select an indicator as a variable in the Simple Rule Editor, you have to specify which sub-value of the indicator to use. Select it at the end of the line.

 

PB - subvalue

 

 

Action - Setting a Color

 

One of the actions you can do in the rule when the condition specified is true (or false for an Else action) is setting the bar's color.

 

PB - set color

 

Naming the Color is optional. If you select to name the color, then that name will appear in the Parameter Editor for the paintbar when you place it on the chart and the Default color that you select will be assigned to it. The user will be able to change that color to his preference.

 

Blank Name - If you leave the name blank, then the action will assign the color that you select and the user of the paintbar when it is placed on the chart will not be shown the color or be given a chance to change the color.

 

Picking Color - the color-picker that is pops up when you click on the color box allows you to choose either an "absolute" color, or a color that represents an entry in the chart's color scheme - either one of the selected indicator colors or other colors in the scheme.

 

PB - colorpicker

 

 

Action - Setting a Shape

 

The other action you can do in the rule is set a shape for the bar. If you don't set a shape (or set a Default shape), then whatever shape the user of the paintbar selects in the paintbar parameters on the charts will be displayed. Note that if the user chooses Candle Color as the paintbar's Placement, any shapes set will be ignored.

 

PB - shape

In general, it is a good idea to allow the user to select the shape. Set specific shapes in the paintbar only if you consider the particular shape very significant to the paintbar's meaning.

 

 

Action - Trigger an Alert

 

A paintbar can trigger an alert.

 

PB - alert

 

The alert should have a name and a message. The name shows up on the Paintbar Parameter Editor when the paintbar is applied to a chart, and the user will be able to specify the notification options for it there.

 

 

Action - Set Scan Result

 

When the code is used in a scan, a Scan Result can be set

 

PB - scan result

 

The alert should have a name and a message. The name shows up on the Paintbar Parameter Editor when the paintbar is applied to a chart, and the user will be able to specify the notification options for it there.

 

Action - and Stop

 

The and Stop checkbox, if selected, stops the execution of all rules at this point.

 

PB - and stop

 

 

Switching to Advanced

 

The Switch to Advanced button in the ribbon menu will switch the editing of the paintbar to the Advanced mode. This is not a reversible action, once the paintbar has been switched to Advanced mode, it can't go back to the Simple mode.