Conditions
Conditions are expressions that check if a specific criterion is true or false. They typically involve comparisons between data points, calculated values, or logical expressions. When multiple conditions are combined, they form a strategy or scanner.
Example Condition:
- Hull Moving Average with a period of 20, calculated on the close price with an offset of zero, is greater than 360.
This checks if the 20-period Hull Moving Average is above 360 when applied to stock data, outputting either true or false. The TradeOrca strategy builder allows users to create and test such conditions:
Components of a Condition
A condition can include:
- Indicators: Technical indicators like Moving Averages, RSI, MACD, etc.
- Mathematical Operators:
- Basic:
+
,-
,/
,*
- Advanced:
Period Min
,Period Max
,Maximum
,Minimum
- Basic:
- Security Data: Price, volume, volatility, or other asset-specific data.
- Candlestick Patterns: Price-action-based patterns like Doji, Hammer, and Engulfing.
- Numerical Values: Reference numbers, e.g., specific thresholds or targets.
- Comparators:
- Crosses Above
- Crosses Below
- Down By
- Up By
- Greater Than (
>
) - Greater Than or Equal To (
>=
) - Less Than (
<
) - Less Than or Equal To (
<=
)
Combining these elements lets users create customized conditions for market analysis or trading strategies.
Offset (Position of Data, POD)
Offset determines the candle's position for data analysis:
- Offset 0: Uses the latest candle (most recent data point)
- Offset n: Refers to the data from the (n+1)th candle back from the latest one. In other words, when the offset is n, it picks the data from n candles ago, meaning it selects the (n+1)th most recent candle.
Example:
- In the Hull Moving Average example, offset is set to zero (most recent data).
- Offset of 10 would look 10 candles back (11th from the latest).
Offset allows referencing historical data points, supporting more nuanced analysis.