Pine Script v5 · Strategy
12-26-IT strategy
A Pine Script v5 strategy built on EMA (close, 12), Pivothigh (high, 10) and Valuewhen (hih). It has 7 order rules, 2 entries among them, and trades long only with the default settings. Exits use a profit target and no stop loss. Each trade is one contract and pays no commission. 21 settings; defaults include Target (%) 5, Target1 exit qty 50 and Target (%) 10.
Generated from the script's code by a template: every clause is a fact read from the source. Not written by a person or a model, and not taken from the author's description.
- Does 12-26-IT strategy repaint?
- No
- No repainting patterns were found in the source, and a live tick-by-tick replay matched history on 5 of 5 trades.
- How did 12-26-IT strategy do on BTCUSDT 1D with default settings?
- −11.89%
- From 26 Jan 2024 to 21 Oct 2026, over 20 closed trades, against +102.5% for buy and hold. A backtest, not investment advice.
- Does 12-26-IT strategy run in Pine Script v6?
- No
- The v6 version runs in Zeal Terminal's engine, but its results differ from the v5 version: Trades differ: 20 before, 11 after on BTCUSDT 1D, 1,000 bars, in Zeal Terminal's engine. It is shown for reference and is not offered as a download.
- Does 12-26-IT strategy use a stop loss?
- No
- Its exits set a profit target but no stop.
- Does 12-26-IT strategy run in Zeal Terminal?
- Yes
- It compiles in 93 ms and runs 1,000 bars in 151 ms, in the browser.
BTCUSDT · 1D · default settings
- EMA_12
- EMA_26
- Resistance Line
- Winning trade
- Losing trade
- Equity
- Buy and hold
- Net profit
- −11.89%
- −$11,894.80
- Buy and hold
- +102.5%
- same period
- Closed trades
- 20
- 10 won · 10 lost
- Profitable
- 50.0%
- of closed trades
- Profit factor
- 0.73
- gross profit ÷ gross loss
- Max drawdown
- 21.90%
- −$22,937.30
One run with the author's default settings, $100,000 starting capital, commission as the script sets it. A single backtest says little about future results and is not a recommendation. Backtests are simulations on historical data and are not investment advice.
Review
What a careful reader of this script would point out, found by checking the source and the backtest.
-
Likely bug
ta.sma(close, 7) ignores the settings line 86
Line 86 hard-codes close where line 41 uses “SLma Source” and 7 where line 41 uses “SLma Length”. Changing those settings moves one band but not this one.
ta.sma(close, 7)ta.sma(SLmaSource, SLmaLength) -
Likely bug
ta.ema(close, 12) ignores the settings line 46
Line 46 hard-codes close where line 42 uses “SLma Source” and 12 where line 42 uses “SLma Length”. Changing those settings moves one band but not this one.
ta.ema(close, 12)ta.ema(SLmaSource, SLmaLength) -
Likely bug
ta.ema(close, 26) ignores the settings line 47
Line 47 hard-codes close where line 42 uses “SLma Source” and 26 where line 42 uses “SLma Length”. Changing those settings moves one band but not this one.
ta.ema(close, 26)ta.ema(SLmaSource, SLmaLength) -
Likely bug
ta.ema(close, 21) ignores the settings line 48
Line 48 hard-codes close where line 42 uses “SLma Source” and 21 where line 42 uses “SLma Length”. Changing those settings moves one band but not this one.
ta.ema(close,21)ta.ema(SLmaSource, SLmaLength) -
Check
No stop loss
strategy.exit is used without a stop, loss or trailing stop.
-
Check
No commission
The backtest assumes free trading. Results on any real exchange will be lower.
-
Note
16 settings have no label
In the settings dialog Show_Only_12_26_Crossover_Entry (line 5), Show_12_26_Crossover_and_resistance_Entry (line 6), Show_MA_StopLoss (line 7), Show_TSL_StopLoss (line 8), Show_Crossdown_StopLoss (line 9), Target1_exit_qty (line 16), Target2_exit_qty (line 20), SLmaLength (line 37), SLmaSource (line 38), CrossOverLookbackCandles (line 55), resistanceSRC (line 56), resistanceLEFT (line 57), resistanceRIGHT (line 58), RSILowerRange (line 68), RSIUpperRange (line 69), BUYVALUE (line 85) show an empty name. The labels on this page come from the variable names.
-
Note
No slippage
Fills are assumed at the exact open price. Add slippage in the properties for a more realistic test.
Settings
Every input the script declares, with its default and what it feeds. Bounds are the ones the script enforces.
| Setting | Default | Type and range | Feeds |
|---|---|---|---|
| Entry Exit Criteria | |||
| Show Only 12 26 Crossover Entry (no label in the script) | true | bool | entry buy line 92 bgcolor |
| Show 12 26 Crossover and resistance Entry (no label in the script) | false | bool | entry buy line 94 |
| Show MA Stop Loss (no label in the script)update values as per your requirement in MA section | false | bool | close_all sl StopLoss for MA line 102 |
| Show TSL Stop Loss (no label in the script) | false | bool | close_all sl Trailing StopLoss line 98 |
| Show Crossdown Stop Loss (no label in the script) | true | bool | close_all sl line 100 |
| Target-1 | |||
| Target (%) | 5 | float · min 0 | TargetPrice1 |
| Target1 exit qty (no label in the script)% qty to sell when Target1 is reached | 50 | int | exit Tg1 |
| Target-2 | |||
| Target (%) | 10 | float · min 0 | TargetPrice2 |
| Target2 exit qty (no label in the script)% qty to sell when Target2 is reached | 100 | int | exit Tg2 |
| Trailing StopLoss | |||
| TSL Source | low | source | TrailStopPrice sPIVOT_highValue |
| Trail Long Loss (%) | 1 | float · min 0.0 · step 0.1 | TrailStopPrice sPIVOT_highValue |
| StopLoss MA | |||
| SLma Length (no label in the script) | 21 | int | SL_MA line 41 line 42 |
| SLma Source (no label in the script) | low | source | SL_MA line 41 line 42 |
| StopLoss MA | EMA | string · options ["SMA", "EMA"] | SL_MA |
| RESISTANCE | |||
| Cross Over Lookback Candles (no label in the script) | 10 | int | EMA_12_Low EMA_26_Low |
| Resistance SRC (no label in the script) | high | source | hih top |
| Resistance LEFT (no label in the script) | 10 | int | hih Resistance Line |
| Resistance RIGHT (no label in the script) | 10 | int | hih top |
| RSI | |||
| RSILower Range (no label in the script)RSI value should be ABOVE this value for entry | 45 | int | BASEENTRY |
| RSIUpper Range (no label in the script)RSI value should be BELOW this value for entry | 70 | int | BASEENTRY |
| BUYVALUE (no label in the script)Buy qty displayed on chart will be based on this value | 100000 | int | entry buy |
What it calculates
- EMAclose, 12
EMA_12 · line 46 - EMAclose, 26
EMA_26 · line 47 - EMAclose, 21
EMA_21 · line 48 - PivothighResistance SRC (high), Resistance LEFT (10), Resistance RIGHT (10)
hih · line 59 - Valuewhenhih, resistanceSRC[resistanceRIGHT], 0
top · line 60 - LowestEMA_12, Cross Over Lookback Candles (10)
EMA_12_Low · line 62 - LowestEMA_26, Cross Over Lookback Candles (10)
EMA_26_Low · line 63 - RSIclose, 14
RSI · line 67 - EMAMACD_src, fast_length
fast_ma · line 77 - EMAMACD_src, slow_length
slow_ma · line 78 - EMAmacd, signal_length
signal · line 80
Signal flow
How price data and settings reach the orders. Each box is a name in the script, or several computed the same way; each arrow is a value one of them reads. Hover a box for its members.
Order rules
| Order | Fires when | By default | Line |
|---|---|---|---|
| Open buy long | ((Entry and Show_Only_12_26_Crossover_Entry)) | On | 93 |
| Open buy long | (Entry2 and Show_12_26_Crossover_and_resistance_Entry) | On | 95 |
| Exit Tg1 limit | every bar | On | 96 |
| Exit Tg2 limit | every bar | On | 97 |
| Close sl | TSL and Show_TSL_StopLoss and close < EMA_12 | On | 99 |
| Close sl | ta.crossunder(EMA_12, EMA_26) and Show_Crossdown_StopLoss | On | 101 |
| Close sl | ta.crossunder(close, SL_MA) and Show_MA_StopLoss | On | 103 |
Each order is guarded by the setting shown. “Off” orders never fire unless that setting is switched on.
Does it repaint?
No
No repainting patterns in the source, and the live replay matched history.
- ClearHigher-timeframe dataThe script requests no other symbol or timeframe.
- ClearFuture-bar referencesNo negative history offsets such as close[-1].
- ClearIntrabar recalculationNo varip, calc_on_every_tick or realtime-only state. Orders are decided once per closed bar.
- ClearOrder timingOrders fill at the next bar's open, after the signal bar has closed.
The checks read the source; the replay runs it. Together they catch the common causes, not every possible one.
Other markets
The same script with default settings on 8 Binance markets. Each row is a separate backtest over the most recent 1,000 bars.
| Market | Net | Buy and hold | Trades | Won | Profit factor | Max drawdown | Period |
|---|---|---|---|---|---|---|---|
| BTCUSDT 1D | −11.9% | +102.5% | 20 | 50% | 0.73 | 21.9% | 26 Jan 2024 – 21 Oct 2026 |
| BTCUSDT 4h | +2.3% | +5.5% | 20 | 45% | 1.12 | 5.3% | 8 May 2026 – 21 Oct 2026 |
| ETHUSDT 1D | −9.7% | +9.8% | 21 | 62% | 0.82 | 28.4% | 26 Jan 2024 – 21 Oct 2026 |
| ETHUSDT 4h | +8.6% | +8.4% | 18 | 44% | 1.40 | 7.0% | 8 May 2026 – 21 Oct 2026 |
| SOLUSDT 1D | +15.4% | +16.7% | 19 | 74% | 1.45 | 19.5% | 26 Jan 2024 – 21 Oct 2026 |
| SOLUSDT 4h | +13.5% | +21.5% | 17 | 53% | 1.76 | 6.3% | 8 May 2026 – 21 Oct 2026 |
| BNBUSDT 1D | +1.9% | +148.3% | 19 | 63% | 1.05 | 18.2% | 26 Jan 2024 – 21 Oct 2026 |
| BNBUSDT 4h | +12.9% | +17.1% | 19 | 53% | 1.94 | 11.0% | 8 May 2026 – 21 Oct 2026 |
Backtests are simulations on historical data and are not investment advice.
Settings heatmap
Two settings that feed the entry signal, moved around their defaults. The best in-sample pair (Cross Over Lookback Candles 5, Resistance RIGHT 5) made −4.7% before 26 Dec 2025 and −7.2% after it, against −7.2% for the defaults. 0% of the 64 combinations made money in-sample and 0% out-of-sample.
| Resistance RIGHT ↓ · Cross Over Lookback Candles → | 5 | 6 | 7 | 9 | 10 | 12 | 14 | 17 |
|---|---|---|---|---|---|---|---|---|
| 5 | −5% | −5% | −5% | −5% | −5% | −5% | −5% | −5% |
| 6 | −5% | −5% | −5% | −5% | −5% | −5% | −5% | −5% |
| 7 | −5% | −5% | −5% | −5% | −5% | −5% | −5% | −5% |
| 9 | −5% | −5% | −5% | −5% | −5% | −5% | −5% | −5% |
| 10 | −5% | −5% | −5% | −5% | −5% | −5% | −5% | −5% |
| 12 | −5% | −5% | −5% | −5% | −5% | −5% | −5% | −5% |
| 14 | −5% | −5% | −5% | −5% | −5% | −5% | −5% | −5% |
| 17 | −5% | −5% | −5% | −5% | −5% | −5% | −5% | −5% |
| Resistance RIGHT ↓ · Cross Over Lookback Candles → | 5 | 6 | 7 | 9 | 10 | 12 | 14 | 17 |
|---|---|---|---|---|---|---|---|---|
| 5 | −7% | −7% | −7% | −7% | −7% | −7% | −7% | −7% |
| 6 | −7% | −7% | −7% | −7% | −7% | −7% | −7% | −7% |
| 7 | −7% | −7% | −7% | −7% | −7% | −7% | −7% | −7% |
| 9 | −7% | −7% | −7% | −7% | −7% | −7% | −7% | −7% |
| 10 | −7% | −7% | −7% | −7% | −7% | −7% | −7% | −7% |
| 12 | −7% | −7% | −7% | −7% | −7% | −7% | −7% | −7% |
| 14 | −7% | −7% | −7% | −7% | −7% | −7% | −7% | −7% |
| 17 | −7% | −7% | −7% | −7% | −7% | −7% | −7% | −7% |
Net P&L of trades opened in each period, as a share of starting capital. marks the defaults and the best in-sample cell. Hover a cell for its trade count. Backtests are simulations on historical data and are not investment advice.
The trades
By market direction
| At entry, last 90 bars | Trades | Won | P&L |
|---|---|---|---|
| Rising market | 5 | 40% | −$2,854.40 |
| Sideways market | 9 | 44% | −$16,118.30 |
| Falling market | 6 | 67% | $7,077.99 |
Rising and falling mean the market moved more than 15% over the 90 bars before entry.
How bad could the drawdown be?
29.5%
The 95th percentile of the worst drawdown when the same 20 trades are reshuffled 5,000 times. The bar spans the 5th to 95th percentile, 15.6% to 29.5%; the tick is what actually happened, 20.2%. Order luck alone moves it this much.
All 20 trades
| Side | Entry | Exit | Bars | P&L |
|---|---|---|---|---|
| long | 18 May 2024 67,024.00 | 20 May 2024 70,375.20 | 2 | $2,500.00 |
| long | 18 May 2024 67,024.00 | 17 Jun 2024 66,676.90 | 30 | −$258.97 |
| long | 19 Jul 2024 63,987.90 | 19 Jul 2024 67,187.30 | 0 | $2,500.00 |
| long | 19 Jul 2024 63,987.90 | 5 Aug 2024 58,161.00 | 17 | −$4,553.14 |
| long | 25 Aug 2024 64,157.00 | 29 Aug 2024 59,034.90 | 4 | −$7,983.73 |
| long | 19 Sep 2024 61,760.00 | 26 Sep 2024 64,848.00 | 7 | $2,500.00 |
| long | 19 Sep 2024 61,760.00 | 15 Oct 2024 67,936.00 | 26 | $5,000.00 |
| long | 6 Jan 2025 98,363.60 | 10 Jan 2025 92,552.50 | 4 | −$5,907.79 |
| long | 17 Jan 2025 99,987.30 | 17 Jan 2025 104,987.00 | 0 | $2,500.00 |
| long | 17 Jan 2025 99,987.30 | 6 Feb 2025 96,612.40 | 20 | −$1,687.64 |
| long | 20 Apr 2025 85,077.00 | 22 Apr 2025 89,330.90 | 2 | $2,500.00 |
| long | 20 Apr 2025 85,077.00 | 22 Apr 2025 93,584.70 | 2 | $5,000.00 |
| long | 14 Sep 2025 115,918.00 | 26 Sep 2025 108,994.00 | 12 | −$5,973.00 |
| long | 2 Oct 2025 118,595.00 | 5 Oct 2025 124,525.00 | 3 | $2,500.00 |
| long | 2 Oct 2025 118,595.00 | 16 Oct 2025 110,763.00 | 14 | −$3,301.87 |
| long | 6 Jan 2026 93,859.70 | 25 Jan 2026 89,225.30 | 19 | −$4,937.55 |
| long | 16 Mar 2026 72,815.30 | 23 Mar 2026 67,859.00 | 7 | −$6,806.61 |
| long | 10 Apr 2026 71,788.00 | 14 Apr 2026 75,377.40 | 4 | $2,500.00 |
| long | 10 Apr 2026 71,788.00 | 22 Apr 2026 78,966.80 | 12 | $5,000.00 |
| long | 16 Jul 2026 64,756.30 | 2 Aug 2026 62,823.70 | 17 | −$2,984.47 |
Similar scripts
Indicators and strategies built from the same calculations, run on BTCUSDT 1D with their own defaults so they can be compared directly.
| Script | Shares | Type | Net | Trades | Max drawdown |
|---|---|---|---|---|---|
| 12-26-IT strategy this page | — | v5 strategy | −11.9% | 20 | 21.9% |
| X48 - Strategy - MA Type Cross + TPSL - Future&Spot - V.2 by X4815162342 | ema rsi lowest pivothigh valuewhen | v5 strategy | does not run in Zeal Terminal | ||
| Tendency EMA + RSI [Alorse] by alorse | rsi ema valuewhen | v5 strategy | +4.3% | 4 | 1.9% |
| STRATEGY R18-F-BTC by SenatorVonShaft | ema lowest rsi | v4 strategy | −8.6% | 11 | 14.4% |
| RSI Divergence X Ichimoku Cloud X 200EMA by tradethrills | ema rsi pivothigh | v4 strategy | −196,793.0% | 7 | 1,854.6% |
| EMA Bounce Strategy by tweakerID | lowest valuewhen ema | v4 strategy | −48.8% | 48 | 56.6% |
Upgrade and export
Written in Pine Script v5. The clean-v5 step types the settings and moves when = into if blocks, which v6 requires; it is run before and after like any upgrade.
- 6 settings use the untyped input() (line 24, 38, 56, 57, 58, 85). It still compiles in v6; input.int, input.float or input.source state the type.
- No v6-only features. v6 is not needed to run this script.
Same 20 trades and the same P&L on BTCUSDT 1D, 1,000 bars, in Zeal Terminal's engine.
- Line 24: input() → input.source()
- Line 38: input() → input.source()
- Line 56: input() → input.source()
- Line 57: input() → input.int()
- Line 58: input() → input.int()
- Line 85: input() → input.int()
⋯////////////////////////////////////////////////-TSLsource = input(low, title="TSL Source", group="Trailing StopLoss")+TSLsource = input.source(low, title="TSL Source", group="Trailing StopLoss")longTrailPerc = input.float(title='Trail Long Loss (%)', minval=0.0, step=0.1, defval=1, group="Trailing StopLoss") * 0.01⋯SLmaLength = input.int(21, group="StopLoss MA")-SLmaSource = input(low, group="StopLoss MA")+SLmaSource = input.source(low, group="StopLoss MA")ma(SLmaSource, length, type) =>⋯CrossOverLookbackCandles = input.int(10, group= "RESISTANCE")-resistanceSRC = input(high, group= "RESISTANCE")+resistanceSRC = input.source(high, group= "RESISTANCE")-resistanceLEFT = input(10, group= "RESISTANCE")+resistanceLEFT = input.int(10, group= "RESISTANCE")-resistanceRIGHT = input(10, group= "RESISTANCE")+resistanceRIGHT = input.int(10, group= "RESISTANCE")hih = ta.pivothigh(resistanceSRC, resistanceLEFT, resistanceRIGHT)⋯////////////////////////////////////////////////-BUYVALUE = input(100000, tooltip = "Buy qty displayed on chart will be based on this value")+BUYVALUE = input.int(100000, tooltip = "Buy qty displayed on chart will be based on this value")BASEENTRY = macd > signal and RSI > RSILowerRange and RSI < RSIUpperRange and close > EMA_21 and close > ta.sma(close, 7)⋯Does it run in Pine Script v6?
No
The v6 version runs in Zeal Terminal's engine, but its results differ from the v5 version: Trades differ: 20 before, 11 after on BTCUSDT 1D, 1,000 bars, in Zeal Terminal's engine. It is shown for reference and is not offered as a download. It differs from the v5 version by 1 edit.
⋯// © AbdulRahimShama-//@version=5+//@version=6strategy('12/26-IT strategy', overlay=true,initial_capital = 100000, calc_on_order_fills = true, pyramiding = 10)⋯Where it runs
| Engine | Compiles | Runs | Matches TradingView |
|---|---|---|---|
| Zeal Terminal · OpenPineScript v2 | Yes 93 ms | Yes 1,000 bars in 151 ms | Not measured |
| PineTS | Not tested | Not tested | Not measured |
“Matches TradingView” needs this script's own output exported from TradingView and compared bar by bar, which has not been done for this script. The engine is built on OpenPineScript, whose conformance results are in its conformance report.
Source
Copied verbatim from the author's published script, with its licence header intact. The author may have updated the original since this snapshot.
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/// © AbdulRahimShama//@version=5strategy('12/26-IT strategy', overlay=true,initial_capital = 100000, calc_on_order_fills = true, pyramiding = 10)Show_Only_12_26_Crossover_Entry = input.bool(true, group = "Entry_Exit Criteria")Show_12_26_Crossover_and_resistance_Entry = input.bool(false, group = "Entry_Exit Criteria")Show_MA_StopLoss = input.bool(false, group = "Entry_Exit Criteria", tooltip = "update values as per your requirement in MA section")Show_TSL_StopLoss = input.bool(false, group = "Entry_Exit Criteria")Show_Crossdown_StopLoss = input.bool(true, group = "Entry_Exit Criteria")////////////////////////////////////////////////////////////////TARGETS INPUT////////////////////////////////////////////////////////Target1TargetPerc1 = input.float(title="Target (%)", minval=0,defval=5, group="Target-1") / 100TargetPrice1 = strategy.position_avg_price * (1 + TargetPerc1)Target1_exit_qty = input.int(50, group="Target-1",tooltip = "% qty to sell when Target1 is reached")////////Target2TargetPerc2 = input.float(title="Target (%)", minval=0,defval=10, group="Target-2") / 100TargetPrice2 = strategy.position_avg_price * (1 + TargetPerc2)Target2_exit_qty = input.int(100, group="Target-2",tooltip = "% qty to sell when Target2 is reached")////////////////////////////////////////////////////////////////TRAILING STOP LOSS////////////////////////////////////////////////TSLsource = input(low, title="TSL Source", group="Trailing StopLoss")longTrailPerc = input.float(title='Trail Long Loss (%)', minval=0.0, step=0.1, defval=1, group="Trailing StopLoss") * 0.01TrailStopPrice = 0.0TrailStopPrice := if strategy.position_size > 0 sPIVOT_highValue = TSLsource * (1 - longTrailPerc) math.max(sPIVOT_highValue, TrailStopPrice[1])else 0TSL = close < TrailStopPriceplot(series=strategy.position_size > 0 and Show_TSL_StopLoss ? TrailStopPrice : na, color=color.new(color.fuchsia, 0), style=plot.style_linebr, linewidth=2, title='Trailing StopLoss')////////////////////////////////////////////////////////////////Moving Averages////////////////////////////////////////////////SLmaLength = input.int(21, group="StopLoss MA")SLmaSource = input(low, group="StopLoss MA")ma(SLmaSource, length, type) => switch type "SMA" => ta.sma(SLmaSource, SLmaLength) "EMA" => ta.ema(SLmaSource, SLmaLength)SLmaType = input.string("EMA", title="StopLoss MA", options=["SMA", "EMA"], group="StopLoss MA")SL_MA = ma(SLmaSource, SLmaLength, SLmaType)plot(Show_MA_StopLoss ? SL_MA : na, "StopLoss for MA", color=color.rgb(255, 0, 0))EMA_12 =ta.ema(close, 12)EMA_26 =ta.ema(close, 26)EMA_21 =ta.ema(close,21)plot(EMA_12, title="EMA_12", color=color.rgb(0, 255, 0), offset=0, linewidth=1)plot(EMA_26, title="EMA_26", color=color.rgb(0, 0, 255), offset=0, linewidth=2)plot(Show_MA_StopLoss ? SL_MA : na, "StopLoss for MA", color=color.rgb(255, 0, 0))////////////////////////////////////////////////////////////////RESISTANCE INPUT and PLOTTING////////////////////////////////////////////////CrossOverLookbackCandles = input.int(10, group= "RESISTANCE")resistanceSRC = input(high, group= "RESISTANCE")resistanceLEFT = input(10, group= "RESISTANCE")resistanceRIGHT = input(10, group= "RESISTANCE")hih = ta.pivothigh(resistanceSRC, resistanceLEFT, resistanceRIGHT)top = ta.valuewhen(hih, resistanceSRC[resistanceRIGHT], 0)res = plot(top, color=top != top[1] ? na : color.new(#00ff00, 50), offset=-resistanceLEFT, linewidth=2, title="Resistance Line")EMA_12_Low = ta.lowest(EMA_12, CrossOverLookbackCandles)EMA_26_Low = ta.lowest(EMA_26, CrossOverLookbackCandles)////////////////////////////////////////////////////////////////RSI INPUT and PLOTTING////////////////////////////////////////////////RSI = ta.rsi(close, 14)RSILowerRange = input.int(45, tooltip = "RSI value should be ABOVE this value for entry", group = "RSI")RSIUpperRange = input.int(70, tooltip = "RSI value should be BELOW this value for entry", group = "RSI")////////////////////////////////////////////////////////////////MACD////////////////////////////////////////////////fast_length = 12slow_length = 26MACD_src = closesignal_length = 9fast_ma = ta.ema(MACD_src, fast_length)slow_ma = ta.ema(MACD_src, slow_length)macd = fast_ma - slow_masignal = ta.ema(macd, signal_length)hist = macd - signal////////////////////////////////////////////////////////////////ENTRY CRITERIA////////////////////////////////////////////////BUYVALUE = input(100000, tooltip = "Buy qty displayed on chart will be based on this value")BASEENTRY = macd > signal and RSI > RSILowerRange and RSI < RSIUpperRange and close > EMA_21 and close > ta.sma(close, 7)Entry = ta.crossover(EMA_12, EMA_26) and BASEENTRYEntry2 = ta.crossover(close, top) and EMA_12_Low < EMA_26_Low and EMA_12 > EMA_26 and RSI < 80////////////////////////////////////////////////////////////////BUY SELL STRATEGY////////////////////////////////////////////////if ((Entry and Show_Only_12_26_Crossover_Entry)) strategy.entry("buy", strategy.long, qty=BUYVALUE/close)if (Entry2 and Show_12_26_Crossover_and_resistance_Entry) strategy.entry("buy", strategy.long, qty=BUYVALUE/close)strategy.exit("Tg1", "buy", limit=TargetPrice1, qty_percent = Target1_exit_qty)strategy.exit("Tg2", "buy", limit=TargetPrice2, qty_percent = Target2_exit_qty)if TSL and Show_TSL_StopLoss and close < EMA_12 strategy.close_all ("sl")if ta.crossunder(EMA_12, EMA_26) and Show_Crossdown_StopLoss strategy.close_all ("sl")if ta.crossunder(close, SL_MA) and Show_MA_StopLoss strategy.close_all ("sl")bgcolor(color=((Entry and Show_Only_12_26_Crossover_Entry)) ? color.new(color.blue, 0) : na)