NIFTY lab

Pine strategy: 108 point + ADX

NIFTY 50 index, 15-minute candles built from Fyers 1-minute data, 2025-12-24 to 2026-10-19 (202 trading days). Quantity 65, slippage 0.1 point, commission 0.03% per side. Paper backtest only.

As written, the script takes no trades. Its signal block never moves the anchor price while the market keeps trending, so only 3 raw signals appear in 202 days: a SELL on 26 Dec 2025, a BUY on 2 Jan 2026 (ADX 18.5, below the 25 filter, so skipped) and a SELL on 7 Jan 2026 with no position to exit. The "Breakout" and "Reversal" modes also contain identical code.

The table and charts below use my reading of the idea: the anchor follows each new high or low, and the signal flips after a 108 point pullback. Everything else is as written. The script itself says this block is a stand-in for Ari's exact indicator.

Where the profit comes from: the "EOD exit" is a market order that fills at the next candle's open, which is 09:15 the next morning. So the strategy really holds overnight. Closing the same day at the last candle instead gives 57 trades, profit factor 0.81 and -₹29,211. The result is 202 days of one market phase, so treat it as a lead, not proof.

Trailing-anchor version

Net after costs
+₹106,693
Net points
+2,464.7
Trades
57
Win rate
37%
Profit factor
1.58
Max drawdown
-₹56,081

Rupees are for 1 lot (65) on the index itself, which cannot be traded directly. The index has no real lot, so this treats it like a future with 0.03% cost per side.

Profit and loss

-18,18515,87349,93083,988118,04501-1302-2303-2305-0407-0710-12

Hover the running total for the figure after each trade (rupees, 1 lot of 65). The bars show points per trade.

How trades ended

ExitTradesPoints
EOD(next open)20+4,063.9
SELL+ADX4+261.4
stop(gap)9-658.1
stop24-1,202.4

Other settings tried

VersionTradesWin ratePointsNetProfit factor
As written (anchor never trails)0----
Trailing anchor, all else as written5737%+2,464.7+₹106,6931.58
Trailing, EOD exit on the same day5739%+373.2-₹29,2110.81
Trailing, no ADX filter9937%+2,922.5+₹97,0091.31
Trailing, ADX threshold 208235%+2,277.9+₹71,2081.26
Trailing, no stop5753%+3,184.9+₹153,4921.68
Trailing, stop 100 points5751%+3,244.8+₹157,3841.74
Trailing, move 54 points16328%+2,624.7+₹17,7081.04
Trailing, move 162 points3829%+122.7-₹27,7060.81

Small changes flip the result, for example a 162 point move or exiting on the same day. That is a sign the edge is thin.

Traded as CE and PE options

The same signals, but buying real option premiums from the Fyers minute data: a BUY signal buys an at-the-money CE, and in the two-sided versions a SELL signal buys an at-the-money PE. Exit on the opposite signal, a 50 point move against the entry in the index, or the end-of-day rule. One lot of 65, costs and slippage included.

Only 6 to 17 trades are possible. Fyers keeps minute prices only for contracts that are still listed, so option data starts on 29 Jul 2026. Three signals had no listed contract with a price at that minute and were skipped. With so few trades, the differences between the rows below are noise, not findings.

VersionTradesWin rateNetCostsProfit factorSkipped
Buy CE on BUY signal (Pine long-only), EOD at next open650%+₹8,795₹4214.143
Buy CE on BUY, buy PE on SELL, EOD at next open1625%-₹423₹8440.973
Buy CE on BUY (long-only), EOD same day650%+₹3,957₹4111.983
Buy CE on BUY, PE on SELL, EOD same day1741%+₹10,104₹9001.733

Trades: Buy CE on BUY, buy PE on SELL, EOD at next open

SideContract (expiry, strike)Entry (month-day time)Exit (month-day time)Bought at (option price)Sold at (option price)Net (rupees)Why it ended
CE10-19 23,10010-16 10:1510-19 09:1599.3139.8+₹2,607EOD next open
PE10-19 22,95010-15 15:1510-16 09:15118.186.0-₹2,105EOD next open
PE10-19 22,55010-14 13:1510-14 13:43157.2116.7-₹2,657stop
PE10-19 22,45010-12 10:3010-13 09:15170.3207.8+₹2,400EOD next open
CE10-19 22,40010-09 09:3010-12 09:15214.3331.9+₹7,589EOD next open
PE10-19 22,60010-07 09:3010-07 10:18195.5170.9-₹1,633stop
PE10-19 22,45010-05 11:4510-05 13:40209.3177.5-₹2,103stop
CE10-19 22,35010-01 14:4510-05 09:15337.2337.0-₹76EOD next open
CE10-19 22,70009-29 11:3009-29 12:32365.2329.8-₹2,364stop
PE10-19 23,25009-24 09:3009-25 09:15215.2215.1-₹49EOD next open
PE10-19 23,35009-22 12:1509-23 09:15219.7203.7-₹1,085EOD next open
CE10-27 23,25009-16 10:3009-17 09:15461.4457.2-₹360EOD next open
PE10-27 24,15008-24 13:1508-24 15:29291.9283.4-₹607stop
CE10-27 24,20008-20 09:3008-21 09:15593.3616.6+₹1,399EOD next open
PE10-27 24,30008-13 10:3008-13 11:57315.2302.4-₹889stop
PE10-27 24,60008-04 09:3008-05 09:15376.2369.8-₹490EOD next open

The nearest expiry at least 2 days away that has a price at entry is used, so early trades sit in the 27 Oct contract, which is far dated and moves less than a weekly would. The last PE trade was still open at the end of the data and is not counted.

Index trades (trailing-anchor version)

Entry (month-day time)Exit (month-day time)Bought at (index level)Sold at (index level)PointsNet (rupees)Why it ended
10-16 10:1510-19 09:1523,095.123,150.8+55.6+₹2,712EOD(next open)
10-09 09:3010-12 09:1522,375.622,593.1+217.5+₹13,257EOD(next open)
10-01 14:4510-05 09:1522,358.122,532.3+174.2+₹10,444EOD(next open)
09-29 11:3009-29 12:3022,696.322,646.2-50.1-₹4,141stop
09-16 10:3009-17 09:1523,229.623,195.2-34.5-₹3,148EOD(next open)
08-20 09:3008-21 09:1524,191.024,284.0+92.9+₹5,093EOD(next open)
08-17 13:1508-17 15:1524,346.224,296.2-50.1-₹4,205stop
08-13 09:1508-13 09:3024,431.724,342.0-89.7-₹6,785stop(gap)
08-05 09:1508-05 09:3024,669.324,619.2-50.1-₹4,218stop
07-24 12:3007-27 09:1523,783.923,928.3+144.4+₹8,456EOD(next open)
07-15 09:3007-15 12:3024,196.624,146.5-50.1-₹4,199stop
07-09 09:3007-09 15:0024,022.823,972.7-50.1-₹4,192stop
07-06 09:4507-07 09:1524,369.424,464.4+95.0+₹5,219EOD(next open)
06-24 10:1506-25 09:1523,917.824,125.8+207.9+₹12,577EOD(next open)
06-16 10:4506-16 11:3023,962.323,912.2-50.1-₹4,190stop
06-11 11:3006-11 14:4523,237.523,187.4-50.1-₹4,162stop
06-03 12:4506-03 13:0023,325.223,275.2-50.1-₹4,165stop
06-02 13:0006-03 09:1523,458.923,415.9-43.0-₹3,712EOD(next open)
05-20 11:3005-21 09:1523,600.023,830.0+229.9+₹14,019EOD(next open)
05-18 11:0005-19 09:1523,465.023,675.2+210.2+₹12,744EOD(next open)
05-13 10:3005-13 10:4523,452.323,402.2-50.1-₹4,170stop
05-07 12:4505-07 13:0024,462.924,387.6-75.4-₹5,854stop(gap)
05-05 13:0005-06 09:1524,012.724,170.9+158.2+₹9,343EOD(next open)
04-30 12:3005-04 09:1523,912.124,063.5+151.4+₹8,902EOD(next open)
04-29 09:3004-29 14:3024,110.524,188.4+77.8+₹4,115SELL+ADX
04-27 09:3004-27 11:3024,045.123,995.0-50.1-₹4,193stop
04-13 10:3004-15 09:1523,721.924,163.7+441.8+₹27,783EOD(next open)
04-10 09:3004-13 09:1523,938.123,589.5-348.6-₹23,589EOD(next open)
04-07 10:1504-07 10:4522,921.922,871.8-50.1-₹4,149stop
04-02 12:4504-06 09:1522,363.422,780.2+416.8+₹26,212EOD(next open)
04-01 13:1504-01 13:3022,883.322,808.2-75.0-₹5,769stop(gap)
04-01 09:3004-01 09:4522,928.622,851.4-77.3-₹5,917stop(gap)
03-25 09:3003-25 14:3023,214.823,337.2+122.5+₹7,055SELL+ADX
03-24 09:3003-24 09:4522,839.722,747.2-92.5-₹6,901stop(gap)
03-23 14:0003-23 14:3022,598.922,548.8-50.1-₹4,137stop
03-20 09:1503-20 12:3023,110.223,155.6+45.3+₹2,042SELL+ADX
03-16 11:3003-16 12:3023,172.823,122.8-50.1-₹4,159stop
03-16 09:4503-16 10:0023,240.323,168.7-71.6-₹5,559stop(gap)
03-12 11:0003-12 11:1523,741.723,691.6-50.1-₹4,181stop
03-09 11:0003-09 11:1523,866.323,816.2-50.1-₹4,186stop
03-05 09:4503-05 10:1524,596.424,546.3-50.1-₹4,215stop
03-04 11:1503-04 11:3024,436.224,366.9-69.4-₹5,463stop(gap)
03-02 14:1503-02 14:3024,787.624,730.8-56.8-₹4,658stop(gap)
02-26 10:1502-26 10:4525,558.725,508.6-50.1-₹4,252stop
02-25 09:3002-25 12:3025,584.925,534.8-50.1-₹4,253stop
02-20 10:0002-23 09:1525,520.325,678.3+158.0+₹9,268EOD(next open)
02-16 12:3002-17 09:1525,576.525,637.9+61.4+₹2,989EOD(next open)
02-06 11:4502-06 12:1525,623.925,573.8-50.1-₹4,255stop
02-03 10:4502-03 13:1525,798.325,748.2-50.1-₹4,262stop
02-02 11:4502-03 09:1524,869.026,308.0+1,439.0+₹92,534EOD(next open)
02-01 13:0002-01 13:4525,074.225,024.2-50.1-₹4,233stop
01-27 11:4501-27 12:0025,154.225,103.9-50.3-₹4,253stop(gap)
01-27 09:4501-27 10:0025,148.925,098.8-50.1-₹4,236stop
01-22 09:3001-22 10:1525,385.325,335.2-50.1-₹4,246stop
01-21 12:1501-21 14:0025,135.225,151.0+15.8+₹43SELL+ADX
01-19 15:0001-19 15:1525,629.425,579.3-50.1-₹4,255stop
01-12 12:3001-13 09:1525,661.025,897.2+236.2+₹14,348EOD(next open)

How the replay works

Original Pine script
//@version=6
strategy("NIFTY 50 - 108 Point + ADX Strategy",
     overlay=true,
     pyramiding=0,
     initial_capital=100000,
     currency=currency.INR,
     default_qty_type=strategy.fixed,
     default_qty_value=1,
     commission_type=strategy.commission.percent,
     commission_value=0.03,
     slippage=2,
     process_orders_on_close=false)

// 1. INPUTS
groupSignal = "Primary Signal"
movePoints = input.float(108.0, "Signal Movement (NIFTY points)", minval=0.05, step=1.0, group=groupSignal)
signalMode = input.string("Reversal", "Signal Logic", options=["Reversal", "Breakout"], group=groupSignal)

groupADX = "ADX Confirmation"
diLength = input.int(12, "DI Length", minval=1, group=groupADX)
adxSmoothing = input.int(12, "ADX Smoothing", minval=1, group=groupADX)
adxThreshold = input.float(25.0, "ADX Threshold", minval=1, step=0.5, group=groupADX)

groupRisk = "Risk Management"
useStop = input.bool(true, "Enable Stop Loss", group=groupRisk)
stopPoints = input.float(50.0, "Stop Loss (NIFTY points)", minval=1, group=groupRisk)
useTarget = input.bool(false, "Enable Profit Target", group=groupRisk)
targetPoints = input.float(100.0, "Profit Target (NIFTY points)", minval=1, group=groupRisk)
useEod = input.bool(true, "Close at End of Day", group=groupRisk)
eodHour = input.int(15, "EOD Hour (exchange time)", minval=0, maxval=23, group=groupRisk)
eodMinute = input.int(20, "EOD Minute", minval=0, maxval=59, group=groupRisk)

// 2. TIMEFRAME VALIDATION
is15m = timeframe.isminutes and timeframe.multiplier == 15
if barstate.isfirst and not is15m
    runtime.error("Use this strategy on a 15-minute chart.")

// 3. PRIMARY SIGNAL PROXY
// NOTE: Replace this block with Ari's exact indicator formula when available.
var float anchor = na
var int trend = 0
if barstate.isfirst
    anchor := close

bool buySignal = false
bool sellSignal = false

if barstate.isconfirmed
    if signalMode == "Reversal"
        if close >= anchor + movePoints
            buySignal := trend != 1
            if buySignal
                trend := 1
                anchor := close
        else if close <= anchor - movePoints
            sellSignal := trend != -1
            if sellSignal
                trend := -1
                anchor := close
    else
        if close >= anchor + movePoints
            buySignal := trend != 1
            if buySignal
                trend := 1
                anchor := close
        else if close <= anchor - movePoints
            sellSignal := trend != -1
            if sellSignal
                trend := -1
                anchor := close

// 4. ADX FILTER
[plusDI, minusDI, adxValue] = ta.dmi(diLength, adxSmoothing)
adxConfirmed = adxValue > adxThreshold

// 5. ENTRY AND EXIT RULES (long-only)
enterLong = buySignal and adxConfirmed
exitLong = sellSignal and adxConfirmed

if enterLong and strategy.position_size == 0
    strategy.entry("Long", strategy.long, comment="BUY + ADX")

if exitLong and strategy.position_size > 0
    strategy.close("Long", comment="SELL + ADX")

// 6. STOP LOSS AND PROFIT TARGET
if strategy.position_size > 0
    stopPrice = strategy.position_avg_price - stopPoints
    targetPrice = strategy.position_avg_price + targetPoints
    if useStop and useTarget
        strategy.exit("Risk Exit", "Long", stop=stopPrice, limit=targetPrice)
    else if useStop
        strategy.exit("Risk Exit", "Long", stop=stopPrice)
    else if useTarget
        strategy.exit("Risk Exit", "Long", limit=targetPrice)

// 7. END-OF-DAY EXIT
eodReached = hour(time_close) > eodHour or (hour(time_close) == eodHour and minute(time_close) >= eodMinute)
if useEod and eodReached and strategy.position_size > 0
    strategy.close("Long", comment="EOD Exit")

// 8/9. plotshape + alertcondition blocks omitted on this page (visual only)