# If Condition

<figure><img src="https://3936822484-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FDNyOHQ7CJmbCVOZSDThd%2Fuploads%2F07K7MX1C9w06FuJgU86R%2FScreenshot%202025-05-16%20at%2012.29.30.png?alt=media&#x26;token=a3eb5519-fab1-4af6-bc4d-584c0fb51eb5" alt=""><figcaption></figcaption></figure>

## Overview

The If Condition step creates a decision point in your strategy with two distinct execution paths based on market conditions. This powerful component enables adaptive strategies that respond differently depending on price movements and market behavior.

## Core Concept

The If Condition step acts as a "fork in the road" with two possible directions:

* **Path A**: Executed when one condition is met (e.g., price goes above target)
* **Path B**: Executed when a different condition is met (e.g., price goes below target)

Only one path will be followed, determined by which condition occurs first.

## Condition Configuration

Each path has its own independent condition settings:

### Condition Types

* **Bin Price**: Uses the bin thresholds established in previous position creation steps.
* **Price**: Defines a specific price target.

### Direction Options

* **Above**: Triggers when price moves higher than the target.
* **Below**: Triggers when price moves lower than the target.

### Threshold Selection (for Bin Price)

* **Upper Threshold**: Uses the upper bound of your position range.
* **Lower Threshold**: Uses the lower bound of your position range.

### Price Target (for Price Conditions)

* Enter a specific price that will trigger the path.

## Wait Confirmation Periods

Both paths can include optional wait periods to filter out temporary price movements:

* **Enable/Disable**: Toggle wait functionality for each path.
* **Duration**: Set how long (in seconds) a condition must remain true.
* **Real-time Format**: Duration displayed in a readable format (e.g., "2 minutes 30 seconds").

**When wait periods are enabled:**

1. The condition must be triggered initially.
2. The condition must remain true for the entire wait duration.
3. Only then will the path be executed.

## Path Building

After configuring the If Condition, you can add specific steps to each path:

* Each path can contain multiple steps that execute sequentially.
* Available steps include: Create Position, Close Position, Swap Tokens, and Wait Time.
* Steps within each path only execute if that path's condition is met first.

## Use Cases

The If Condition step enables sophisticated strategies like:

### Market Direction Strategies

* **Path A**: If price rises, create a short position expecting reversal.
* **Path B**: If price falls, create a long position expecting recovery.

### Range-Based Positioning

* **Path A**: If price breaks above range, close position and swap to stablecoins, then create a new position, etc
* **Path B**: If price breaks below range, close position and accumulate more tokens.

### Trend Confirmation

* Use wait periods to confirm real trends vs. temporary movements.
* Longer wait periods filter out market noise.
* Shorter wait periods respond faster but may trigger on volatility.

### Risk Management

* Create stop-loss and take-profit branches simultaneously.
* Balance opportunity cost with protection from adverse movements.

## How Wait Periods Enhance Strategies

Wait periods add stability to your strategies by:

* Preventing overreaction to market volatility
* Filtering out false breakouts and wicks
* Reducing unnecessary position changes and fees
* Confirming sustained price movements
* Protecting against manipulation events

