Zeal Terminal Open in Zeal Terminal

Pine Script v4 · Strategy

Infiten Slope Strategy

A Pine Script v4 strategy built on SMA (clh, daysback), SMA or EMA (close, 12) and RMA or Change (max(change(src), 0), 14). It has 6 order rules, 2 entries among them, and trades long only with the default settings. Exits wait for a signal; there is no stop loss. Each trade commits 100% of equity and pays no commission. 7 settings; defaults include Fast Length 12, Slow Length 26 and Source close.

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 Infiten Slope Strategy repaint?
Yes
At least one pattern in the source can repaint: intrabar recalculation.
How did Infiten Slope Strategy do on BTCUSDT 1D with default settings?
+47.18%
From 26 Jan 2024 to 21 Oct 2026, over 26 closed trades, against +102.5% for buy and hold. A backtest, not investment advice.
Can Infiten Slope Strategy be converted to Pine Script v5?
No
The automatic step from v4 to v5 changes the results, so no v5 download is offered; the edits are shown below.
Does Infiten Slope Strategy use a stop loss?
No
Every exit waits for a signal; nothing limits a losing trade before it fires.
Does Infiten Slope Strategy run in Zeal Terminal?
Yes
It compiles in 14 ms and runs 1,000 bars in 48 ms, in the browser.

BTCUSDT · 1D · default settings

  • Plot
  • Plot
  • Plot
  • Plot
  • 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 (7)
40,00060,00080,000100,000120,000AprJulOct2025AprJulOct2026AprJulOctPlot$147,179$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. Zeal Terminal's engine currently reads an order side written as true as a short, whatever it says; this page passes the same side as strategy.long or strategy.short (lines 63, 64) so the engine trades the way the script says.
Net profit
+47.18%
$47,177.50
Buy and hold
+102.5%
same period
Closed trades
26
3 won · 7 lost
Profitable
11.5%
of closed trades
Profit factor
1.89
gross profit ÷ gross loss
Max drawdown
35.46%
−$67,232.20

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

    sma(close, 300) ignores the settings line 20

    Line 20 hard-codes close where line 35 uses “Source” and 300 where line 35 uses “Fast Length”. Changing those settings moves one band but not this one.

    sma(close,300)sma(src, fast_length)
  • Likely bug

    sma(close, 150) ignores the settings line 21

    Line 21 hard-codes close where line 35 uses “Source” and 150 where line 35 uses “Fast Length”. Changing those settings moves one band but not this one.

    sma(close,150)sma(src, fast_length)
  • Likely bug

    sma(close, 50) ignores the settings line 22

    Line 22 hard-codes close where line 35 uses “Source” and 50 where line 35 uses “Fast Length”. Changing those settings moves one band but not this one.

    sma(close,50)sma(src, fast_length)
  • Likely bug

    sma(close, 500) ignores the settings line 42

    Line 42 hard-codes close where line 35 uses “Source” and 500 where line 35 uses “Fast Length”. Changing those settings moves one band but not this one.

    sma(close,500)sma(src, fast_length)
  • Likely bug

    sma(volume, 30) ignores the settings line 52

    Line 52 hard-codes volume where line 35 uses “Source” and 30 where line 35 uses “Fast Length”. Changing those settings moves one band but not this one.

    sma(volume,30)sma(src, fast_length)
  • Likely bug

    change(close) ignores the settings line 47

    Line 47 hard-codes close where line 46 uses “Source”. Changing those settings moves one band but not this one.

    change(close)change(src)
  • Check

    No stop loss

    Every exit waits for a signal. Nothing limits a losing trade before the exit condition fires.

  • Check

    No commission

    The backtest assumes free trading. Results on any real exchange will be lower.

  • Check

    Every trade uses all the equity

    default_qty_value is 100% of equity.

  • Note

    No slippage

    Fills are assumed at the exact open price. Add slippage in the properties for a more realistic test.

  • Note

    Uses an argument v6 removed

    when = on line 63, 64, 65, 66, 67, 68. The upgraded version below moves each call inside an if block.

Upgrade and export

Written in Pine Script v4. The upgrade to v5 takes 1 step, one per version, each applied to the result of the one before. A last clean-v5 pass then types the settings and moves when = into if blocks, which v6 requires. Every step runs before and after on the same candles in Zeal Terminal's engine; a step whose results differ is shown but not offered as a download. Upgrades preserve behaviour: bugs are fixed in the Review, never silently here.

  • Upgrading to v5 renames sma → ta.sma, ema → ta.ema, rma → ta.rma, max → math.max, change → ta.change, min → math.min, crossunder → ta.crossunder, crossover → ta.crossover.
  • 6 strategy calls use the when = argument (line 63, 64, 65, 66, 67, 68). It is deprecated in v5 and removed in v6, where each call moves inside an if block.

v4 → v5

Differs

Trades differ: 26 before, 26 after on BTCUSDT 1D, 1,000 bars, in Zeal Terminal's engine.

  • Line 3: //@version=4 → //@version=5
  • Line 16: sma → ta.sma
  • Line 16: sma → ta.sma
  • Line 17: sma → ta.sma
  • Line 20: sma → ta.sma
  • Line 21: sma → ta.sma
28 more edits
  • Line 22: sma → ta.sma
  • Line 28: input(type = input.integer) → input.int()
  • Line 29: input(type = input.integer) → input.int()
  • Line 30: input(type = input.source) → input.source()
  • Line 31: input(type = input.integer) → input.int()
  • Line 32: input(type = input.bool) → input.bool()
  • Line 33: input(type = input.bool) → input.bool()
  • Line 35: sma → ta.sma
  • Line 35: ema → ta.ema
  • Line 36: sma → ta.sma
  • Line 36: ema → ta.ema
  • Line 38: sma → ta.sma
  • Line 38: ema → ta.ema
  • Line 42: sma → ta.sma
  • Line 46: rma → ta.rma
  • Line 46: max → math.max
  • Line 46: change → ta.change
  • Line 47: rma → ta.rma
  • Line 47: min → math.min
  • Line 47: change → ta.change
  • Line 52: sma → ta.sma
  • Line 53: crossunder → ta.crossunder
  • Line 54: crossunder → ta.crossunder
  • Line 55: crossunder → ta.crossunder
  • Line 58: crossover → ta.crossover
  • Line 60: crossover → ta.crossover
  • Line 63: strategy.entry(…, true) → strategy.entry(…, strategy.long)
  • Line 64: strategy.entry(…, true) → strategy.entry(…, strategy.long)
⋯// © spiritualhealer117-//@version=4+//@version=5strategy("Infiten Slope Strategy", overlay=false,calc_on_every_tick = true, default_qty_type=strategy.percent_of_equity, default_qty_value = 100)⋯clh = close+low+high-exhaustion = (clh-sma(clh,daysback))/sma(clh,daysback)+exhaustion = (clh-ta.sma(clh,daysback))/ta.sma(clh,daysback)-exhaustionSma = sma(exhaustion,daysback)+exhaustionSma = ta.sma(exhaustion,daysback)//}//Long Term Moving Averages for sell signals {-red = sma(close,300)+red = ta.sma(close,300)-white = sma(close,150)+white = ta.sma(close,150)-blue = sma(close,50)+blue = ta.sma(close,50)plot(red,color=color.red)⋯//MACD Calculation {-fast_length = input(title="Fast Length", type=input.integer, defval=12)+fast_length = input.int(title="Fast Length", defval=12)-slow_length = input(title="Slow Length", type=input.integer, defval=26)+slow_length = input.int(title="Slow Length", defval=26)-src = input(title="Source", type=input.source, defval=close)+src = input.source(title="Source", defval=close)-signal_length = input(title="Signal Smoothing", type=input.integer, minval = 1, maxval = 50, defval = 9)+signal_length = input.int(title="Signal Smoothing", minval = 1, maxval = 50, defval = 9)-sma_source = input(title="Simple MA (Oscillator)", type=input.bool, defval=false)+sma_source = input.bool(title="Simple MA (Oscillator)", defval=false)-sma_signal = input(title="Simple MA (Signal Line)", type=input.bool, defval=false)+sma_signal = input.bool(title="Simple MA (Signal Line)", defval=false)// Calculating-fast_ma = sma_source ? sma(src, fast_length) : ema(src, fast_length)+fast_ma = sma_source ? ta.sma(src, fast_length) : ta.ema(src, fast_length)-slow_ma = sma_source ? sma(src, slow_length) : ema(src, slow_length)+slow_ma = sma_source ? ta.sma(src, slow_length) : ta.ema(src, slow_length)macd = fast_ma - slow_ma-signal = sma_signal ? sma(macd, signal_length) : ema(macd, signal_length)+signal = sma_signal ? ta.sma(macd, signal_length) : ta.ema(macd, signal_length)hist = macd - signal⋯//SIGMOID Bottom {-timeAdjust = 300/sma(close,500)+timeAdjust = 300/ta.sma(close,500)//}⋯len = input(14, minval=1, title="Length")-up = rma(max(change(src), 0), len)+up = ta.rma(math.max(ta.change(src), 0), len)-down = rma(-min(change(close), 0), len)+down = ta.rma(-math.min(ta.change(close), 0), len)rsi = down == 0 ? 100 : up == 0 ? 0 : 100 - (100 / (1 + up / down))⋯//Sell conditions-bigVolume = sma(volume,30)*volumesens+bigVolume = ta.sma(volume,30)*volumesens-sellcond1 = crossunder(exhaustion,exhaustionSma) and volume > bigVolume+sellcond1 = ta.crossunder(exhaustion,exhaustionSma) and volume > bigVolume-sellcond2 = crossunder(macd,signal) and volume > bigVolume+sellcond2 = ta.crossunder(macd,signal) and volume > bigVolume-midtermsellcond1 = crossunder(blue,white)+midtermsellcond1 = ta.crossunder(blue,white)longtermsellcond1 = white < red//Buy conditions-buycond = crossover(exhaustion,exhaustionSma) and not longtermsellcond1+buycond = ta.crossover(exhaustion,exhaustionSma) and not longtermsellcond1buycond2 = rsi < 30-buycond3 = crossover(blue,white) and longtermsellcond1+buycond3 = ta.crossover(blue,white) and longtermsellcond1//}//Backtest Run Buy/Sell Commands {-strategy.entry("buycond",true, when=buycond and bigVolume)+strategy.entry("buycond",strategy.long, when=buycond and bigVolume)-strategy.entry("buycond2",true, when=buycond2 and bigVolume)+strategy.entry("buycond2",strategy.long, when=buycond2 and bigVolume)strategy.close_all(when=sellcond1,comment="short term sell signal 1")⋯

Clean v5

Verified

Same 26 trades and the same P&L on BTCUSDT 1D, 1,000 bars, in Zeal Terminal's engine.

  • Line 45: input() → input.int()
  • Line 63: when = buycond and bigVolume → if block
  • Line 64: when = buycond2 and bigVolume → if block
  • Line 65: when = sellcond1 → if block
  • Line 66: when = midtermsellcond1 → if block
  • Line 67: when = longtermsellcond1 → if block
  • Line 68: when = sellcond2 → if block
⋯//RSI bottom {-len = input(14, minval=1, title="Length")+len = input.int(14, minval=1, title="Length")up = ta.rma(math.max(ta.change(src), 0), len)⋯//Backtest Run Buy/Sell Commands {-strategy.entry("buycond",strategy.long, when=buycond and bigVolume)+if buycond and bigVolume+    strategy.entry("buycond",strategy.long)-strategy.entry("buycond2",strategy.long, when=buycond2 and bigVolume)+if buycond2 and bigVolume+    strategy.entry("buycond2",strategy.long)-strategy.close_all(when=sellcond1,comment="short term sell signal 1")+if sellcond1+    strategy.close_all(comment="short term sell signal 1")-strategy.close_all(when=midtermsellcond1, comment="mid term sell signal 1")+if midtermsellcond1+    strategy.close_all(comment="mid term sell signal 1")-strategy.close_all(when=longtermsellcond1, comment="long term sell signal 1")+if longtermsellcond1+    strategy.close_all(comment="long term sell signal 1")-strategy.close_all(when=sellcond2, comment="short term sell signal 2")+if sellcond2+    strategy.close_all(comment="short term sell signal 2")plot(strategy.position_size)⋯

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: 26 before, 18 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.

⋯// © spiritualhealer117-//@version=5+//@version=6strategy("Infiten Slope Strategy", overlay=false,calc_on_every_tick = true, default_qty_type=strategy.percent_of_equity, default_qty_value = 100)⋯

Settings

Every input the script declares, with its default and what it feeds. Bounds are the ones the script enforces.

SettingDefaultType and rangeFeeds
Fast Length12int (written input.integer)fast_ma
Slow Length26int (written input.integer)slow_ma
Sourceclosesourcefast_ma slow_ma up
Signal Smoothing9int (written input.integer) · min 1 · max 50signal
Simple MA (Oscillator)falseboolfast_ma slow_ma
Simple MA (Signal Line)falseboolsignal
Length14int · min 1up down

What it calculates

  • SMA (sma, ta.sma in v5)clh, daysbackexhaustion · line 16
  • SMA (sma, ta.sma in v5)exhaustion, daysbackexhaustionSma · line 17
  • SMA (sma, ta.sma in v5)close, 300red · line 20
  • SMA (sma, ta.sma in v5)close, 150white · line 21
  • SMA (sma, ta.sma in v5)close, 50blue · line 22
  • SMA / EMA (sma, ta.sma in v5)Source (close), Fast Length (12)fast_ma · line 35
  • SMA / EMA (sma, ta.sma in v5)Source (close), Slow Length (26)slow_ma · line 36
  • SMA / EMA (sma, ta.sma in v5)macd, Signal Smoothing (9)signal · line 38
  • SMA (sma, ta.sma in v5)close, 500timeAdjust · line 42
  • RMA / Change (rma, ta.rma in v5)max(change(src), 0), Length (14)up · line 46
  • RMA / Change (rma, ta.rma in v5)-min(change(close), 0), Length (14)down · line 47
  • SMA (sma, ta.sma in v5)volume, 30bigVolume · line 52
  • Crossunder (crossunder, ta.crossunder in v5)blue, whitemidtermsellcond1 · line 55

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 datafast_lengthFast Lengthsetting · 12slow_lengthSlow Lengthsetting · 26signal_lengthSignal Smoothingsetting · 9lenLengthsetting · 14volumevolumeprice datahighhighprice datalowlowprice dataexhaustionSMA→ exhaustionexhaustionSmaSMA→ exhaustionSmaredSMA→ redwhiteSMA→ whiteblueSMA→ bluefast_maSMA / EMA→ fast_maslow_maSMA / EMA→ slow_masignalSMA / EMA→ signaltimeAdjustSMA→ timeAdjustupRMA / Change→ updownRMA / Change→ downbigVolumeSMA→ bigVolumemidtermsellcond1Crossunder→ midtermsellcond1clhclhvaluemacdmacdvaluehisthistvaluersirsivaluesellcond1sellcond1conditionsellcond2sellcond2conditionlongtermsellcond1longtermsellcond1conditionbuycondbuycondconditionbuycond2buycond2conditionbuycond3buycond3conditionentry:buycondOpen buycondstrategy.entryentry:buycond2Open buycond2strategy.entryclose_all:close_all strategy.close_allplot:23plotplotplot:24plotplotplot:25plotplotplot:69plotplot

Order rules

OrderFires whenBy defaultLine
Open buycond longbuycond and bigVolumeOn63
Open buycond2 longbuycond2 and bigVolumeOn64
Close sellcond1crossunder(exhaustion,exhaustionSma) and volume > bigVolumeOn65
Close midtermsellcond1On66
Close longtermsellcond1white < redOn67
Close sellcond2crossunder(macd,signal) and volume > bigVolumeOn68

Each order is guarded by the setting shown. “Off” orders never fire unless that setting is switched on.

Does it repaint?

Yes

At least one pattern in the source can repaint; it is marked Check below.

16/16trades 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. On 0 of them the position changed while the bar was forming before it settled. Anyone watching live sees those changes; once the bar closes it matches history.
  • ClearHigher-timeframe dataThe script requests no other symbol or timeframe.
  • ClearFuture-bar referencesNo negative history offsets such as close[-1].
  • CheckIntrabar recalculationcalc_on_every_tick = true. Live values can differ from history.
  • 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+47.2%+102.5%2612%1.8935.5%26 Jan 2024 – 21 Oct 2026
BTCUSDT 4h+20.3%+5.5%1242%2.5518.7%8 May 2026 – 21 Oct 2026
ETHUSDT 1D−64.2%+9.8%1817%0.2967.9%26 Jan 2024 – 21 Oct 2026
ETHUSDT 4h−33.9%+8.4%1513%0.1235.4%8 May 2026 – 21 Oct 2026
SOLUSDT 1D−59.0%+16.7%287%0.3662.4%26 Jan 2024 – 21 Oct 2026
SOLUSDT 4h−21.6%+21.5%922%0.3130.2%8 May 2026 – 21 Oct 2026
BNBUSDT 1D−12.8%+148.3%1275%0.8656.3%26 Jan 2024 – 21 Oct 2026
BNBUSDT 4h+25.0%+17.1%978%2.5418.1%8 May 2026 – 21 Oct 2026

Backtests are simulations on historical data and are not investment advice.

The trades

By market direction

At entry, last 90 barsTradesWonP&L
Rising market10%−$4,842.73
Sideways market1619%$65,955.40
Falling market90%−$13,935.20

Rising and falling mean the market moved more than 15% over the 90 bars before entry.

How bad could the drawdown be?

28.4%

The 95th percentile of the worst drawdown when the same 26 trades are reshuffled 5,000 times. The bar spans the 5th to 95th percentile, 12.6% to 28.4%; the tick is what actually happened, 22.4%. Order luck alone moves it this much.

0%33%
All 26 trades
SideEntryExitBarsP&L
long5 May 2024 63,892.0015 Jul 2024 60,797.9071−$4,842.73
long6 Aug 2024 54,018.802 Oct 2024 60,804.9057$11,954.10
long15 Oct 2024 66,084.004 Mar 2025 86,221.20140$32,639.10
long6 Mar 2025 90,606.008 Mar 2025 86,801.702−$5,867.68
long16 Mar 2025 84,338.4021 Mar 2025 84,223.405−$182.65
long12 Apr 2025 83,423.8015 Aug 2025 118,295.00125$55,886.80
long9 Sep 2025 112,065.0026 Sep 2025 108,994.0017−$5,194.94
long30 Sep 2025 114,312.0011 Oct 2025 112,774.0011−$2,480.05
long27 Oct 2025 114,559.007 Nov 2025 101,346.0011−$20,981.90
long11 Nov 2025 106,011.0015 Jan 2026 96,951.8065−$13,752.50
long1 Feb 2026 78,741.101 Feb 2026 78,741.100$0.00
long2 Feb 2026 76,968.202 Feb 2026 76,968.200$0.00
long3 Feb 2026 78,738.603 Feb 2026 78,738.600$0.00
long4 Feb 2026 75,770.204 Feb 2026 75,770.200$0.00
long5 Feb 2026 73,165.805 Feb 2026 73,165.800$0.00
long6 Feb 2026 62,909.906 Feb 2026 62,909.900$0.00
long13 Feb 2026 66,272.2013 Feb 2026 66,272.200$0.00
long3 Jun 2026 66,760.803 Jun 2026 66,760.800$0.00
long4 Jun 2026 64,142.804 Jun 2026 64,142.800$0.00
long5 Jun 2026 63,886.005 Jun 2026 63,886.000$0.00
long6 Jun 2026 61,056.506 Jun 2026 61,056.500$0.00
long7 Jun 2026 60,884.607 Jun 2026 60,884.600$0.00
long8 Jun 2026 63,332.008 Jun 2026 63,332.000$0.00
long9 Jun 2026 63,086.009 Jun 2026 63,086.000$0.00
long10 Jun 2026 61,730.0010 Jun 2026 61,730.000$0.00
long11 Jun 2026 61,511.0011 Jun 2026 61,511.000$0.00

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
Infiten Slope Strategy this page—v4 strategy+47.2%2635.5%
Optimized Keltner Channels SL-TP Strategy for BTC by chanu_lev10ksma ema rmav4 strategy−19.4%3670.0%
Soheil PKO's 5 min Hitman Scalp - 3MA + Laguerre RSI + ADX [Pt] by PtGamblerema sma rmav5 strategyNo trades on this market
EMA-ADX-VOL-CRYPTO KILLER [15M] by Babehdyorma sma emav4 strategy+4.5%225.3%
Contrarian Scalping Counter Trend Bb Envelope Adx and Stochastic by exlux99sma ema rmav5 strategy+1.9%153.2%
CCI + EMA with RSI Cross Strategy by rwestbrookjrema rma smav5 strategyNo trades on this market

Where it runs

EngineCompilesRunsMatches TradingView
Zeal Terminal · OpenPineScript v2Yes 14 msWith a workaround 1,000 bars in 48 msNot measured
PineTSNo v5 and v6 only—Not measured

Zeal Terminal's engine currently reads an order side written as true as a short, whatever it says; this page passes the same side as strategy.long or strategy.short (lines 63, 64) so the engine trades the way the script says.

“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. PineTS runs Pine Script v5 and v6 only.

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/// © spiritualhealer117//@version=4strategy("Infiten Slope Strategy", overlay=false,calc_on_every_tick = true, default_qty_type=strategy.percent_of_equity, default_qty_value = 100)// //TIME RESTRICT FOR BACKTESTING {// inDateRange = (time >= timestamp(syminfo.timezone, 2003,//          1, 1, 0, 0)) and//      (time < timestamp(syminfo.timezone, 2021, 5, 25, 0, 0))// //}//OPTIMAL PARAMETERS {daysback = 30volumesens = 1.618//}//Calculating Exhaustion and Exhaustion Moving Average {clh = close+low+highexhaustion = (clh-sma(clh,daysback))/sma(clh,daysback)exhaustionSma = sma(exhaustion,daysback)//}//Long Term Moving Averages for sell signals {red = sma(close,300)white = sma(close,150)blue = sma(close,50)plot(red,color=color.red)plot(white,color=color.white)plot(blue,color=color.blue)//}//MACD Calculation {fast_length = input(title="Fast Length", type=input.integer, defval=12)slow_length = input(title="Slow Length", type=input.integer, defval=26)src = input(title="Source", type=input.source, defval=close)signal_length = input(title="Signal Smoothing", type=input.integer, minval = 1, maxval = 50, defval = 9)sma_source = input(title="Simple MA (Oscillator)", type=input.bool, defval=false)sma_signal = input(title="Simple MA (Signal Line)", type=input.bool, defval=false)// Calculatingfast_ma = sma_source ? sma(src, fast_length) : ema(src, fast_length)slow_ma = sma_source ? sma(src, slow_length) : ema(src, slow_length)macd = fast_ma - slow_masignal = sma_signal ? sma(macd, signal_length) : ema(macd, signal_length)hist = macd - signal//}//SIGMOID Bottom {timeAdjust = 300/sma(close,500)//}//RSI bottom {len = input(14, minval=1, title="Length")up = rma(max(change(src), 0), len)down = rma(-min(change(close), 0), len)rsi = down == 0 ? 100 : up == 0 ? 0 : 100 - (100 / (1 + up / down))//}//Entry and exit conditions {//Sell conditionsbigVolume = sma(volume,30)*volumesenssellcond1 = crossunder(exhaustion,exhaustionSma) and volume > bigVolumesellcond2 = crossunder(macd,signal) and volume > bigVolumemidtermsellcond1 = crossunder(blue,white)longtermsellcond1 = white < red//Buy conditionsbuycond = crossover(exhaustion,exhaustionSma) and not longtermsellcond1buycond2 = rsi < 30buycond3 = crossover(blue,white) and longtermsellcond1//}//Backtest Run Buy/Sell Commands {strategy.entry("buycond",true, when=buycond and bigVolume)strategy.entry("buycond2",true, when=buycond2 and bigVolume)strategy.close_all(when=sellcond1,comment="short term sell signal 1")strategy.close_all(when=midtermsellcond1, comment="mid term sell signal 1")strategy.close_all(when=longtermsellcond1, comment="long term sell signal 1")strategy.close_all(when=sellcond2, comment="short term sell signal 2")plot(strategy.position_size)//Sell on last tested day (only for data collection)//strategy.close_all(when=not inDateRange)//}