Zeal Terminal Open in Zeal Terminal

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
Prerendered with the defaults. Change anything and run it here. The script runs in your browser.
Settings (21)
40,00060,00080,000100,000120,000AprJulOct2025AprJulOct2026AprJulOct$88,106$202,527Equity from $100,000
Binance BTCUSDT 1D candles, 26 Jan 2024 to 21 Oct 2026, 1,000 bars, default settings. Triangles mark entries; circles mark exits. Lines are what the script plots.
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.

SettingDefaultType and rangeFeeds
Entry Exit Criteria
Show Only 12 26 Crossover Entry (no label in the script)trueboolentry buy line 92 bgcolor
Show 12 26 Crossover and resistance Entry (no label in the script)falseboolentry buy line 94
Show MA Stop Loss (no label in the script)update values as per your requirement in MA sectionfalseboolclose_all sl StopLoss for MA line 102
Show TSL Stop Loss (no label in the script)falseboolclose_all sl Trailing StopLoss line 98
Show Crossdown Stop Loss (no label in the script)trueboolclose_all sl line 100
Target-1
Target (%)5float · min 0TargetPrice1
Target1 exit qty (no label in the script)% qty to sell when Target1 is reached50intexit Tg1
Target-2
Target (%)10float · min 0TargetPrice2
Target2 exit qty (no label in the script)% qty to sell when Target2 is reached100intexit Tg2
Trailing StopLoss
TSL SourcelowsourceTrailStopPrice sPIVOT_highValue
Trail Long Loss (%)1float · min 0.0 · step 0.1TrailStopPrice sPIVOT_highValue
StopLoss MA
SLma Length (no label in the script)21intSL_MA line 41 line 42
SLma Source (no label in the script)lowsourceSL_MA line 41 line 42
StopLoss MAEMAstring · options ["SMA", "EMA"]SL_MA
RESISTANCE
Cross Over Lookback Candles (no label in the script)10intEMA_12_Low EMA_26_Low
Resistance SRC (no label in the script)highsourcehih top
Resistance LEFT (no label in the script)10inthih Resistance Line
Resistance RIGHT (no label in the script)10inthih top
RSI
RSILower Range (no label in the script)RSI value should be ABOVE this value for entry45intBASEENTRY
RSIUpper Range (no label in the script)RSI value should be BELOW this value for entry70intBASEENTRY
BUYVALUE (no label in the script)Buy qty displayed on chart will be based on this value100000intentry buy

What it calculates

  • EMAclose, 12EMA_12 · line 46
  • EMAclose, 26EMA_26 · line 47
  • EMAclose, 21EMA_21 · line 48
  • PivothighResistance SRC (high), Resistance LEFT (10), Resistance RIGHT (10)hih · line 59
  • Valuewhenhih, resistanceSRC[resistanceRIGHT], 0top · 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, 14RSI · line 67
  • EMAMACD_src, fast_lengthfast_ma · line 77
  • EMAMACD_src, slow_lengthslow_ma · line 78
  • EMAmacd, signal_lengthsignal · 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.

closecloseprice datahighhighprice dataresistanceLEFTResistance LEFTsetting · 10resistanceRIGHTResistance RIGHTsetting · 10CrossOverLookbackCandlesCross Over Lookback Can…setting · 10TargetPerc1Target (%)setting · 5TargetPerc2Target (%)setting · 10lowlowprice datalongTrailPercTrail Long Loss (%)setting · 1SLmaLengthSLma Lengthsetting · 21SLmaTypeStopLoss MAsetting · EMARSILowerRangeRSILower Rangesetting · 45RSIUpperRangeRSIUpper Rangesetting · 70EMA_12EMA→ EMA_12EMA_26EMA→ EMA_26EMA_21EMA→ EMA_21hihPivothigh→ hihtopValuewhen→ topEMA_12_LowLowest→ EMA_12_LowEMA_26_LowLowest→ EMA_26_LowRSIRSI→ RSIfast_maEMA→ fast_maslow_maEMA→ slow_masignalEMA→ signalTargetPrice1TargetPrice1valueTargetPrice2TargetPrice2valuesPIVOT_highValuesPIVOT_highValuevalueSL_MASL_MAvalueMACD_srcMACD_srcvaluemacdmacdvaluehisthistvalueTSLTSLconditionEntryEntryconditionEntry2Entry2conditionTrailStopPriceTrailStopPriceconditionBASEENTRYBASEENTRYconditionentry:buyOpen buystrategy.entryexit:Tg1exit Tg1strategy.exitexit:Tg2exit Tg2strategy.exitclose_all:slclose_all slstrategy.close_allplot:33Trailing StopLossplotplot:45StopLoss for MAplotplot:49EMA_12plotplot:50EMA_26plotplot:51StopLoss for MAplotplot:61Resistance Lineplotbgcolor:104bgcolorbgcolor

Order rules

OrderFires whenBy defaultLine
Open buy long((Entry and Show_Only_12_26_Crossover_Entry))On93
Open buy long(Entry2 and Show_12_26_Crossover_and_resistance_Entry)On95
Exit Tg1 limitevery barOn96
Exit Tg2 limitevery barOn97
Close slTSL and Show_TSL_StopLoss and close < EMA_12On99
Close slta.crossunder(EMA_12, EMA_26) and Show_Crossdown_StopLossOn101
Close slta.crossunder(close, SL_MA) and Show_MA_StopLossOn103

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.

5/5trades identical when replayed liveThe last 300 bars, from 26 Dec 2025, were fed to the engine as live ticks, four per bar, and compared with the historical run. Orders are decided once per closed bar, so nothing can change mid-bar.
  • 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.

MarketNetBuy and holdTradesWonProfit factorMax drawdownPeriod
BTCUSDT 1D−11.9%+102.5%2050%0.7321.9%26 Jan 2024 – 21 Oct 2026
BTCUSDT 4h+2.3%+5.5%2045%1.125.3%8 May 2026 – 21 Oct 2026
ETHUSDT 1D−9.7%+9.8%2162%0.8228.4%26 Jan 2024 – 21 Oct 2026
ETHUSDT 4h+8.6%+8.4%1844%1.407.0%8 May 2026 – 21 Oct 2026
SOLUSDT 1D+15.4%+16.7%1974%1.4519.5%26 Jan 2024 – 21 Oct 2026
SOLUSDT 4h+13.5%+21.5%1753%1.766.3%8 May 2026 – 21 Oct 2026
BNBUSDT 1D+1.9%+148.3%1963%1.0518.2%26 Jan 2024 – 21 Oct 2026
BNBUSDT 4h+12.9%+17.1%1953%1.9411.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.

Before 26 Dec 2025 · in-sample
Resistance RIGHT ↓ · Cross Over Lookback Candles →567910121417
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%
From 26 Dec 2025 · out-of-sample
Resistance RIGHT ↓ · Cross Over Lookback Candles →567910121417
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 barsTradesWonP&L
Rising market540%−$2,854.40
Sideways market944%−$16,118.30
Falling market667%$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.

0%34%
All 20 trades
SideEntryExitBarsP&L
long18 May 2024 67,024.0020 May 2024 70,375.202$2,500.00
long18 May 2024 67,024.0017 Jun 2024 66,676.9030−$258.97
long19 Jul 2024 63,987.9019 Jul 2024 67,187.300$2,500.00
long19 Jul 2024 63,987.905 Aug 2024 58,161.0017−$4,553.14
long25 Aug 2024 64,157.0029 Aug 2024 59,034.904−$7,983.73
long19 Sep 2024 61,760.0026 Sep 2024 64,848.007$2,500.00
long19 Sep 2024 61,760.0015 Oct 2024 67,936.0026$5,000.00
long6 Jan 2025 98,363.6010 Jan 2025 92,552.504−$5,907.79
long17 Jan 2025 99,987.3017 Jan 2025 104,987.000$2,500.00
long17 Jan 2025 99,987.306 Feb 2025 96,612.4020−$1,687.64
long20 Apr 2025 85,077.0022 Apr 2025 89,330.902$2,500.00
long20 Apr 2025 85,077.0022 Apr 2025 93,584.702$5,000.00
long14 Sep 2025 115,918.0026 Sep 2025 108,994.0012−$5,973.00
long2 Oct 2025 118,595.005 Oct 2025 124,525.003$2,500.00
long2 Oct 2025 118,595.0016 Oct 2025 110,763.0014−$3,301.87
long6 Jan 2026 93,859.7025 Jan 2026 89,225.3019−$4,937.55
long16 Mar 2026 72,815.3023 Mar 2026 67,859.007−$6,806.61
long10 Apr 2026 71,788.0014 Apr 2026 75,377.404$2,500.00
long10 Apr 2026 71,788.0022 Apr 2026 78,966.8012$5,000.00
long16 Jul 2026 64,756.302 Aug 2026 62,823.7017−$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.

ScriptSharesTypeNetTradesMax drawdown
12-26-IT strategy this page—v5 strategy−11.9%2021.9%
X48 - Strategy - MA Type Cross + TPSL - Future&Spot - V.2 by X4815162342ema rsi lowest pivothigh valuewhenv5 strategydoes not run in Zeal Terminal
Tendency EMA + RSI [Alorse] by alorsersi ema valuewhenv5 strategy+4.3%41.9%
STRATEGY R18-F-BTC by SenatorVonShaftema lowest rsiv4 strategy−8.6%1114.4%
RSI Divergence X Ichimoku Cloud X 200EMA by tradethrillsema rsi pivothighv4 strategy−196,793.0%71,854.6%
EMA Bounce Strategy by tweakerIDlowest valuewhen emav4 strategy−48.8%4856.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.

Clean v5

VerifiedDownload the v5 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

EngineCompilesRunsMatches TradingView
Zeal Terminal · OpenPineScript v2Yes 93 msYes 1,000 bars in 151 msNot measured
PineTSNot testedNot testedNot 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)