Logical Operators

Logicalcond

Logical Operation

Many a times it would happen that you would want more than one condition to satisfy before you take a position or either one of the multiple conditions to satisfy before taking positions

This can be achived using the Logical connections in the condition builder

There are two Logical connections you can make

1. Logical AND

2. Logical OR

Logical01

So what are these Logical connections.

Let us understand each with an example for more clarity.

Logical AND: The Logical AND yields TRUE only when all statements are TRUE

For example: Let us assume that you want to take an entry position only when all below mentioned conditions are TRUE

  1. RSI of the instrument is > 80
  2. Previous candle Close is > Previous candle Open (Green Candle)
  3. Previous candle close > EMA

LogicalAnd

You make these three conditions in your condition builder and connect them with the Logical AND at the top left corner of the condition builder.

When this is done, your position will be taken only when all three conditions are TRUE

Logical AND can also be summarized using a Truth table

A B C Result
FALSE FALSE FALSE Fail
FALSE FALSE TRUE Fail
FALSE TRUE FALSE Fail
FALSE TRUE TRUE Fail
TRUE FALSE FALSE Fail
TRUE FALSE TRUE Fail
TRUE TRUE FALSE Fail
TRUE TRUE TRUE Success

 

Similarly,

Logical OR: Logical OR yields TRUE whenever either of the many conditions you specified becomes TRUE

For example: Let us assume, that you want to exit a trade when the last traded price of an instrument goes above 100 points from Entry, OR when the last traded price falls 50 points from entry.

Lor

You define your two statements in your Exit block as shown in the above picture and connect them with a Logical OR at the top left corner of the condition builder.

Logical AND can also be Summarized using a Truth table

A B C Result
FALSE FALSE FALSE Fail
FALSE FALSE TRUE Success
FALSE TRUE FALSE Success
FALSE TRUE TRUE Success
TRUE FALSE FALSE Success
TRUE FALSE TRUE Success
TRUE TRUE FALSE Success
TRUE TRUE TRUE Success

Groups

Now comes the tricky part.

Obviously, one would think, what if i want certain conditions to be mandatory while being an exception with others.

How do you do this. You can use Groups to group your conditions. With groups, you can group your specific conditions with one logical connection and then connect that entire group with other conditions with the other logical connection.

Let us understand this with an example

Let us assume, that you want to take a position when:

  • Group A
  • Previous candle close is greater than previous candle open (Basically a Green candle)
  • Previous candle close is greater than EMA

OR

  • Group B
  • RSI > 80
  • Previous candle close is > WMA

As you can clearly see, you want to take a position when either Group A is TRUE or Group B is TRUE

group

The two groups are connected with logical OR however, the conditions themselves are connected by Logical AND

If you have any queries, please write to us at support@tradetron.tech