Core Rules

From NakedMarkets
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Summary

The Core Rules are the core underlying component of every other rules (Setup, Entry and Exit Rules). You can define an expression to calculate a value or to evaluate a condition.
There are two types of Core Rules : the Conditional Core rules and the Value core rules. They are distinguished by their color icon.
Every Core Rule is composed itself by at least 2 Core Rules :

VoidCoreRuleExample









These can be defined by User Rules (Rules created by the user) or Default Rules (Rules already installed in Naked Markets)

CondCoreRules
Conditional Core Rules

The Conditional Core Rules rely on a user-defined or Default Rule statement. They are based on the boolean logic.
It's possible to define every possible condition according according to the Default Rules or User Rules, available in Rule Manager.
The condition within the Rule is defined by the use of boolean Operators.
For example, the following Conditional Core Rule evaluate the expression between the Close of the last candle and the its low.
If the Close of the last candle is greater than its Low, this Core Rule will return True, False otherwise :

ConditionalRuleExample












You can see above that the title name of the Rule is violet because the Rule is composed by a conditional expression.

CondValueRules
Value Core Rules

The Value Core Rules rely on a user-defined or Default Rule value. They are based on arithmetics.
It's possible to define every possible value according to the Default Rules or User Rules, available in Rule Manager.
The condition within the Rule is defined by the use of arithmetic Operators.
For example, the following Value Core Rule calculates the value Close of the last candle - Low of the last candle. To sum up, it represents the size of the last candle.
The value returned by this Rule is a simple number, depending on the candle printed during the Backtest :

ValueRuleExample












You can see above that the title name of the Rule is blue because the Rule is composed by an arithmetic expression.

Conditions and Values Core Rules associativity

Since Conditional and Value rules do not represent the same kind of object, the user has to mix them all together with a certain logic. It relies on the Boolean logic fundamentals.

The Conditional rule can only return True or False as a statement. The Value rule can return any integer or floating number value.

The overall condition of a Setup Rule will always be a condition rule, even if composed by a group of associative Value rules and Conditional rules :

BooleanAlgebra 1.png












For example, this condition is not valid because the logic cannot apply an addition to a Conditional rule (here the "Is Bullish" condition) :

BooleanAlgebra 2.png












Following the boolean logic, it's not possible to compare a value directly with neighbour values more than one at a time. A logical operator has to be used to do properly the comparison.
For example, this condition is comparing the High and the Low with the MA Indicator value. The user wants to check if the MA is included between the High and the Low of the last candle :

BooleanAlgebra Comparison 1.png












However, this can't be done this way because the boolean logic requires the inclusion of at least 1 logical operator (AND operator or OR operator). The proper way to do the comparison is the following :

BooleanAlgebra Comparison 2.png










We advise the user to implement the value rules comparison within Core Rules and include them in the Setup Rule, for example.
It simplifies the readability and the maintanability of the overall rule.
If a rule is malformed and does not apply the boolean logic, the software will display an error during the saving of the involved rule.