Entry #
(index, logic, timeframe, script, action, order_type, limit_price)Registers strategy entry signals. Must be a top-level call.
Mandatory parameters
index- Unique trade identifier.
logic- Boolean condition that triggers the entry.
timeframe- Strategy execution timeframe.
script- Instrument to trade.
action- Trade direction (Buy or Sell).
order_type- Order execution method ("MARKET" or "LIMIT").
Optional parameters
limit_price- Required only for LIMIT orders. Specifies the exact entry price.
Parameter example
Entry(
index=1,
logic=buy_signal,
timeframe=15,
script=RELIANCE,
action=Buy,
order_type="MARKET"
)Example
# Keyword vars for action, string for order_type
Entry(index=1, logic=long_condition, timeframe=5, script=banknifty_spot, action=Buy, order_type="MARKET")EMA Crossover
Entry triggers when EMA 9 crosses above EMA 21 — a classic trend-following setup.
# Fast EMA for short-term trend
fast_ema = EMA(close, 9)
# Slow EMA for overall trend direction
slow_ema = EMA(close, 21)
# Entry triggers when EMA 9 crosses above EMA 21
long_condition = crossover(fast_ema, slow_ema)
# Register a BUY entry order
Entry(
index=1,
logic=long_condition,
timeframe=15,
script=RELIANCE,
action=Buy,
order_type="MARKET"
)RSI Momentum
Entry triggers when RSI rises above 60, indicating bullish momentum.
# Calculate RSI using a 14-period lookback
rsi_val = RSI(close, 14)
# Entry triggers when RSI moves above 60,
# indicating strong bullish momentum
long_condition = rsi_val > 60
# Register a BUY entry order
Entry(
index=1,
logic=long_condition,
timeframe=15,
script=RELIANCE,
action=Buy,
order_type="MARKET"
)Trend + Momentum
Combines EMA 20/50 for trend direction and RSI 14 for momentum confirmation. Both must agree before entry.
# EMA 20 is used to identify the short-to-medium term trend
ema20 = EMA(close, 20)
# EMA 50 is used to identify the overall market direction
ema50 = EMA(close, 50)
# RSI measures bullish and bearish momentum
rsi_val = RSI(close, 14)
# Entry triggers only when:
# - EMA 20 is above EMA 50 (Bullish Trend)
# - RSI is above 55 (Bullish Momentum)
long_condition = ema20 > ema50 and rsi_val > 55
# Register a BUY entry order
Entry(
index=1,
logic=long_condition,
timeframe=15,
script=RELIANCE,
action=Buy,
order_type="MARKET"
)