Pine Script v5 · Strategy
Take profit Multi timeframe
A Pine Script v5 strategy built on EMA (ap, 10), SMA (wt1, 4) and Change (time). It has 10 order rules, 1 entry among them, and trades long only with the default settings. Exits use a stop loss and a profit target. Each trade is one contract and pays no commission. 21 settings; defaults include Channel Length 10, Average Length 21 and Over Bought Lv 1 60.
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 Take profit Multi timeframe repaint?
- Yes
- At least one pattern in the source can repaint: intrabar recalculation.
- How did Take profit Multi timeframe do on BTCUSDT 1D with default settings?
- +25.41%
- From 26 Jan 2024 to 21 Oct 2026, over 61 closed trades, against +102.5% for buy and hold. A backtest, not investment advice.
- Does Take profit Multi timeframe 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: 61 before, 0 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 Take profit Multi timeframe use a stop loss?
- Yes
- strategy.exit sets a stop on line 62, 63, 64, 65, 68, 69, 70.
- Does Take profit Multi timeframe run in Zeal Terminal?
- Yes
- It compiles in 91 ms and runs 1,000 bars in 190 ms, in the browser.
BTCUSDT · 1D · default settings
- SL Long
- Long TP1%
- Long TP2%
- Long TP3%
- Long TP4%
- Long TP1Mtf
- Long TP2Mtf
- Long TP3Mtf
- Ema100 D
- Ema200 D
- Winning trade
- Losing trade
- Equity
- Buy and hold
Needs BINANCE:BTCUSDT 240 data, not available: a lower timeframe than the chart; the engine does not evaluate intrabar data Values that depend on it are empty on this chart.
- Net profit
- +25.41%
- $2,540.89
- Buy and hold
- +102.5%
- same period
- Closed trades
- 61
- 31 won · 30 lost
- Profitable
- 50.8%
- of closed trades
- Profit factor
- 1.06
- gross profit ÷ gross loss
- Max drawdown
- 97.47%
- −$28,411.80
One run with the author's default settings, $10,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
5 settings do nothing
“Over Bought Lv 1”, “Over Bought Lv 2”, “Over Sold Lv 1”, “Over Sold Lv 2”, “% Close At TP4” are declared but never read.
-
Check
No commission
The backtest assumes free trading. Results on any real exchange will be lower.
-
Note
Uses an argument v6 removed
when = on line 66, 71. The upgraded version below moves each call inside an if block.
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 |
|---|---|---|---|
| Set up take profit | |||
| Take profit % | true | bool | exit TP1% exit TP2% exit TP3% exit TP4% close_all line 61 |
| Take profit Multi timeframe | false | bool | exit TP1Mtf exit TP2Mtf exit TP3Mtf close_all line 67 |
| Example Strategy | |||
| Channel Length | 10 | int | esa d |
| Average Length | 21 | int | tci |
| Over Bought Lv 1 | 60 | int | unused |
| Over Bought Lv 2 | 53 | int | unused |
| Over Sold Lv 1 | -60 | int | unused |
| Over Sold Lv 2 | -53 | int | unused |
| Take profit % | |||
| TP1 % | 3 | float · step 0.1 | long_tp1_lv exit TP1% |
| TP2 % | 5 | float · step 1 | long_tp2_lv exit TP2% |
| TP3 % | 8 | float · step 1 | long_tp3_lv exit TP3% |
| TP4 % | 10 | float · step 1 | long_tp4_lv exit TP4% |
| Stop Loss % | 5 | float · step 1 | lossSTL |
| % Close At TP1 | 5 | float · step 1 | exit TP1% exit TP1Mtf |
| % Close At TP2 | 5 | float · step 1 | exit TP2% exit TP2Mtf |
| % Close At TP3 | 5 | float · step 1 | exit TP3% exit TP4% exit TP3Mtf |
| % Close At TP4 | 5 | float · step 1 | unused |
| Take profit Mtf | |||
| EMA1 | 100 | int | htf_ma1 labelema1 labelema3 |
| EMA2 | 200 | int | htf_ma2 labelema2 labelema4 |
| Timeframe 1 | 240 | timeframe | ema1 ema2 labelema1 labelema2 |
| Timeframe 2 | D | timeframe | ema3 ema4 labelema3 labelema4 |
What it calculates
- EMAap, Channel Length (10)
esa · line 17 - EMAmath.abs(ap - esa), Channel Length (10)
d · line 18 - EMAci, Average Length (21)
tci · line 20 - SMAwt1, 4
wt2 · line 22 - EMAsrc, EMA1 (100)
htf_ma1 · line 47 - EMAsrc, EMA2 (200)
htf_ma2 · line 48 - Changetime
_x · line 91
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.
The script has 61 named inputs, calculations, conditions and outputs, too many to draw legibly here; the tables above list them.
Order rules
| Order | Fires when | By default | Line |
|---|---|---|---|
| Open Long long | buy | On | 27 |
| Exit TP1% stop and limit | takepercent == true | On | 62 |
| Exit TP2% stop and limit | takepercent == true | On | 63 |
| Exit TP3% stop and limit | takepercent == true | On | 64 |
| Exit TP4% stop and limit | takepercent == true | On | 65 |
| Close | closebuyta.crossunder(wt1, wt2) and wt1 > 0 | On | 66 |
| Exit TP1Mtf stop and limit | takemtf == true and array.max(a, 1) > strategy.position_avg_price | On | 68 |
| Exit TP2Mtf stop and limit | takemtf == true and array.max(a, 1) > strategy.position_avg_price | On | 69 |
| Exit TP3Mtf stop and limit | takemtf == true and array.max(a, 1) > strategy.position_avg_price | On | 70 |
| Close | closebuyta.crossunder(wt1, wt2) and wt1 > 0 | On | 71 |
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.
- ClearHigher-timeframe data4 request.security call(s), none with lookahead on.
- ClearFuture-bar referencesNo negative history offsets such as close[-1].
- CheckIntrabar recalculationreads realtime-only state. 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
Not run on other markets: the script requests BINANCE:BTCUSDT 240, and that data is not available here (a lower timeframe than the chart; the engine does not evaluate intrabar data). Its results would rest on empty values.
The trades
By market direction
| At entry, last 90 bars | Trades | Won | P&L |
|---|---|---|---|
| Rising market | 13 | 69% | $12,571.10 |
| Sideways market | 38 | 45% | −$12,308.70 |
| Falling market | 10 | 50% | $2,278.51 |
Rising and falling mean the market moved more than 15% over the 90 bars before entry.
How bad could the drawdown be?
86.2%
The 95th percentile of the worst drawdown when the same 61 trades are reshuffled 5,000 times. The bar spans the 5th to 95th percentile, 58.2% to 86.2%; the tick is what actually happened, 63.5%. Order luck alone moves it this much.
All 61 trades
| Side | Entry | Exit | Bars | P&L |
|---|---|---|---|---|
| long | 21 Apr 2024 64,940.60 | 22 Apr 2024 66,888.80 | 1 | $97.41 |
| long | 21 Apr 2024 64,940.60 | 30 Apr 2024 61,693.60 | 9 | −$162.35 |
| long | 21 Apr 2024 64,940.60 | 30 Apr 2024 61,693.60 | 9 | −$162.35 |
| long | 21 Apr 2024 64,940.60 | 30 Apr 2024 61,693.60 | 9 | −$162.35 |
| long | 21 Apr 2024 64,940.60 | 25 May 2024 68,550.00 | 34 | $2,887.53 |
| long | 30 Jun 2024 60,986.70 | 1 Jul 2024 62,816.30 | 1 | $91.48 |
| long | 30 Jun 2024 60,986.70 | 4 Jul 2024 57,937.30 | 4 | −$152.47 |
| long | 30 Jun 2024 60,986.70 | 4 Jul 2024 57,937.30 | 4 | −$152.47 |
| long | 30 Jun 2024 60,986.70 | 4 Jul 2024 57,937.30 | 4 | −$152.47 |
| long | 30 Jun 2024 60,986.70 | 26 Jul 2024 65,799.90 | 26 | $3,850.62 |
| long | 10 Aug 2024 60,838.00 | 12 Aug 2024 57,796.10 | 2 | −$152.09 |
| long | 10 Aug 2024 60,838.00 | 12 Aug 2024 57,796.10 | 2 | −$152.09 |
| long | 10 Aug 2024 60,838.00 | 12 Aug 2024 57,796.10 | 2 | −$152.09 |
| long | 10 Aug 2024 60,838.00 | 12 Aug 2024 57,796.10 | 2 | −$152.09 |
| long | 10 Aug 2024 60,838.00 | 28 Aug 2024 59,415.00 | 18 | −$1,138.39 |
| long | 11 Sep 2024 57,636.00 | 13 Sep 2024 59,365.10 | 2 | $86.45 |
| long | 11 Sep 2024 57,636.00 | 13 Sep 2024 60,517.80 | 2 | $144.09 |
| long | 11 Sep 2024 57,636.00 | 19 Sep 2024 62,246.90 | 8 | $230.54 |
| long | 11 Sep 2024 57,636.00 | 19 Sep 2024 63,399.60 | 8 | $288.18 |
| long | 11 Sep 2024 57,636.00 | 1 Oct 2024 63,327.60 | 20 | $4,553.29 |
| long | 3 Jan 2025 96,984.80 | 6 Jan 2025 99,894.30 | 3 | $145.48 |
| long | 3 Jan 2025 96,984.80 | 6 Jan 2025 101,834.00 | 3 | $242.46 |
| long | 3 Jan 2025 96,984.80 | 9 Jan 2025 95,060.60 | 6 | −$1,731.76 |
| long | 15 Feb 2025 97,500.50 | 24 Feb 2025 92,625.40 | 9 | −$243.75 |
| long | 15 Feb 2025 97,500.50 | 24 Feb 2025 92,625.40 | 9 | −$243.75 |
| long | 15 Feb 2025 97,500.50 | 24 Feb 2025 92,625.40 | 9 | −$243.75 |
| long | 15 Feb 2025 97,500.50 | 24 Feb 2025 92,625.40 | 9 | −$243.75 |
| long | 15 Feb 2025 97,500.50 | 29 Mar 2025 84,424.40 | 42 | −$10,460.90 |
| long | 11 Apr 2025 79,607.30 | 12 Apr 2025 83,423.80 | 1 | $190.83 |
| long | 11 Apr 2025 79,607.30 | 12 Apr 2025 83,587.70 | 1 | $199.02 |
| long | 11 Apr 2025 79,607.30 | 13 Apr 2025 85,975.90 | 2 | $318.43 |
| long | 11 Apr 2025 79,607.30 | 21 Apr 2025 87,568.00 | 10 | $398.04 |
| long | 11 Apr 2025 79,607.30 | 30 Apr 2025 94,256.80 | 19 | $11,719.60 |
| long | 25 Jun 2025 106,083.00 | 2 Jul 2025 109,265.00 | 7 | $159.13 |
| long | 25 Jun 2025 106,083.00 | 9 Jul 2025 111,387.00 | 14 | $265.21 |
| long | 25 Jun 2025 106,083.00 | 10 Jul 2025 114,570.00 | 15 | $424.33 |
| long | 25 Jun 2025 106,083.00 | 10 Jul 2025 116,691.00 | 15 | $530.41 |
| long | 25 Jun 2025 106,083.00 | 17 Jul 2025 118,630.00 | 22 | $10,038.00 |
| long | 3 Sep 2025 111,240.00 | 11 Sep 2025 114,577.00 | 8 | $166.86 |
| long | 3 Sep 2025 111,240.00 | 16 Sep 2025 116,802.00 | 13 | $278.10 |
| long | 3 Sep 2025 111,240.00 | 21 Sep 2025 115,686.00 | 18 | $4,001.06 |
| long | 22 Oct 2025 108,298.00 | 24 Oct 2025 111,547.00 | 2 | $162.45 |
| long | 22 Oct 2025 108,298.00 | 26 Oct 2025 113,713.00 | 4 | $270.74 |
| long | 22 Oct 2025 108,298.00 | 4 Nov 2025 102,883.00 | 13 | −$270.74 |
| long | 22 Oct 2025 108,298.00 | 4 Nov 2025 102,883.00 | 13 | −$270.74 |
| long | 22 Oct 2025 108,298.00 | 9 Jan 2026 91,100.00 | 79 | −$13,758.10 |
| long | 9 Feb 2026 70,330.40 | 11 Feb 2026 66,813.90 | 2 | −$175.83 |
| long | 9 Feb 2026 70,330.40 | 11 Feb 2026 66,813.90 | 2 | −$175.83 |
| long | 9 Feb 2026 70,330.40 | 11 Feb 2026 66,813.90 | 2 | −$175.83 |
| long | 9 Feb 2026 70,330.40 | 11 Feb 2026 66,813.90 | 2 | −$175.83 |
| long | 9 Feb 2026 70,330.40 | 8 Mar 2026 67,262.90 | 27 | −$2,453.98 |
| long | 2 Apr 2026 68,113.90 | 6 Apr 2026 70,157.30 | 4 | $102.17 |
| long | 2 Apr 2026 68,113.90 | 7 Apr 2026 71,519.60 | 5 | $170.28 |
| long | 2 Apr 2026 68,113.90 | 11 Apr 2026 73,563.00 | 9 | $272.46 |
| long | 2 Apr 2026 68,113.90 | 14 Apr 2026 74,925.30 | 12 | $340.57 |
| long | 2 Apr 2026 68,113.90 | 20 Apr 2026 73,801.80 | 18 | $4,550.30 |
| long | 26 May 2026 77,322.00 | 28 May 2026 73,455.90 | 2 | −$193.31 |
| long | 26 May 2026 77,322.00 | 28 May 2026 73,455.90 | 2 | −$193.31 |
| long | 26 May 2026 77,322.00 | 28 May 2026 73,455.90 | 2 | −$193.31 |
| long | 26 May 2026 77,322.00 | 28 May 2026 73,455.90 | 2 | −$193.31 |
| long | 26 May 2026 77,322.00 | 25 Jul 2026 64,140.00 | 60 | −$10,545.60 |
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 |
|---|---|---|---|---|---|
| Take profit Multi timeframe this page | — | v5 strategy | +25.4% | 61 | 97.5% |
| MACD Long Strat by TheGrindToday | ema sma | v4 strategy | +24.0% | 79 | 20.1% |
| Stock trending strategy by exlux99 | ema sma | v4 strategy | +35.3% | 21 | 14.7% |
| 4-Hour Stochastic EMA Trend by slymnturkoglu | ema sma | v4 strategy | No trades on this market | ||
| 4X EMA and volume strategy by SoftKill21 | ema sma | v4 strategy | +1.8% | 3 | 25.8% |
| Simple Momentum Strategy Based on SMA, EMA and Volume by slip_stream | sma ema | v4 strategy | +7.4% | 18 | 27.4% |
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.
- 2 strategy calls use the when = argument (line 66, 71). It is deprecated in v5 and removed in v6, where each call moves inside an if block.
- 6 settings use the untyped input() (line 10, 11, 12, 13, 14, 15). 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 61 trades and the same P&L on BTCUSDT 1D, 1,000 bars, in Zeal Terminal's engine.
- Line 10: input() → input.int()
- Line 11: input() → input.int()
- Line 12: input() → input.int()
- Line 13: input() → input.int()
- Line 14: input() → input.int()
- Line 15: input() → input.int()
- Line 66: when = closebuy → if block
- Line 71: when = closebuy → if block
⋯//WaveTrend indicator-n1 = input(10, "Channel Length", group="Example Strategy")+n1 = input.int(10, "Channel Length", group="Example Strategy")-n2 = input(21, "Average Length", group="Example Strategy")+n2 = input.int(21, "Average Length", group="Example Strategy")-oblv1 = input(60, "Over Bought Lv 1", group="Example Strategy")+oblv1 = input.int(60, "Over Bought Lv 1", group="Example Strategy")-oblv2 = input(53, "Over Bought Lv 2", group="Example Strategy")+oblv2 = input.int(53, "Over Bought Lv 2", group="Example Strategy")-oslv1 = input(-60, "Over Sold Lv 1", group="Example Strategy")+oslv1 = input.int(-60, "Over Sold Lv 1", group="Example Strategy")-oslv2 = input(-53, "Over Sold Lv 2", group="Example Strategy")+oslv2 = input.int(-53, "Over Sold Lv 2", group="Example Strategy")ap = hlc3 ⋯ strategy.exit("TP4%", "Long", qty_percent = qty3, profit = percent(TP4), loss = lossSTL)- strategy.close_all(when= closebuy, comment="Close All")+ if closebuy+ strategy.close_all(comment="Close All")if takemtf == true and array.max(a, 1) > strategy.position_avg_price⋯ strategy.exit("TP3Mtf", "Long", qty_percent = qty3, limit = tpmtf3, stop = long_sl_lv)- strategy.close_all(when= closebuy, comment="Close All")+ if closebuy+ strategy.close_all(comment="Close All")// Plot TP & SL⋯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: 61 before, 0 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.
⋯// © TrendCrypto2022-//@version=5+//@version=6strategy(title = "Take profit Multi timeframe", overlay = true, pyramiding=0,initial_capital = 10000, default_qty_type= strategy.fixed, default_qty_value =1, calc_on_order_fills=false, slippage=0,commission_type=strategy.commission.percent,commission_value=0)⋯Where it runs
| Engine | Compiles | Runs | Matches TradingView |
|---|---|---|---|
| Zeal Terminal · OpenPineScript v2 | Yes 91 ms | Yes 1,000 bars in 190 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/// © TrendCrypto2022//@version=5strategy(title = "Take profit Multi timeframe", overlay = true, pyramiding=0,initial_capital = 10000, default_qty_type= strategy.fixed, default_qty_value =1, calc_on_order_fills=false, slippage=0,commission_type=strategy.commission.percent,commission_value=0)//Inputtakepercent = input.bool(title="Take profit %", defval=true , group="Set up take profit")takemtf = input.bool(title="Take profit Multi timeframe", defval=false , group="Set up take profit")//Paste your strategy at here. This is example strategy: I use WaveTrend indicator//WaveTrend indicatorn1 = input(10, "Channel Length", group="Example Strategy")n2 = input(21, "Average Length", group="Example Strategy")oblv1 = input(60, "Over Bought Lv 1", group="Example Strategy")oblv2 = input(53, "Over Bought Lv 2", group="Example Strategy")oslv1 = input(-60, "Over Sold Lv 1", group="Example Strategy")oslv2 = input(-53, "Over Sold Lv 2", group="Example Strategy")ap = hlc3 esa = ta.ema(ap, n1)d = ta.ema(math.abs(ap - esa), n1)ci = (ap - esa) / (0.015 * d)tci = ta.ema(ci, n2)wt1 = tciwt2 = ta.sma(wt1,4)//Strategybuy = ta.crossover(wt1, wt2) and wt1 < -20closebuy = ta.crossunder(wt1, wt2) and wt1 > 0if buy strategy.entry("Long", strategy.long)//Set up take profit %percent(pcnt) => strategy.position_size != 0 ? math.round(pcnt / 100 * strategy.position_avg_price / syminfo.mintick) : float(na)TP1 =input.float(3, title="TP1 %", step=0.1, group="Take profit %", inline = "1")TP2 =input.float(5, title="TP2 %", step=1, group="Take profit %", inline = "1")TP3 =input.float(8, title="TP3 %", step=1, group="Take profit %", inline = "2")TP4 =input.float(10, title="TP4 %", step=1, group="Take profit %", inline = "2")SL =input.float(5, title="Stop Loss %", step=1, group="Take profit %")qty1 =input.float(5, title="% Close At TP1", step=1, group="Take profit %", inline = "3")qty2 =input.float(5, title="% Close At TP2", step=1, group="Take profit %", inline = "3")qty3 =input.float(5, title="% Close At TP3", step=1, group="Take profit %", inline = "4")qty4 =input.float(5, title="% Close At TP4", step=1, group="Take profit %", inline = "4")lossSTL = percent(SL)//Set up take profit at higher TFema_len1 = input.int(title='EMA1', defval=100, group='Take profit Mtf')ema_len2 = input.int(title='EMA2', defval=200, group='Take profit Mtf')src = closetf1 = input.timeframe(title='Timeframe 1', defval='240', group='Take profit Mtf')tf2 = input.timeframe(title='Timeframe 2', defval='D', group='Take profit Mtf')htf_ma1 = ta.ema(src, ema_len1)htf_ma2 = ta.ema(src, ema_len2)ema1 = request.security(syminfo.tickerid, tf1, htf_ma1)ema2 = request.security(syminfo.tickerid, tf1, htf_ma2)ema3 = request.security(syminfo.tickerid, tf2, htf_ma1)ema4 = request.security(syminfo.tickerid, tf2, htf_ma2)//Set up take profit multi timeframea = array.from((ema1), (ema2), (ema3), (ema4))tpmtf1 = array.min(a)tpmtf2 = array.min(a, 2)tpmtf3 = array.min(a, 3)tpmtf4 = array.min(a, 4)//Set up exitlong_sl_lv = strategy.position_avg_price - lossSTL*syminfo.mintickif takepercent == true strategy.exit("TP1%", "Long", qty_percent = qty1, profit = percent(TP1), loss = lossSTL) strategy.exit("TP2%", "Long", qty_percent = qty2, profit = percent(TP2), loss = lossSTL) strategy.exit("TP3%", "Long", qty_percent = qty3, profit = percent(TP3), loss = lossSTL) strategy.exit("TP4%", "Long", qty_percent = qty3, profit = percent(TP4), loss = lossSTL) strategy.close_all(when= closebuy, comment="Close All")if takemtf == true and array.max(a, 1) > strategy.position_avg_price strategy.exit("TP1Mtf", "Long", qty_percent = qty1, limit = tpmtf1, stop = long_sl_lv) strategy.exit("TP2Mtf", "Long", qty_percent = qty2, limit = tpmtf2, stop = long_sl_lv) strategy.exit("TP3Mtf", "Long", qty_percent = qty3, limit = tpmtf3, stop = long_sl_lv) strategy.close_all(when= closebuy, comment="Close All")// Plot TP & SLlong_tp1_lv = strategy.position_avg_price + percent(TP1)*syminfo.minticklong_tp2_lv = strategy.position_avg_price + percent(TP2)*syminfo.minticklong_tp3_lv = strategy.position_avg_price + percent(TP3)*syminfo.minticklong_tp4_lv = strategy.position_avg_price + percent(TP4)*syminfo.mintickplot(strategy.position_size > 0 ? long_sl_lv : na, color=color.red, style=plot.style_linebr, title="SL Long")plot(strategy.position_size > 0 ? long_tp1_lv : na, color=color.lime, style=plot.style_linebr, title="Long TP1%")plot(strategy.position_size > 0 ? long_tp2_lv : na, color=color.lime, style=plot.style_linebr, title="Long TP2%")plot(strategy.position_size > 0 ? long_tp3_lv : na, color=color.lime, style=plot.style_linebr, title="Long TP3%")plot(strategy.position_size > 0 ? long_tp4_lv : na, color=color.lime, style=plot.style_linebr, title="Long TP4%")plot(strategy.position_size > 0 ? tpmtf1 : na, color=color.orange, style=plot.style_linebr, title="Long TP1Mtf", display = display.none)plot(strategy.position_size > 0 ? tpmtf2 : na, color=color.orange, style=plot.style_linebr, title="Long TP2Mtf", display = display.none)plot(strategy.position_size > 0 ? tpmtf3 : na, color=color.orange, style=plot.style_linebr, title="Long TP3Mtf", display = display.none)//Plot Resistant in higher TFplotema1 = plot(ema1, color=color.new(color.silver, 0), style=plot.style_line, linewidth=1, offset=0, title='Ema100 4h', display=display.none)plotema2 = plot(ema2, color=color.new(color.silver, 0), style=plot.style_line, linewidth=1, offset=0, title='Ema200 4h', display=display.none)plotema3 = plot(ema3, color=color.new(color.orange, 20), style=plot.style_line, linewidth=1, offset=0, title='Ema100 D', display=display.none)plotema4 = plot(ema4, color=color.new(color.orange, 20), style=plot.style_line, linewidth=1, offset=0, title='Ema200 D', display=display.none)//Label TP_x = timenow + math.round(ta.change(time) * 2)var label labelema1 = nalabel.delete(labelema1)labelema1 := label.new(x=_x, y=ema1, text='Ema' + str.tostring(ema_len1) + ' ' + str.tostring(tf1) + ': ' + str.tostring(math.round(ema1,4)) + '', color=color.new(#000000, 100), textcolor = color.yellow, size=size.small, style=label.style_label_left, xloc=xloc.bar_time, yloc=yloc.price)var label labelema2 = nalabel.delete(labelema2)labelema2 := label.new(x=_x, y=ema2, text='Ema' + str.tostring(ema_len2) + ' ' + str.tostring(tf1) + ': ' + str.tostring(math.round(ema2,4)) + '', color=color.new(#000000, 100), textcolor = color.yellow, size=size.small, style=label.style_label_left, xloc=xloc.bar_time, yloc=yloc.price)var label labelema3 = nalabel.delete(labelema3)labelema3 := label.new(x=_x, y=ema3, text='Ema' + str.tostring(ema_len1) + ' ' + str.tostring(tf2) + ': ' + str.tostring(math.round(ema3,4)) + '', color=color.new(#000000, 100), textcolor = color.yellow, size=size.small, style=label.style_label_left, xloc=xloc.bar_time, yloc=yloc.price)var label labelema4 = nalabel.delete(labelema4)labelema4 := label.new(x=_x, y=ema4, text='Ema' + str.tostring(ema_len2) + ' ' + str.tostring(tf2) + ': ' + str.tostring(math.round(ema4,4)) + '', color=color.new(#000000, 100), textcolor = color.yellow, size=size.small, style=label.style_label_left, xloc=xloc.bar_time, yloc=yloc.price)if strategy.position_size > 0 var label labellongtp1 = na label.delete(labellongtp1) labellongtp1 := label.new(x=_x, y=long_tp1_lv, text='TP1: ' + str.tostring(math.round(long_tp1_lv,2)) + '', color=color.new(#000000, 100), textcolor = color.lime, size=size.small, style=label.style_label_left, xloc=xloc.bar_time, yloc=yloc.price) var label labellongtp2 = na label.delete(labellongtp2) labellongtp2 := label.new(x=_x, y=long_tp2_lv, text='TP2: ' + str.tostring(math.round(long_tp2_lv,2)) + '', color=color.new(#000000, 100), textcolor = color.lime, size=size.small, style=label.style_label_left, xloc=xloc.bar_time, yloc=yloc.price) var label labellongtp3 = na label.delete(labellongtp3) labellongtp3 := label.new(x=_x, y=long_tp3_lv, text='TP3: ' + str.tostring(math.round(long_tp3_lv,2)) + '', color=color.new(#000000, 100), textcolor = color.lime, size=size.small, style=label.style_label_left, xloc=xloc.bar_time, yloc=yloc.price) var label labellongtp4 = na label.delete(labellongtp4) labellongtp4 := label.new(x=_x, y=long_tp4_lv, text='TP4: ' + str.tostring(math.round(long_tp4_lv,2)) + '', color=color.new(#000000, 100), textcolor = color.lime, size=size.small, style=label.style_label_left, xloc=xloc.bar_time, yloc=yloc.price)