forex software

Create and Test Forex Strategies

forex software


Logical Groups

Default logical groups

A Logical group is a group of indicators representing logical conditions. All Opening Logic Conditions and Closing Logic Conditions indicators represent logical conditions and belongs to logical groups.

For example, a RSI indicator with a logic rule “RSI rises” represents a logical condition that is true when the indicator rises for a given bar and false in the other case. Therefore, RSI will be joined to a logical group.

Opening Point of the Position and Closing Point of the Position indicators do not belong to logical groups because they do not represent logical conditions.

The logical groups are identified by symbols. The “Opening Logic Condition” symbols are capital letters from [A] to [H] or [All]. The “Closing Logic Condition” symbols are lowercase letters from [a] to [h] or [all].

Every logical group has a symbol and every “logical condition” indicator belongs to one of the groups.

When you add a new “logical condition” indicator to a strategy, Forex Strategy Builder Professional attaches the indicator to the default logical group for this strategy slot.

Every new “Opening Logic Condition” indicator is attached to group [A]. If you do not change the logical groups, all “opening condition” indicators in a strategy will belong to group [A].

“Closing Logic Condition” indicators work in a different way. By default the first “closing condition” has the [a] symbol, the second receives [b], and so on till [h].

Forex Strategy Builder Professional does not show a logical group symbol of a slot if it has a default value. If the logical group was changed, the program will show it in square brackets at the right side of the slot panel.

You can see the logical group of a slot in the Advanced area of the Indicator options pane, on the dynamic info that appears when you hold the mouse cursor over a slot or at the slot panel when zoom it in.

A logical group represents a logical condition. You can think for a logical group as one aggregated indicator. A logical group returns true when all indicator's conditions in it are fulfilled. Said in other way, all logical conditions in a group has AND logic.

Using logical groups for opening

Two opening logical groups

Looking at the example above, all opening conditions belongs to group [A]. Therefore, the logical result of group [A] will be “true” if all indicator conditions are satisfied: “Moving Average rises” and “AD changes its direction upward” and “MACD line is higher than the Signal line”. This strategy will send entry signal when the group [A] is satisfied (all opening indicator conditions are satisfies).

A strategy sends an entry order when there is at least one satisfied opening logical group.

You can use logical groups when you want to define different opening conditions.

The above strategy has two logical groups for entry - [A] and [B]. (Group [A} is not shown because it is the default one.) This strategy can open position when group [A] as well as group [B] is satisfied.

You can set several indicators in one group.

Using logical groups for closing

A strategy sends close signals when there is at least one closing conditions group satisfied.

Closing logical groups

Forex Strategy Builder Professional sets different logical groups for each closing condition indicator by default. In that way the program closes a position at the first dangerous event. If a strategy has two closing conditions, they will belong to two different logical groups by default.

The strategy shown to the right has two closing conditions. They are set to group [a] and group [b] by default. The program hides the group symbols because they were not changed. This strategy sends closing signal at Bar Closing when “RSI is higher the Level line” as well as when “Momentum is higher than the Level line”.

If you want to close a position only when both closing conditions are satisfied simultaneously, you have to set them to one and the same logical group. For example, you can set the “Momentum” indicator to be also group [a]. In that case, group [a] will be satisfied only when both indicators are satisfied. We can say that group [a] will act as one indicator.

"All" logical group

An indicator marked with “All” will act in the same way as it was added to all logical groups of the strategy.

Some indicators have group “All” by default. Such indicators serve better to “filter” the entries of all logical groups.

Examples of indicators with default group “All”:

  • “Lot Limiter” - limits the maximum number of open lots.
  • “Long or Short” - allows either Long entry or Short entry.
  • “Day of Week” - allows entry on a specific day of week.

Logical groups example

Week Peek Chart

You can make various complex logic by using logical groups.

For example a strategy that buys at Bar Open on Monday, Tuesday and Wednesday. It sells at Bar Open on Thursday and Friday. The strategy closes the last lot on Friday evening.

  1. Open a new strategy;
  2. Set Strategy Properties: Entry amount to 1 lot, allow adding 1 lot, allow reducing 1 lot
  3. Set “Opening Point of the Position” indicator “Bar Opening”
  4. Add “Long or Short” with rule “Open long only” and logical group [A]
  5. Add “Day of Week” with entry from Monday to Thursday (excluding), logical group [A]
  6. Add “Long or Short” with rule “Open short only” and logical group [B]
  7. Add “Day of Week” with entry from Thursday to Saturday (excluding), logical group [B]
  8. Set “closing point indicator “Week Closing”

This strategy uses two logical groups for entry. It will open position when at least one of the groups permits but we designed the indicators in a way that the groups will allow entries in different days and in different direction.

  • The first group [A] allows long entry on Monday, Tuesday and Wednesday.
  • The second group [B] allows short entry on Thursday and Friday.

Actually the first signal on Monday will open a new position. The second long signal on Tuesday morning will add one lot because we allowed Adding in the Strategy Properties. The strategy will add 1 lot also on Wednesday. On Thursday morning group [A] will not be satisfied, but group [B] will send a sell signal. Since we already have a 3 lots long position, the sell signal appears to be an “additional opposite direction entry signal”. It will reduce 1 lot. The same will happen on Friday morning. Finally, the strategy will close the position on Friday evening because it will reach the exit point - “Week Closing”

You can download this strategy from our Code Repository Week Peek