Skip to main content

Entry & Exit Rules

Define the conditions that trigger buy and sell signals in your strategy.

Long Logic Tab​

Configure rules for long (buy) positions.

Entry Condition​

The primary condition that triggers a buy signal.

Example:

ASSET_STOCK_TECH_RSI_C_14 < 30 AND ASSET_STOCK_CLOSE > ASSET_STOCK_TECH_SMA_C_200

Translation: Buy when RSI is below 30 (oversold) AND price is above 200-day moving average (uptrend).

Exit Condition​

The primary condition that triggers a sell signal.

Example:

ASSET_STOCK_TECH_RSI_C_14 > 70 OR ASSET_STOCK_CLOSE < ASSET_STOCK_TECH_SMA_C_50

Translation: Sell when RSI is above 70 (overbought) OR price falls below 50-day moving average.


Confirming Conditions​

Add secondary filters to reduce false signals.

How It Works​

Confirming conditions are combined with primary conditions using AND/OR logic:

AND Logic:

Primary Condition AND Confirming Condition

Both must be true to trigger a signal.

OR Logic:

Primary Condition OR Confirming Condition

Either can be true to trigger a signal.

Example: Entry with Confirmation​

Primary Entry:

ASSET_STOCK_TECH_RSI_C_14 < 30

Confirming Condition (AND):

ASSET_STOCK_VOLUME > AVG_20_ASSET_STOCK_VOLUME * 1.5

Result: Only buy when RSI < 30 AND volume is 1.5x above average (confirms conviction).

Example: Exit with Multiple Triggers​

Primary Exit:

ASSET_STOCK_TECH_RSI_C_14 > 70

Confirming Condition (OR):

ASSET_STOCK_CLOSE < ASSET_STOCK_TECH_SMA_C_20

Result: Sell when RSI > 70 OR price drops below 20-day SMA (multiple exit triggers).


Execution Timing​

Choose when to execute trades.

Execute on Close (Default)​

  • Trades execute at the day's closing price
  • More realistic for end-of-day strategies
  • Avoids intraday volatility

Execute on Open​

  • Trades execute at the next day's opening price
  • Useful for overnight gap strategies
  • May experience slippage

💡 Tip: Most strategies should use "Close" execution for more accurate results.


Short Logic Tab​

Configure rules for short (sell) positions. Only available when "Enable Short Positions" is toggled on.

Short Entry Condition​

When to open a short position (bet on price decline).

Example:

ASSET_STOCK_TECH_RSI_C_14 > 70 AND ASSET_STOCK_CLOSE < ASSET_STOCK_TECH_SMA_C_200

Translation: Short when RSI is overbought AND price is below 200-day SMA (downtrend).

Short Exit Condition​

When to close a short position (buy to cover).

Example:

ASSET_STOCK_TECH_RSI_C_14 < 30 OR ASSET_STOCK_CLOSE > ASSET_STOCK_TECH_SMA_C_50

Translation: Cover short when RSI is oversold OR price rises above 50-day SMA.


AI Query Assistant​

Use natural language to generate DSL queries automatically.

How to Use​

  1. Click AI Query Assistant button
  2. Describe your strategy in plain English
  3. Click Generate Query
  4. Review and edit the generated code

Example Prompts​

Momentum Strategy:

Buy when price crosses above 50-day moving average and RSI is above 50

Mean Reversion:

Buy when RSI drops below 30 and volume is above average

Breakout Strategy:

Buy when price breaks above 20-day high with high volume

Tips for Better AI Results​

✅ Be specific — "RSI below 30" instead of "oversold"
✅ Mention indicators — "50-day SMA" instead of "moving average"
✅ Include thresholds — "volume > 1.5x average" instead of "high volume"

❌ Avoid vague terms — "strong momentum", "good setup"
❌ Don't use slang — "moon", "dump", "rip"

⚠️ Always Review AI Output
AI-generated queries may be incorrect or incomplete. Always verify the logic before running a backtest.


Common Strategy Patterns​

1. RSI Mean Reversion​

Entry:

ASSET_STOCK_TECH_RSI_C_14 < 30

Exit:

ASSET_STOCK_TECH_RSI_C_14 > 50

2. Moving Average Crossover​

Entry:

ASSET_STOCK_TECH_SMA_C_50 > ASSET_STOCK_TECH_SMA_C_200

Exit:

ASSET_STOCK_TECH_SMA_C_50 < ASSET_STOCK_TECH_SMA_C_200

3. Breakout with Volume​

Entry:

ASSET_STOCK_CLOSE > HIGH_20_ASSET_STOCK_CLOSE AND ASSET_STOCK_VOLUME > AVG_20_ASSET_STOCK_VOLUME * 1.5

Exit:

ASSET_STOCK_CLOSE < ASSET_STOCK_TECH_SMA_C_10

4. Bollinger Band Bounce​

Entry:

ASSET_STOCK_CLOSE < ASSET_STOCK_TECH_BBANDS_20_2_LOWER

Exit:

ASSET_STOCK_CLOSE > ASSET_STOCK_TECH_BBANDS_20_2_MIDDLE

Best Practices​

✅ Keep it simple — Start with 1-2 indicators
✅ Test one idea at a time — Don't combine too many conditions
✅ Use confirming conditions — Reduce false signals
✅ Define clear exits — Know when to cut losses

❌ Avoid over-optimization — Too many conditions = overfitting
❌ Don't ignore exits — Exit strategy is as important as entry


Next Steps​


© 2026 Vaanam, Inc. All rights reserved.