Pine Script v4 · Strategy
Bagheri IG Ether v2
A Pine Script v4 strategy built on EMA (close, 50), Change (ma, 186) and Highest (53). It has 4 order rules, 2 entries among them, and trades long and short with the default settings. Exits use a stop loss and a profit target. Each trade is one contract and pays no commission. 14 settings; defaults include Take Profit 3000, Stop Loss 2200 and ROC Length 186.
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 Bagheri IG Ether v2 repaint?
- No
- No repainting patterns were found in the source, and a live tick-by-tick replay matched history on 1 of 1 trades.
- How did Bagheri IG Ether v2 do on BTCUSDT 1D with default settings?
- −0.04%
- From 26 Jan 2024 to 21 Oct 2026, over 2 closed trades, against +102.5% for buy and hold. A backtest, not investment advice.
- Can Bagheri IG Ether v2 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 @L32:C17: No value assigned to the `transp` parameter in color.new()), so no v5 download is offered; the edits are shown below.
- Does Bagheri IG Ether v2 use a stop loss?
- Yes
- strategy.exit sets a stop on line 66, 67.
- Does Bagheri IG Ether v2 run in Zeal Terminal?
- Yes
- It compiles in 29 ms and runs 1,000 bars in 104 ms, in the browser.
BTCUSDT · 1D · default settings
- Plot
- Plot
- Plot
- Winning trade
- Losing trade
- Equity
- Buy and hold
- Net profit
- −0.04%
- −$44.00
- Buy and hold
- +102.5%
- same period
- Closed trades
- 2
- 0 won · 2 lost
- Profitable
- 0.0%
- of closed trades
- Profit factor
- 0.00
- gross profit ÷ gross loss
- Max drawdown
- 0.04%
- −$44.00
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
ema(close, wmaBP_period) ignores the settings line 35
Line 35 hard-codes close where line 11 uses “Source”. Changing those settings moves one band but not this one.
ema(close, wmaBP_period)ema(src, wmaBP_period) -
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 an argument v6 removed
when = on line 63, 64. The upgraded version below moves each call inside an if block.
-
Note
Uses transp =, which v5 removed line 32
transp = on line 32, 79, 80. v5 folds the transparency into the colour with color.new(c, transp).
-
Note
Uses long =, which v5 renamed line 63
long = on line 63, 64. 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, change → ta.change, highest → ta.highest, lowest → ta.lowest, avg → math.avg, rma → ta.rma, sma → ta.sma, tostring → str.tostring.
- 2 strategy calls use the when = argument (line 63, 64). It is deprecated in v5 and removed in v6, where each call moves inside an if block.
v4 → v5
DiffersThe v5 version does not run in Zeal Terminal's engine: Pine Script v5 Error at @L32:C17: No value assigned to the `transp` parameter in color.new()
- Line 3: //@version=4 → //@version=5
- Line 8: input(type = input.integer) → input.int()
- Line 9: input(type = input.integer) → input.int()
- Line 10: input(type = input.source) → input.source()
- Line 11: ema → ta.ema
- Line 12: change → ta.change
17 more edits
- Line 25: highest → ta.highest
- Line 26: lowest → ta.lowest
- Line 27: avg → math.avg
- Line 32: transp = 90 removed: the call sets no colour to fold it into, so its default colour loses the transparency
- Line 35: ema → ta.ema
- Line 40: rma → ta.rma
- Line 46: sma → ta.sma
- Line 63: long = true → direction = strategy.long
- Line 64: long = false → direction = strategy.short
- Line 79: transp = 90 removed: the call sets no colour to fold it into, so its default colour loses the transparency
- Line 80: transp = 90 removed: the call sets no colour to fold it into, so its default colour loses the transparency
- Line 84: input(type = input.float) → input.float()
- Line 101: tostring → str.tostring
- Line 102: tostring → str.tostring
- Line 103: tostring → str.tostring
- Line 104: tostring → str.tostring
- Line 105: tostring → str.tostring
⋯// © mbagheri746-//@version=4+//@version=5strategy("Bagheri IG Ether v2", overlay=true, margin_long=100, margin_short=100)⋯//_________________ RoC Definition _________________-rocLength = input(title="ROC Length", type=input.integer, minval=1, defval=186)+rocLength = input.int(title="ROC Length", minval=1, defval=186)-smoothingLength = input(title="Smoothing Length", type=input.integer, minval=1, defval=50)+smoothingLength = input.int(title="Smoothing Length", minval=1, defval=50)-src = input(title="Source", type=input.source, defval=close)+src = input.source(title="Source", defval=close)-ma = ema(src, smoothingLength)+ma = ta.ema(src, smoothingLength)-mom = change(ma, rocLength)+mom = ta.change(ma, rocLength)sroc = nz(ma[rocLength]) == 0⋯offset_bar = input(91,minval=0, title ="Offset Bars")-upper = highest(length1)+upper = ta.highest(length1)-lower = lowest(length2)+lower = ta.lowest(length2)-basis = avg(upper, lower)+basis = math.avg(upper, lower)DC_UP_Band = upper[offset_bar]⋯u = plot(DC_UP_Band, style=plot.style_line, linewidth=1, color=color.aqua)-fill(l,u,color = color.new(color.aqua,transp = 90))+fill(l,u,color = color.new(color.aqua))//_________________ Bears Power _________________wmaBP_period = input(65,minval=1,title="BearsP WMA Period")-line_wma = ema(close, wmaBP_period)+line_wma = ta.ema(close, wmaBP_period)BP = low - line_wma⋯BOP=(close - open) / (high - low)-SBOP = rma(BOP, ES_BoP)+SBOP = ta.rma(BOP, ES_BoP)//_________________ Alligator _________________⋯sma_shift = input(37, minval = 1 , title = "SMA Shift")-sma_primary = sma(close,sma_period)+sma_primary = ta.sma(close,sma_period)SMA_sh = sma_primary[sma_shift]⋯if strategy.position_size == 0- strategy.entry(id = "BUY", long = true , when = MA_Lcnd and ROC_Lcnd and DC_Lcnd and BP_Lcnd and BOP_Lcnd)+ strategy.entry(id = "BUY", direction = strategy.long , when = MA_Lcnd and ROC_Lcnd and DC_Lcnd and BP_Lcnd and BOP_Lcnd)- strategy.entry(id = "SELL", long = false , when = MA_Scnd and ROC_Scnd and DC_Scnd and BP_Scnd and BOP_Scnd)+ strategy.entry(id = "SELL", direction = strategy.short , when = MA_Scnd and ROC_Scnd and DC_Scnd and BP_Scnd and BOP_Scnd)//_________________ CLOSE POSITION __________________//⋯Pline = plot(pos_price != 0.0 ? pos_price : na, title="Stop Loss", color=color.gray, trackprice = true, show_last = 1)-fill(Tline , Pline, color = color.new(color.green,transp = 90))+fill(Tline , Pline, color = color.new(color.green))-fill(Sline , Pline, color = color.new(color.red,transp = 90))+fill(Sline , Pline, color = color.new(color.red))//_________________ Alert __________________//⋯//_________________ Label __________________//-inMyPrice = input(title="My Price", type=input.float, defval=0)+inMyPrice = input.float(title="My Price", defval=0)inLabelStyle = input(title="Label Style", options=["Upper Right", "Lower Right"], defval="Lower Right")⋯ "Pos: " +posDir +"\n" +- "Pos Price: "+tostring(strategy.position_avg_price) +"\n" ++ "Pos Price: "+str.tostring(strategy.position_avg_price) +"\n" +- "Pos PnL: " +tostring(posPnL, "0.00") + "%" +"\n" ++ "Pos PnL: " +str.tostring(posPnL, "0.00") + "%" +"\n" +- "Profit: " +tostring(strategy.openprofit, "0.00") + "$" +"\n" ++ "Profit: " +str.tostring(strategy.openprofit, "0.00") + "$" +"\n" +- "TP: " +tostring(TP_line, "0.00") +"\n" ++ "TP: " +str.tostring(TP_line, "0.00") +"\n" +- "SL: " +tostring(SL_line, "0.00") +"\n" ++ "SL: " +str.tostring(SL_line, "0.00") +"\n" + "╚═══════╝")Clean v5
Not verifiedThe v5 script does not run in Zeal Terminal's engine (Pine Script v5 Error at @L32:C17: No value assigned to the `transp` parameter in color.new()), so this step could not be checked.
- Line 5: input() → input.int()
- Line 6: input() → input.int()
- Line 22: input() → input.int()
- Line 23: input() → input.int()
- Line 24: input() → input.int()
- Line 34: input() → input.int()
6 more edits
- Line 38: input() → input.int()
- Line 44: input() → input.int()
- Line 45: input() → input.int()
- Line 63: when = MA_Lcnd and ROC_Lcnd and DC_Lcnd and BP_Lcnd and BOP_Lcnd → if block
- Line 64: when = MA_Scnd and ROC_Scnd and DC_Scnd and BP_Scnd and BOP_Scnd → if block
- Line 85: input() → input.string()
⋯strategy("Bagheri IG Ether v2", overlay=true, margin_long=100, margin_short=100)-TP = input(3000, minval = 1 , title ="Take Profit")+TP = input.int(3000, minval = 1 , title ="Take Profit")-SL = input(2200, minval = 1 , title ="Stop Loss")+SL = input.int(2200, minval = 1 , title ="Stop Loss")//_________________ RoC Definition _________________⋯//_________________ Donchian Channel _________________-length1 = input(53, minval=1, title="Upper Channel")+length1 = input.int(53, minval=1, title="Upper Channel")-length2 = input(53, minval=1, title="Lower Channel")+length2 = input.int(53, minval=1, title="Lower Channel")-offset_bar = input(91,minval=0, title ="Offset Bars")+offset_bar = input.int(91,minval=0, title ="Offset Bars")upper = ta.highest(length1)⋯//_________________ Bears Power _________________-wmaBP_period = input(65,minval=1,title="BearsP WMA Period")+wmaBP_period = input.int(65,minval=1,title="BearsP WMA Period")line_wma = ta.ema(close, wmaBP_period)⋯//_________________ Balance of Power _________________-ES_BoP=input(15, title="BoP Exponential Smoothing")+ES_BoP=input.int(15, title="BoP Exponential Smoothing")BOP=(close - open) / (high - low)⋯//_________________ Moving Average _________________-sma_period = input(74, minval = 1 , title = "SMA Period")+sma_period = input.int(74, minval = 1 , title = "SMA Period")-sma_shift = input(37, minval = 1 , title = "SMA Shift")+sma_shift = input.int(37, minval = 1 , title = "SMA Shift")sma_primary = ta.sma(close,sma_period)⋯if strategy.position_size == 0- strategy.entry(id = "BUY", direction = strategy.long , when = MA_Lcnd and ROC_Lcnd and DC_Lcnd and BP_Lcnd and BOP_Lcnd)+ if MA_Lcnd and ROC_Lcnd and DC_Lcnd and BP_Lcnd and BOP_Lcnd+ strategy.entry(id = "BUY", direction = strategy.long )- strategy.entry(id = "SELL", direction = strategy.short , when = MA_Scnd and ROC_Scnd and DC_Scnd and BP_Scnd and BOP_Scnd)+ if MA_Scnd and ROC_Scnd and DC_Scnd and BP_Scnd and BOP_Scnd+ strategy.entry(id = "SELL", direction = strategy.short )//_________________ CLOSE POSITION __________________//⋯inMyPrice = input.float(title="My Price", defval=0)-inLabelStyle = input(title="Label Style", options=["Upper Right", "Lower Right"], defval="Lower Right")+inLabelStyle = input.string(title="Label Style", options=["Upper Right", "Lower Right"], defval="Lower Right")posColor = color.new(color.green, 25)⋯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 @L32:C17: No value assigned to the `transp` parameter in color.new()), 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.
⋯// © mbagheri746-//@version=5+//@version=6strategy("Bagheri IG Ether v2", overlay=true, margin_long=100, margin_short=100)⋯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 |
|---|---|---|---|
| Take Profit | 3000 | int · min 1 | TP_line exit CLOSE BUY exit CLOSE SELL |
| Stop Loss | 2200 | int · min 1 | SL_line exit CLOSE BUY exit CLOSE SELL |
| ROC Length | 186 | int (written input.integer) · min 1 | mom sroc |
| Smoothing Length | 50 | int (written input.integer) · min 1 | ma |
| Source | close | source | ma |
| Upper Channel | 53 | int · min 1 | upper |
| Lower Channel | 53 | int · min 1 | lower |
| Offset Bars | 91 | int · min 0 | DC_UP_Band DC_LW_Band |
| BearsP WMA Period | 65 | int · min 1 | line_wma |
| BoP Exponential Smoothing | 15 | int | SBOP |
| SMA Period | 74 | int · min 1 | sma_primary |
| SMA Shift | 37 | int · min 1 | SMA_sh |
| My Price | 0 | float | myPnL |
| Label Style | Lower Right | string · options ["Upper Right", "Lower Right"] | lb |
What it calculates
- EMA (
ema,ta.emain v5)Source (close), Smoothing Length (50)ma · line 11 - Change (
change,ta.changein v5)ma, ROC Length (186)mom · line 12 - Highest (
highest,ta.highestin v5)Upper Channel (53)upper · line 25 - Lowest (
lowest,ta.lowestin v5)Lower Channel (53)lower · line 26 - EMA (
ema,ta.emain v5)close, BearsP WMA Period (65)line_wma · line 35 - RMA (
rma,ta.rmain v5)BOP, BoP Exponential Smoothing (15)SBOP · line 40 - SMA (
sma,ta.smain v5)close, SMA Period (74)sma_primary · line 46
Signal flow
How price data and settings reach the orders. Each box is a name in the script, or several computed the same way; each arrow is a value one of them reads. Hover a box for its members.
Order rules
| Order | Fires when | By default | Line |
|---|---|---|---|
| Open BUY long | MA_Lcnd and ROC_Lcnd and DC_Lcnd and BP_Lcnd and BOP_Lcnd | On | 63 |
| Open SELL short | MA_Scnd and ROC_Scnd and DC_Scnd and BP_Scnd and BOP_Scnd | On | 64 |
| Exit CLOSE BUY stop and limit | every bar | On | 66 |
| Exit CLOSE SELL stop and limit | every bar | On | 67 |
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 | −0.0% | +102.5% | 2 | 0% | 0.00 | 0.0% | 26 Jan 2024 – 21 Oct 2026 |
| BTCUSDT 4h | +0.0% | +5.5% | 2 | 50% | 1.36 | 0.0% | 8 May 2026 – 21 Oct 2026 |
| ETHUSDT 1D | +0.0% | +9.8% | 2 | 50% | 1.36 | 0.0% | 26 Jan 2024 – 21 Oct 2026 |
| ETHUSDT 4h | −0.0% | +8.4% | 1 | 0% | 0.00 | 0.0% | 8 May 2026 – 21 Oct 2026 |
| SOLUSDT 1D | +0.0% | +16.7% | 2 | 50% | 1.36 | 0.0% | 26 Jan 2024 – 21 Oct 2026 |
| SOLUSDT 4h | −0.0% | +21.5% | 1 | 0% | 0.00 | 0.0% | 8 May 2026 – 21 Oct 2026 |
| BNBUSDT 1D | +0.0% | +148.3% | 2 | 50% | 1.36 | 0.0% | 26 Jan 2024 – 21 Oct 2026 |
| BNBUSDT 4h | −0.0% | +17.1% | 1 | 0% | 0.00 | 0.0% | 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 | 0 | — | $0.00 |
| Sideways market | 2 | 0% | −$44.00 |
| Falling market | 0 | — | $0.00 |
Rising and falling mean the market moved more than 15% over the 90 bars before entry.
How bad could the drawdown be?
0.0%
The 95th percentile of the worst drawdown when the same 2 trades are reshuffled 5,000 times. The bar spans the 5th to 95th percentile, 0.0% to 0.0%; the tick is what actually happened, 0.0%. Order luck alone moves it this much.
All 2 trades
| Side | Entry | Exit | Bars | P&L |
|---|---|---|---|---|
| short | 30 Aug 2025 108,377.00 | 30 Aug 2025 108,399.00 | 0 | −$22.00 |
| long | 1 May 2026 76,346.60 | 1 May 2026 76,324.60 | 0 | −$22.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.
| Script | Shares | Type | Net | Trades | Max drawdown |
|---|---|---|---|---|---|
| Bagheri IG Ether v2 this page | — | v4 strategy | −0.0% | 2 | 0.0% |
| Bagheri IG Ether by Bagheri_IG | ema highest lowest rma sma | v4 strategy | +0.0% | 3 | 0.0% |
| MACD Willy Strategy by PtGambler | rma sma ema highest lowest | v5 strategy | No trades on this market | ||
| Forex bot full strategy with risk management by exlux99 | lowest highest ema sma | v4 strategy | −26.4% | 11 | 38.9% |
| LowFinder_PyraMider_V2 by A3Sh | rma ema sma highest | v5 strategy | +1.9% | 15 | 0.8% |
| PB Trend Scalper by PatrickGwynBuckley | ema rma highest lowest | v5 strategy | −16.9% | 10 | 68.3% |
Where it runs
| Engine | Compiles | Runs | Matches TradingView |
|---|---|---|---|
| Zeal Terminal · OpenPineScript v2 | Yes 29 ms | With a workaround 1,000 bars in 104 ms | Not measured |
| PineTS | No v5 and v6 only | — | Not measured |
Zeal Terminal's engine currently reads an order side written as long = true, long = false 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/// © mbagheri746//@version=4strategy("Bagheri IG Ether v2", overlay=true, margin_long=100, margin_short=100)TP = input(3000, minval = 1 , title ="Take Profit")SL = input(2200, minval = 1 , title ="Stop Loss")//_________________ RoC Definition _________________rocLength = input(title="ROC Length", type=input.integer, minval=1, defval=186)smoothingLength = input(title="Smoothing Length", type=input.integer, minval=1, defval=50)src = input(title="Source", type=input.source, defval=close)ma = ema(src, smoothingLength)mom = change(ma, rocLength)sroc = nz(ma[rocLength]) == 0 ? 100 : mom == 0 ? 0 : 100 * mom / ma[rocLength]//srocColor = sroc >= 0 ? #0ebb23 : color.red//plot(sroc, title="SROC", linewidth=2, color=srocColor, transp=0)//hline(0, title="Zero Level", linestyle=hline.style_dotted, color=#989898)//_________________ Donchian Channel _________________length1 = input(53, minval=1, title="Upper Channel")length2 = input(53, minval=1, title="Lower Channel")offset_bar = input(91,minval=0, title ="Offset Bars")upper = highest(length1)lower = lowest(length2)basis = avg(upper, lower)DC_UP_Band = upper[offset_bar]DC_LW_Band = lower[offset_bar]l = plot(DC_LW_Band, style=plot.style_line, linewidth=1, color=color.red)u = plot(DC_UP_Band, style=plot.style_line, linewidth=1, color=color.aqua)fill(l,u,color = color.new(color.aqua,transp = 90))//_________________ Bears Power _________________wmaBP_period = input(65,minval=1,title="BearsP WMA Period")line_wma = ema(close, wmaBP_period)BP = low - line_wma//_________________ Balance of Power _________________ES_BoP=input(15, title="BoP Exponential Smoothing")BOP=(close - open) / (high - low)SBOP = rma(BOP, ES_BoP)//_________________ Alligator _________________//_________________ CCI _________________//_________________ Moving Average _________________sma_period = input(74, minval = 1 , title = "SMA Period")sma_shift = input(37, minval = 1 , title = "SMA Shift")sma_primary = sma(close,sma_period)SMA_sh = sma_primary[sma_shift]plot(SMA_sh, style=plot.style_line, linewidth=2, color=color.yellow)//_________________ Long Entry Conditions _________________//MA_Lcnd = SMA_sh > low and SMA_sh < highROC_Lcnd = sroc < 0DC_Lcnd = open < DC_LW_BandBP_Lcnd = BP[1] < BP[0] and BP[1] < BP[2]BOP_Lcnd = SBOP[1] < SBOP[0]//_________________ Short Entry Conditions _________________//MA_Scnd = SMA_sh > low and SMA_sh < highROC_Scnd = sroc > 0DC_Scnd = open > DC_UP_BandBP_Scnd = BP[1] > BP[0] and BP[1] > BP[2]BOP_Scnd = SBOP[1] > SBOP[0]//_________________ OPEN POSITION __________________//if strategy.position_size == 0 strategy.entry(id = "BUY", long = true , when = MA_Lcnd and ROC_Lcnd and DC_Lcnd and BP_Lcnd and BOP_Lcnd) strategy.entry(id = "SELL", long = false , when = MA_Scnd and ROC_Scnd and DC_Scnd and BP_Scnd and BOP_Scnd)//_________________ CLOSE POSITION __________________//strategy.exit(id = "CLOSE BUY", from_entry = "BUY", profit = TP , loss = SL)strategy.exit(id = "CLOSE SELL", from_entry = "SELL" , profit = TP , loss = SL)//_________________ TP and SL Plot __________________//currentPL= strategy.openprofitpos_price = strategy.position_avg_priceopen_pos = strategy.position_sizeTP_line = (strategy.position_size > 0) ? (pos_price + TP/100) : strategy.position_size < 0 ? (pos_price - TP/100) : 0.0SL_line = (strategy.position_size > 0) ? (pos_price - SL/100) : strategy.position_size < 0 ? (pos_price + SL/100) : 0.0// hline(TP_line, title = "Take Profit", color = color.green , linestyle = hline.style_dotted, editable = false)// hline(SL_line, title = "Stop Loss", color = color.red , linestyle = hline.style_dotted, editable = false)Tline = plot(TP_line != 0.0 ? TP_line : na , title="Take Profit", color=color.green, trackprice = true, show_last = 1)Sline = plot(SL_line != 0.0 ? SL_line : na, title="Stop Loss", color=color.red, trackprice = true, show_last = 1)Pline = plot(pos_price != 0.0 ? pos_price : na, title="Stop Loss", color=color.gray, trackprice = true, show_last = 1)fill(Tline , Pline, color = color.new(color.green,transp = 90))fill(Sline , Pline, color = color.new(color.red,transp = 90))//_________________ Alert __________________////alertcondition(condition = , title = "Position Alerts", message = "Bagheri IG Ether\n Symbol: {{ticker}}\n Type: {{strategy.order.id}}")//_________________ Label __________________//inMyPrice = input(title="My Price", type=input.float, defval=0)inLabelStyle = input(title="Label Style", options=["Upper Right", "Lower Right"], defval="Lower Right")posColor = color.new(color.green, 25)negColor = color.new(color.red, 25)dftColor = color.new(color.aqua, 25)posPnL = (strategy.position_size != 0) ? (close * 100 / strategy.position_avg_price - 100) : 0.0posDir = (strategy.position_size > 0) ? "long" : strategy.position_size < 0 ? "short" : "flat"posCol = (strategy.openprofit > 0) ? posColor : (strategy.openprofit < 0) ? negColor : dftColormyPnL = (inMyPrice != 0) ? (close * 100 / inMyPrice - 100) : 0.0var label lb = nalabel.delete(lb)lb := label.new(bar_index, close, color=posCol, style=inLabelStyle=="Lower Right"?label.style_label_upper_left:label.style_label_lower_left, text= "╔═══════╗" +"\n" + "Pos: " +posDir +"\n" + "Pos Price: "+tostring(strategy.position_avg_price) +"\n" + "Pos PnL: " +tostring(posPnL, "0.00") + "%" +"\n" + "Profit: " +tostring(strategy.openprofit, "0.00") + "$" +"\n" + "TP: " +tostring(TP_line, "0.00") +"\n" + "SL: " +tostring(SL_line, "0.00") +"\n" + "╚═══════╝")