Pine Script v4 · Strategy
ELIA MULTI INDICATORS STRATEGY
A Pine Script v4 strategy built on EMA (close, 80), MACD (close, 12) and RSI (close, 2). It has 4 order rules, 2 entries among them, and trades long and short with the default settings. Exits wait for a signal; there is no stop loss. Each trade commits 25% of equity and pays no commission. 16 settings; defaults include start year 2021, end year 9999 and Trigger In Value 6.
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 ELIA MULTI INDICATORS STRATEGY repaint?
- No
- No repainting patterns were found in the source, and a live tick-by-tick replay matched history on 11 of 11 trades.
- How did ELIA MULTI INDICATORS STRATEGY do on BTCUSDT 1D with default settings?
- −2.47%
- From 26 Jan 2024 to 21 Oct 2026, over 60 closed trades, against +102.5% for buy and hold. A backtest, not investment advice.
- Can ELIA MULTI INDICATORS STRATEGY be converted to Pine Script v5?
- No
- The automatic step from v4 to v5 gives a script that does not run in v5 (Pine Script v5 Error at @L41:C6: 'obv' was renamed to 'ta.obv' in Pine Script v5), so no v5 download is offered; the edits are shown below.
- Does ELIA MULTI INDICATORS STRATEGY use a stop loss?
- No
- Every exit waits for a signal; nothing limits a losing trade before it fires.
- Does ELIA MULTI INDICATORS STRATEGY run in Zeal Terminal?
- Yes
- It compiles in 22 ms and runs 1,000 bars in 63 ms, in the browser.
BTCUSDT · 1D · default settings
- Plot
- long
- short
- close long
- closeshort
- Winning trade
- Losing trade
- Equity
- Buy and hold
- Net profit
- −2.47%
- −$24.67
- Buy and hold
- +102.5%
- same period
- Closed trades
- 60
- 19 won · 41 lost
- Profitable
- 31.7%
- of closed trades
- Profit factor
- 0.92
- gross profit ÷ gross loss
- Max drawdown
- 14.92%
- −$149.16
One run with the author's default settings, $1,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.
-
Check
4 settings do nothing
“Macd Fast Len”, “Macd Fast Len”, “Macd Signal Len”, “Stk D Len” are declared but never read.
-
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.
-
Note
No slippage
Fills are assumed at the exact open price. Add slippage in the properties for a more realistic test.
-
Note
Uses long =, which v5 renamed line 64
long = on line 64, 70. v5 writes it as direction = strategy.long or strategy.short.
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 ema → ta.ema, macd → ta.macd, rsi → ta.rsi, sma → ta.sma, stoch → ta.stoch, stdev → ta.stdev, mom → ta.mom.
v4 → v5
DiffersThe v5 version does not run in Zeal Terminal's engine: Pine Script v5 Error at @L41:C6: 'obv' was renamed to 'ta.obv' in Pine Script v5.
- Line 3: //@version=4 → //@version=5
- Line 31: ema → ta.ema
- Line 32: macd → ta.macd
- Line 33: ema → ta.ema
- Line 33: ema → ta.ema
- Line 34: rsi → ta.rsi
7 more edits
- Line 35: sma → ta.sma
- Line 35: stoch → ta.stoch
- Line 36: sma → ta.sma
- Line 37: stdev → ta.stdev
- Line 40: mom → ta.mom
- Line 64: long = strategy.long → direction = strategy.long
- Line 70: long = strategy.short → direction = strategy.short
⋯// © ally17-//@version=4+//@version=5strategy("ELIA MULTI STRATEGY",overlay=false,initial_capital=1000, default_qty_type=strategy.percent_of_equity, commission_type=strategy.commission.percent, commission_value=0.00, default_qty_value=25)⋯var donvar =0.0-ema = ema(close,emalen)+ema = ta.ema(close,emalen)-[macdLine, signalLine, histLine] = macd(close, 12, 26, 9) // MACD+[macdLine, signalLine, histLine] = ta.macd(close, 12, 26, 9) // MACD-occ = ema(close,occlen) - ema(open,occlen)+occ = ta.ema(close,occlen) - ta.ema(open,occlen)-rsi = rsi(close, rsilen) // RSI+rsi = ta.rsi(close, rsilen) // RSI-stoch = sma(stoch(close, high, low, stochklen), stochlen) // Stoch+stoch = ta.sma(ta.stoch(close, high, low, stochklen), stochlen) // Stoch-basis = sma(close, bblength)+basis = ta.sma(close, bblength)-dev = mult * stdev(close, bblength)+dev = mult * ta.stdev(close, bblength)upper = basis + devlower = basis - dev-moment = mom(close, momlen) // Momentum+moment = ta.mom(close, momlen) // MomentumObv = obv // OBV⋯ if longcondition- strategy.entry("LONG", long=strategy.long)+ strategy.entry("LONG", direction = strategy.long)if closelong⋯ if shortcondition- strategy.entry("SHORT", long=strategy.short)+ strategy.entry("SHORT", direction = strategy.short)if closeshort⋯Clean v5
Not verifiedThe v5 script does not run in Zeal Terminal's engine (Pine Script v5 Error at @L41:C6: 'obv' was renamed to 'ta.obv' in Pine Script v5.), so this step could not be checked.
- Line 6: input() → input.int()
- Line 7: input() → input.int()
- Line 8: input() → input.int()
- Line 9: input() → input.int()
- Line 10: input() → input.int()
- Line 11: input() → input.int()
10 more edits
- Line 12: input() → input.int()
- Line 13: input() → input.int()
- Line 14: input() → input.int()
- Line 15: input() → input.int()
- Line 16: input() → input.int()
- Line 17: input() → input.int()
- Line 18: input() → input.int()
- Line 19: input() → input.int()
- Line 20: input() → input.float()
- Line 21: input() → input.int()
⋯//INPUT-start = timestamp(input(2021, "start year"), 1, 1, 00, 00)+start = timestamp(input.int(2021, "start year"), 1, 1, 00, 00)-end = timestamp(input(9999, "end year"), 1, 1, 00, 00)+end = timestamp(input.int(9999, "end year"), 1, 1, 00, 00)-triggerin=input(6, title="Trigger In Value", minval=1, maxval=15)+triggerin=input.int(6, title="Trigger In Value", minval=1, maxval=15)-triggerout=input(3, title="Trigger Out Value", minval=1, maxval=15)+triggerout=input.int(3, title="Trigger Out Value", minval=1, maxval=15)-emalen=input(80, title="Ema Len")+emalen=input.int(80, title="Ema Len")-macdfast=input(12, title="Macd Fast Len")+macdfast=input.int(12, title="Macd Fast Len")-macdslow=input(26, title="Macd Fast Len")+macdslow=input.int(26, title="Macd Fast Len")-macdsig=input(12, title="Macd Signal Len")+macdsig=input.int(12, title="Macd Signal Len")-occlen=input(15, title="Occ Len")+occlen=input.int(15, title="Occ Len")-rsilen=input(2, title="Rsi Len")+rsilen=input.int(2, title="Rsi Len")-stochklen=input(11, title="Stk K Len")+stochklen=input.int(11, title="Stk K Len")-stochdlen=input(3, title="Stk D Len")+stochdlen=input.int(3, title="Stk D Len")-stochlen=input(3, title="Stk Smooth Len")+stochlen=input.int(3, title="Stk Smooth Len")-bblength = input(10, minval=1, title="BB Len")+bblength = input.int(10, minval=1, title="BB Len")-mult = input(2.0, minval=0.001, maxval=50, title="BB Std Dev")+mult = input.float(2.0, minval=0.001, maxval=50, title="BB Std Dev")-momlen=input(10, title="Mom Len")+momlen=input.int(10, title="Mom Len")//CALCOLI⋯Does it run in Pine Script v6?
Not tested
The v5 script does not run in Zeal Terminal's engine (Pine Script v5 Error at @L41:C6: 'obv' was renamed to 'ta.obv' in Pine Script v5.), so this step could not be checked. The v6 version is shown for reference and is not offered as a download. It differs from the v5 version by 1 edit.
⋯// © ally17-//@version=5+//@version=6strategy("ELIA MULTI STRATEGY",overlay=false,initial_capital=1000, default_qty_type=strategy.percent_of_equity, commission_type=strategy.commission.percent, commission_value=0.00, default_qty_value=25)⋯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 |
|---|---|---|---|
| start year | 2021 | int | line 62 line 68 |
| end year | 9999 | int | line 62 line 68 |
| Trigger In Value | 6 | int · min 1 · max 15 | longcondition shortcondition trendcolor long short |
| Trigger Out Value | 3 | int · min 1 · max 15 | closelong closeshort trendcolor close long |
| Ema Len | 80 | int | ema |
| Macd Fast Len | 12 | int | unused |
| Macd Fast Len | 26 | int | unused |
| Macd Signal Len | 12 | int | unused |
| Occ Len | 15 | int | occ |
| Rsi Len | 2 | int | rsi |
| Stk K Len | 11 | int | stoch |
| Stk D Len | 3 | int | unused |
| Stk Smooth Len | 3 | int | stoch |
| BB Len | 10 | int · min 1 | basis dev |
| BB Std Dev | 2.0 | float · min 0.001 · max 50 | dev |
| Mom Len | 10 | int | moment |
What it calculates
- EMA (
ema,ta.emain v5)close, Ema Len (80)ema · line 31 - MACD (
macd,ta.macdin v5)close, 12, 26, 9macdLine · line 32 - MACD (
macd,ta.macdin v5)close, 12, 26, 9signalLine · line 32 - MACD (
macd,ta.macdin v5)close, 12, 26, 9histLine · line 32 - EMA (
ema,ta.emain v5)close, Occ Len (15)occ · line 33 - RSI (
rsi,ta.rsiin v5)close, Rsi Len (2)rsi · line 34 - SMA / Stoch (
sma,ta.smain v5)stoch(close, high, low, stochklen), Stk Smooth Len (3)stoch · line 35 - SMA (
sma,ta.smain v5)close, BB Len (10)basis · line 36 - Stdev (
stdev,ta.stdevin v5)close, BB Len (10)dev · line 37 - MOM (
mom,ta.momin v5)close, Mom Len (10)moment · line 40
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 LONG long | longcondition | On | 64 |
| Close LONG | closelong | On | 66 |
| Open SHORT short | shortcondition | On | 70 |
| Close SHORT | closeshort | On | 72 |
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 | −2.5% | +102.5% | 60 | 32% | 0.92 | 14.9% | 26 Jan 2024 – 21 Oct 2026 |
| BTCUSDT 4h | +5.5% | +5.5% | 58 | 33% | 1.57 | 3.3% | 8 May 2026 – 21 Oct 2026 |
| ETHUSDT 1D | −12.7% | +9.8% | 65 | 26% | 0.73 | 25.6% | 26 Jan 2024 – 21 Oct 2026 |
| ETHUSDT 4h | +7.5% | +8.4% | 60 | 30% | 1.60 | 3.1% | 8 May 2026 – 21 Oct 2026 |
| SOLUSDT 1D | +9.8% | +16.7% | 62 | 34% | 1.23 | 10.1% | 26 Jan 2024 – 21 Oct 2026 |
| SOLUSDT 4h | +10.7% | +21.5% | 62 | 31% | 1.79 | 3.2% | 8 May 2026 – 21 Oct 2026 |
| BNBUSDT 1D | −17.0% | +148.3% | 66 | 30% | 0.55 | 19.1% | 26 Jan 2024 – 21 Oct 2026 |
| BNBUSDT 4h | +2.0% | +17.1% | 73 | 33% | 1.16 | 4.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 bars | Trades | Won | P&L |
|---|---|---|---|
| Rising market | 21 | 33% | $18.16 |
| Sideways market | 30 | 27% | −$85.18 |
| Falling market | 9 | 44% | $42.35 |
Rising and falling mean the market moved more than 15% over the 90 bars before entry.
How bad could the drawdown be?
19.0%
The 95th percentile of the worst drawdown when the same 60 trades are reshuffled 5,000 times. The bar spans the 5th to 95th percentile, 9.0% to 19.0%; the tick is what actually happened, 14.5%. Order luck alone moves it this much.
All 60 trades
| Side | Entry | Exit | Bars | P&L |
|---|---|---|---|---|
| short | 27 Jan 2024 41,823.50 | 23 Feb 2024 51,288.40 | 27 | −$56.58 |
| short | 27 Feb 2024 54,476.50 | 1 Mar 2024 61,131.00 | 3 | −$28.81 |
| short | 17 Mar 2024 65,300.60 | 18 Mar 2024 68,393.50 | 1 | −$10.83 |
| short | 22 Mar 2024 65,501.30 | 25 Mar 2024 67,210.00 | 3 | −$5.89 |
| short | 29 Mar 2024 70,780.60 | 5 Apr 2024 68,487.80 | 7 | $7.27 |
| short | 6 Apr 2024 67,820.60 | 7 Apr 2024 68,896.00 | 1 | −$3.59 |
| short | 13 Apr 2024 67,116.50 | 18 Apr 2024 61,277.40 | 5 | $19.61 |
| short | 3 May 2024 59,060.60 | 4 May 2024 62,882.00 | 1 | −$14.90 |
| long | 6 May 2024 64,012.00 | 8 May 2024 62,312.10 | 2 | −$6.02 |
| long | 10 May 2024 63,074.00 | 11 May 2024 60,800.00 | 1 | −$8.11 |
| short | 12 May 2024 60,826.00 | 13 May 2024 61,484.00 | 1 | −$2.41 |
| long | 14 May 2024 62,940.10 | 15 May 2024 61,577.50 | 1 | −$4.82 |
| long | 17 May 2024 65,235.20 | 1 Jun 2024 67,540.00 | 15 | $7.82 |
| long | 6 Jun 2024 71,108.00 | 9 Jun 2024 69,310.50 | 3 | −$5.64 |
| short | 19 Jun 2024 65,175.30 | 13 Jul 2024 57,889.10 | 24 | $24.79 |
| long | 18 Jul 2024 64,088.00 | 1 Aug 2024 64,628.00 | 14 | $1.92 |
| short | 7 Aug 2024 56,022.00 | 14 Aug 2024 60,587.20 | 7 | −$18.62 |
| short | 15 Aug 2024 58,683.40 | 20 Aug 2024 59,438.50 | 5 | −$2.88 |
| long | 27 Aug 2024 62,834.00 | 28 Aug 2024 59,415.00 | 1 | −$12.14 |
| short | 3 Sep 2024 59,132.10 | 13 Sep 2024 58,132.30 | 10 | $3.72 |
| short | 17 Sep 2024 58,214.00 | 18 Sep 2024 60,314.00 | 1 | −$7.97 |
| long | 24 Sep 2024 63,340.00 | 2 Oct 2024 60,804.90 | 8 | −$8.76 |
| short | 10 Oct 2024 60,636.00 | 12 Oct 2024 62,540.00 | 2 | −$6.81 |
| long | 22 Oct 2024 67,377.50 | 27 Oct 2024 67,092.80 | 5 | −$0.91 |
| long | 1 Nov 2024 70,292.00 | 4 Nov 2024 68,776.00 | 3 | −$4.63 |
| long | 8 Nov 2024 75,857.90 | 30 Nov 2024 97,460.00 | 22 | $60.86 |
| long | 6 Jan 2025 98,363.60 | 8 Jan 2025 96,954.60 | 2 | −$3.28 |
| long | 16 Jan 2025 100,497.00 | 29 Jan 2025 101,336.00 | 13 | $1.90 |
| short | 19 Feb 2025 95,671.70 | 20 Feb 2025 96,644.40 | 1 | −$2.32 |
| long | 21 Feb 2025 98,305.00 | 22 Feb 2025 96,182.00 | 1 | −$4.92 |
| short | 2 Mar 2025 86,064.50 | 6 Mar 2025 90,606.00 | 4 | −$11.97 |
| short | 9 Mar 2025 86,222.50 | 16 Mar 2025 84,338.40 | 7 | $4.89 |
| short | 8 Apr 2025 79,163.20 | 10 Apr 2025 82,615.20 | 2 | −$9.81 |
| short | 11 Apr 2025 79,607.30 | 12 Apr 2025 83,423.80 | 1 | −$10.67 |
| long | 28 Apr 2025 93,749.30 | 18 May 2025 103,127.00 | 20 | $21.99 |
| long | 24 May 2025 107,318.00 | 25 May 2025 107,762.00 | 1 | $0.93 |
| long | 12 Jun 2025 108,645.00 | 13 Jun 2025 105,672.00 | 1 | −$6.17 |
| long | 27 Jun 2025 106,947.00 | 22 Jul 2025 117,380.00 | 25 | $21.86 |
| long | 23 Jul 2025 119,954.00 | 25 Jul 2025 118,341.00 | 2 | −$3.09 |
| long | 12 Aug 2025 118,686.00 | 16 Aug 2025 117,342.00 | 4 | −$2.59 |
| short | 27 Aug 2025 111,763.00 | 29 Aug 2025 112,567.00 | 2 | −$1.64 |
| short | 30 Aug 2025 108,377.00 | 8 Sep 2025 111,137.00 | 9 | −$5.80 |
| long | 9 Sep 2025 112,065.00 | 23 Sep 2025 112,651.00 | 14 | $1.18 |
| short | 27 Sep 2025 109,643.00 | 30 Sep 2025 114,312.00 | 3 | −$9.65 |
| long | 8 Oct 2025 121,333.00 | 11 Oct 2025 112,774.00 | 3 | −$15.81 |
| short | 15 Oct 2025 113,028.00 | 27 Oct 2025 114,559.00 | 12 | −$2.98 |
| long | 28 Oct 2025 114,108.00 | 29 Oct 2025 112,898.00 | 1 | −$2.33 |
| short | 4 Nov 2025 106,583.00 | 29 Nov 2025 90,890.70 | 25 | $32.22 |
| short | 18 Dec 2025 86,243.20 | 21 Dec 2025 88,360.90 | 3 | −$5.57 |
| long | 16 Jan 2026 95,604.80 | 20 Jan 2026 92,631.00 | 4 | −$7.01 |
| short | 22 Jan 2026 89,454.70 | 17 Feb 2026 68,892.40 | 26 | $51.43 |
| short | 27 Mar 2026 68,820.30 | 7 Apr 2026 68,853.70 | 11 | −$0.11 |
| long | 14 Apr 2026 74,418.00 | 30 Apr 2026 75,780.00 | 16 | $4.33 |
| long | 8 May 2026 80,006.00 | 13 May 2026 80,504.50 | 5 | $1.48 |
| short | 27 May 2026 75,930.00 | 15 Jun 2026 65,746.40 | 19 | $31.93 |
| short | 28 Jun 2026 60,029.00 | 30 Jun 2026 60,260.20 | 2 | −$0.95 |
| short | 28 Jul 2026 63,755.90 | 7 Aug 2026 64,323.60 | 10 | −$2.19 |
| short | 12 Aug 2026 63,600.00 | 19 Aug 2026 64,725.40 | 7 | −$4.34 |
| long | 23 Aug 2026 77,074.90 | 3 Sep 2026 77,340.00 | 11 | $0.84 |
| long | 24 Sep 2026 84,397.60 | 30 Sep 2026 83,663.70 | 6 | −$2.13 |
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 |
|---|---|---|---|---|---|
| ELIA MULTI INDICATORS STRATEGY this page | — | v4 strategy | −2.5% | 60 | 14.9% |
| Take Profit On Trend (by BHD_Trade_Bot) by BHD_Trade_Bot | ema rsi stdev sma | v4 strategy | +54.8% | 9 | 13.1% |
| 5 Minute Scalping Strategy by Coachman0912 | sma ema stdev rsi | v5 strategy | No trades on this market | ||
| Bollinger Band + RSI + ADX + MACD + Heikinashi by TradeUsingPivots | sma stdev rsi ema | v4 strategy | No trades on this market | ||
| AVWAP Strategy by asfbhero | rsi stoch sma stdev | v5 strategy | does not run in Zeal Terminal | ||
| Webhook Starter Kit [HullBuster] by tradingtudi | ema stoch sma stdev | v4 strategy | does not run in Zeal Terminal | ||
Where it runs
| Engine | Compiles | Runs | Matches TradingView |
|---|---|---|---|
| Zeal Terminal · OpenPineScript v2 | Yes 22 ms | With a workaround 1,000 bars in 63 ms | Not measured |
| PineTS | No v5 and v6 only | — | Not measured |
Zeal Terminal's engine currently reads an order side written as long = strategy.long, long = strategy.short as a short, whatever it says; this page passes the same side as strategy.long or strategy.short (lines 64, 70) 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/// © ally17//@version=4strategy("ELIA MULTI STRATEGY",overlay=false,initial_capital=1000, default_qty_type=strategy.percent_of_equity, commission_type=strategy.commission.percent, commission_value=0.00, default_qty_value=25)//INPUTstart = timestamp(input(2021, "start year"), 1, 1, 00, 00)end = timestamp(input(9999, "end year"), 1, 1, 00, 00)triggerin=input(6, title="Trigger In Value", minval=1, maxval=15)triggerout=input(3, title="Trigger Out Value", minval=1, maxval=15)emalen=input(80, title="Ema Len")macdfast=input(12, title="Macd Fast Len")macdslow=input(26, title="Macd Fast Len")macdsig=input(12, title="Macd Signal Len")occlen=input(15, title="Occ Len")rsilen=input(2, title="Rsi Len")stochklen=input(11, title="Stk K Len")stochdlen=input(3, title="Stk D Len")stochlen=input(3, title="Stk Smooth Len")bblength = input(10, minval=1, title="BB Len")mult = input(2.0, minval=0.001, maxval=50, title="BB Std Dev")momlen=input(10, title="Mom Len")//CALCOLIvar trigger = 0.0var emavar = 0.0var macdvar = 0.0var occvar = 0.0var rsivar = 0.0var stochvar = 0.0var bbvar = 0.0var donvar =0.0ema = ema(close,emalen)[macdLine, signalLine, histLine] = macd(close, 12, 26, 9) // MACDocc = ema(close,occlen) - ema(open,occlen)rsi = rsi(close, rsilen) // RSIstoch = sma(stoch(close, high, low, stochklen), stochlen) // Stochbasis = sma(close, bblength)dev = mult * stdev(close, bblength)upper = basis + devlower = basis - devmoment = mom(close, momlen) // MomentumObv = obv // OBV//PLOT//STRATEGIAemavar := (close>ema)? 3 : -3macdvar := (macdLine>signalLine)? 3 : -3occvar := (occ>0)? 3 : -3rsivar := (rsi<20)? 2 : (rsi>50 and rsi<80)? 1 : (rsi>80)? -2 : (rsi<50 and rsi>20)? -1 : 0stochvar := (stoch<20)? 2 : (stoch>80)? -2 : 0bbvar := (close<lower)? 2 : (close>upper)? -2 : 0trigger := emavar+macdvar+occvar+rsivar+stochvar+bbvarlongcondition = trigger >= triggerincloselong = trigger < triggeroutshortcondition = trigger <= -triggerincloseshort = trigger > -triggerouttrendcolor = longcondition ? color.green : shortcondition? color.red : (trigger>triggerout and trigger<triggerin)? #A2E1BF : (trigger<-triggerout and trigger>-triggerin)? #E19997 : na//bgcolor(trendcolor, transp=80)plot(trigger, color=color.white)hline(triggerin, title="long", color=color.green, linestyle=hline.style_dashed)hline(0-triggerin, title="short", color=color.red, linestyle=hline.style_dashed)hline(triggerout, title="close long",color=color.blue, linestyle=hline.style_dashed)hline(0-triggerout, title="closeshort",color=color.blue, linestyle=hline.style_dashed)if time > start and time < end if longcondition strategy.entry("LONG", long=strategy.long)if closelong strategy.close("LONG", comment="CLOSE LONG") if time > start and time < end if shortcondition strategy.entry("SHORT", long=strategy.short)if closeshort strategy.close("SHORT", comment="CLOSE SHORT")//plotshape(longcondition, color=color.green, text="L", size=size.small, style=shape.triangledown)//plotshape(shortcondition, color=color.red, "S"(trigger), size=size.small, style=shape.triangledown)//plotshape(closelong, color=color.purple, text="LC", size=size.small, style=shape.triangledown)//plotshape(closeshort, color=color.purple, text="SC", size=size.small, style=shape.triangledown)