Pine Script v5 · Strategy
5 Minute EMA Cross Strategy
A Pine Script v5 strategy built on EMA or SMA or RMA or WMA (close, 20), EMA (hl2, 300) and Lowest (low, 3). It has 6 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 commits 100% of equity and pays 0.05% commission. 16 settings; defaults include Fast Length 20, indent_4+"Type" EMA and indent_4+"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 5 Minute EMA Cross Strategy repaint?
- Yes
- At least one pattern in the source can repaint: intrabar recalculation.
- How did 5 Minute EMA Cross Strategy do on BTCUSDT 1D with default settings?
- +3.43%
- From 26 Jan 2024 to 21 Oct 2026, over 9 closed trades, against +102.5% for buy and hold. A backtest, not investment advice.
- Does 5 Minute EMA Cross Strategy run in Pine Script v6?
- No
- The v6 version runs in Zeal Terminal's engine, but its results differ from the v5 version: Trades differ: 9 before, 14 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 5 Minute EMA Cross Strategy use a stop loss?
- Yes
- strategy.exit sets a stop on line 101, 105.
- Does 5 Minute EMA Cross Strategy run in Zeal Terminal?
- Yes
- It compiles in 32 ms and runs 1,000 bars in 100 ms, in the browser.
BTCUSDT · 1D · default settings
- Fast EMA
- Slow EMA
- Bars Since Entry
- Plot
- Plot
- Short Entry Symbol
- Long Entry Symbol
- Entry
- Winning trade
- Losing trade
- Equity
- Buy and hold
- Net profit
- +3.43%
- $3,432.21
- Buy and hold
- +102.5%
- same period
- Closed trades
- 9
- 5 won · 4 lost
- Profitable
- 55.6%
- of closed trades
- Profit factor
- 1.34
- gross profit ÷ gross loss
- Max drawdown
- 7.52%
- −$8,184.84
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.
-
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 99, 100, 101, 103, 104, 105. 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 |
|---|---|---|---|
| EMA Settings | |||
| Fast Length | 20 | int · min 1 | fast_EMA |
| indent_4+"Type" | EMA | string · options ["EMA", "SMA", "RMA", "WMA"] | fast_EMA |
| indent_4+"Source" | close | source | fast_EMA |
| Slow Length | 100 | int · min 1 | slow_EMA |
| indent_4+"Type" | EMA | string · options ["EMA", "SMA", "RMA", "WMA"] | slow_EMA |
| indent_4+"Source" | close | source | slow_EMA |
| Trade Filters | |||
| Use EMA Filter | false | bool | long_conditions_met short_conditions_met EMA Macro Filter |
| indent_4+"Timeframe" | | timeframe | ema_filter_smoothed |
| indent_4+"Length" | 300 | int · min 1 · step 10 | ema_filter |
| indent_4+"Source" | hl2 | source | ema_filter |
| Entry Settings | |||
| Stop Loss (%) | 2.0 | float · step 0.1 | long_stop_loss short_stop_loss |
| Take Profit (%) | 2.0 | float · step 0.1 | long_profit_target short_profit_target |
| Long Entry Limit Lookback | 3 | int · min 1 · step 1 | limit_order_long_price |
| Short Entry Limit Lookback | 3 | int · min 1 · step 1 | limit_order_short_price |
| Start Trailing After (%) | 1 | float · step 0.1 | long_start_trailing_val short_start_trailing_val |
| Trail Behind (%) | 1 | float · step 0.1 | long_trail_behind_val short_trail_behind_val long_trailing_stop short_trailing_stop |
What it calculates
- EMA / SMA / RMA / WMAindent_4+"Source" (close), Fast Length (20) · chosen by indent_4+"Type"
fast_EMA · line 31 - EMA / SMA / RMA / WMAindent_4+"Source" (close), Slow Length (100) · chosen by indent_4+"Type"
slow_EMA · line 41 - EMAindent_4+"Source" (hl2), indent_4+"Length" (300)
ema_filter · line 53 - Lowestlow, Long Entry Limit Lookback (3)
limit_order_long_price · line 61 - Highesthigh, Short Entry Limit Lookback (3)
limit_order_short_price · line 62 - Highesthigh, bars_since_entry
long_run_up · line 77 - Lowestlow, bars_since_entry
short_run_up · line 81 - Crossunderfast_EMA, slow_EMA
fast_EMA_cross_down_slow_EMA · line 86 - Crossoverfast_EMA, slow_EMA
fast_EMA_cross_up_slow_EMA · line 87
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 | long_conditions_met | On | 99 |
| cancel Cancel Long | ta.crossover(fast_EMA,slow_EMA) | On | 100 |
| Exit Close Long stop and limit | long_position_take_profitta.cross(close, long_trailing_stop) or close > long_profit_target | On | 101 |
| Open Short short | short_conditions_met | On | 103 |
| cancel Cancel Short | ta.crossunder(fast_EMA,slow_EMA) | On | 104 |
| Exit Close Short stop and limit | short_position_take_profitta.cross(close, short_trailing_stop) or close > short_profit_target | On | 105 |
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 data1 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
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 | +3.4% | +102.5% | 9 | 56% | 1.34 | 7.5% | 26 Jan 2024 – 21 Oct 2026 |
| BTCUSDT 4h | −0.9% | +5.5% | 6 | 33% | 0.66 | 3.2% | 8 May 2026 – 21 Oct 2026 |
| ETHUSDT 1D | +14.6% | +9.8% | 4 | 75% | 132.44 | 37.5% | 26 Jan 2024 – 21 Oct 2026 |
| ETHUSDT 4h | +1.7% | +8.4% | 5 | 60% | 1.72 | 3.6% | 8 May 2026 – 21 Oct 2026 |
| SOLUSDT 1D | +9.2% | +16.7% | 9 | 56% | 2.07 | 31.9% | 26 Jan 2024 – 21 Oct 2026 |
| SOLUSDT 4h | +7.1% | +21.5% | 10 | 70% | 2.97 | 6.7% | 8 May 2026 – 21 Oct 2026 |
| BNBUSDT 1D | +4.2% | +148.3% | 7 | 57% | 1.59 | 8.6% | 26 Jan 2024 – 21 Oct 2026 |
| BNBUSDT 4h | +1.9% | +17.1% | 3 | 67% | 11.05 | 18.2% | 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 | 8 | 63% | $3,535.02 |
| Falling market | 1 | 0% | −$102.81 |
Rising and falling mean the market moved more than 15% over the 90 bars before entry.
How bad could the drawdown be?
9.0%
The 95th percentile of the worst drawdown when the same 9 trades are reshuffled 5,000 times. The bar spans the 5th to 95th percentile, 5.5% to 9.0%; the tick is what actually happened, 5.5%. Order luck alone moves it this much.
All 9 trades
| Side | Entry | Exit | Bars | P&L |
|---|---|---|---|---|
| short | 30 Jun 2024 62,389.20 | 1 Jul 2024 62,772.00 | 1 | −$713.50 |
| long | 23 Jul 2024 65,777.00 | 27 Jul 2024 67,908.00 | 4 | $3,114.17 |
| short | 8 Aug 2024 62,198.20 | 9 Aug 2024 61,686.00 | 1 | $740.95 |
| long | 1 Oct 2024 62,538.80 | 15 Oct 2024 66,084.00 | 14 | $5,738.05 |
| short | 2 Mar 2025 89,414.10 | 3 Mar 2025 94,270.00 | 1 | −$6,021.78 |
| short | 21 Oct 2025 111,706.00 | 24 Oct 2025 110,078.00 | 3 | $1,395.67 |
| long | 17 Nov 2025 91,660.00 | 17 Nov 2025 91,660.00 | 0 | −$102.81 |
| long | 23 May 2026 74,937.50 | 24 May 2026 76,752.00 | 1 | $2,415.21 |
| short | 21 Aug 2026 76,174.10 | 22 Aug 2026 78,338.00 | 1 | −$3,133.73 |
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 |
|---|---|---|---|---|---|
| 5 Minute EMA Cross Strategy this page | — | v5 strategy | +3.4% | 9 | 7.5% |
| SPX Scalping Strategy by connor2279 | sma ema lowest wma rma cross | v5 strategy | +1.5% | 109 | 5.0% |
| MACD Willy Strategy by PtGambler | rma sma ema highest lowest wma | v5 strategy | No trades on this market | ||
| VuManChu Cipher B + Divergences Strategy by nattichai001 | ema cross lowest highest sma rma wma | v4 strategy | +76.6% | 175 | 18.4% |
| Bagheri IG Ether by Bagheri_IG | ema highest lowest rma sma | v4 strategy | +0.0% | 3 | 0.0% |
| Bagheri IG Ether v2 by Bagheri_IG | ema highest lowest rma sma | v4 strategy | −0.0% | 2 | 0.0% |
Upgrade and export
Written in Pine Script v5. The clean-v5 step types the settings and moves when = into if blocks, which v6 requires; it is run before and after like any upgrade.
- 6 strategy calls use the when = argument (line 99, 100, 101, 103, 104, 105). It is deprecated in v5 and removed in v6, where each call moves inside an if block.
- No v6-only features. v6 is not needed to run this script.
Same 9 trades and the same P&L on BTCUSDT 1D, 1,000 bars, in Zeal Terminal's engine.
- Line 99: when = long_conditions_met → if block
- Line 100: when = ta.crossover(fast_EMA,slow_EMA) → if block
- Line 101: when = long_position_take_profit → if block
- Line 103: when = short_conditions_met → if block
- Line 104: when = ta.crossunder(fast_EMA,slow_EMA) → if block
- Line 105: when = short_position_take_profit → if block
⋯// Long Entry-strategy.entry(id="Long", direction=strategy.long, limit=limit_order_long_price, when=long_conditions_met)+if long_conditions_met+ strategy.entry(id="Long", direction=strategy.long, limit=limit_order_long_price)-strategy.cancel(id="Cancel Long", when=ta.crossover(fast_EMA,slow_EMA))+if ta.crossover(fast_EMA,slow_EMA)+ strategy.cancel(id="Cancel Long")-strategy.exit(id="Close Long", from_entry="Long", stop=long_trailing_stop, limit=long_profit_target, when=long_position_take_profit)+if long_position_take_profit+ strategy.exit(id="Close Long", from_entry="Long", stop=long_trailing_stop, limit=long_profit_target)// Short Entry -strategy.entry(id="Short", direction=strategy.short, limit=limit_order_short_price, when=short_conditions_met)+if short_conditions_met+ strategy.entry(id="Short", direction=strategy.short, limit=limit_order_short_price)-strategy.cancel(id="Cancel Short", when=ta.crossunder(fast_EMA,slow_EMA))+if ta.crossunder(fast_EMA,slow_EMA)+ strategy.cancel(id="Cancel Short")-strategy.exit(id="Close Short", from_entry="Short", stop=short_trailing_stop, limit=short_profit_target, when=short_position_take_profit)+if short_position_take_profit+ strategy.exit(id="Close Short", from_entry="Short", stop=short_trailing_stop, limit=short_profit_target)entry = plot(strategy.position_avg_price, editable=false, title="Entry", style=plot.style_stepline, color=currently_in_a_long_postion or currently_in_a_short_postion ? color.blue : transparent, linewidth=1)⋯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: 9 before, 14 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.
⋯// © jordanfray-//@version=5+//@version=6strategy(title="5 Minute EMA Strategy", overlay=true, max_bars_back=5000, default_qty_type=strategy.percent_of_equity, default_qty_value=100,initial_capital=100000, commission_type=strategy.commission.percent, commission_value=0.05, backtest_fill_limits_assumption=2)⋯Where it runs
| Engine | Compiles | Runs | Matches TradingView |
|---|---|---|---|
| Zeal Terminal · OpenPineScript v2 | Yes 32 ms | With a workaround 1,000 bars in 100 ms | Not measured |
| PineTS | Not tested | Not tested | Not measured |
Zeal Terminal's engine currently reads an order side written as direction = strategy.long, direction = strategy.short as a short, whatever it says; this page passes the same side as strategy.long or strategy.short (lines 99, 103) 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.
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/// © jordanfray//@version=5strategy(title="5 Minute EMA Strategy", overlay=true, max_bars_back=5000, default_qty_type=strategy.percent_of_equity, default_qty_value=100,initial_capital=100000, commission_type=strategy.commission.percent, commission_value=0.05, backtest_fill_limits_assumption=2)max_bars_back(time, 5000)// Indenting Classsindent_1 = " "indent_2 = " "indent_3 = " "indent_4 = " "// Group Titlesgroup_one_title = "EMA Settings"group_two_title = "Entry Settings"group_three_title = "Trade Filters"// Input Tipsocean_blue = color.new(#0C6090,0)sky_blue = color.new(#00A5FF,0)green = color.new(#2DBD85,0)red = color.new(#E02A4A,0)light_blue = color.new(#00A5FF,85)light_green = color.new(#2DBD85,85)light_red = color.new(#E02A4A,85)light_yellow = color.new(#FFF900,85)white = color.new(#ffffff,0)light_gray = color.new(#000000,70)transparent = color.new(#000000,100)// Strategy Settings - EMAfast_EMA_length = input.int(defval=20, minval=1, title="Fast Length", group=group_one_title)fast_EMA_type = input.string(defval="EMA", options = ["EMA", "SMA", "RMA", "WMA"], title=indent_4+"Type", group=group_one_title)fast_EMA_source = input.source(defval=close, title=indent_4+"Source", group=group_one_title)fast_EMA = switch fast_EMA_type "EMA" => ta.ema(fast_EMA_source, fast_EMA_length) "SMA" => ta.sma(fast_EMA_source, fast_EMA_length) "RMA" => ta.rma(fast_EMA_source, fast_EMA_length) "WMA" => ta.wma(fast_EMA_source, fast_EMA_length) => naplot(fast_EMA, title="Fast EMA", linewidth=1, color=green, editable=true)slow_EMA_length = input.int(defval=100, minval=1, title="Slow Length", group=group_one_title)slow_EMA_type = input.string(defval="EMA", options = ["EMA", "SMA", "RMA", "WMA"], title=indent_4+"Type", group=group_one_title)slow_EMA_source = input.source(defval=close, title=indent_4+"Source", group=group_one_title)slow_EMA = switch slow_EMA_type "EMA" => ta.ema(slow_EMA_source, slow_EMA_length) "SMA" => ta.sma(slow_EMA_source, slow_EMA_length) "RMA" => ta.rma(slow_EMA_source, slow_EMA_length) "WMA" => ta.wma(slow_EMA_source, slow_EMA_length) => naplot(slow_EMA, title="Slow EMA", linewidth=1, color=sky_blue, editable=true)// EMA Macro Filterenable_EMA_filter = input.bool(defval=false, title="Use EMA Filter", group=group_three_title)EMA_filter_timeframe = input.timeframe(defval="", title=indent_4+"Timeframe", group=group_three_title)EMA_filter_length = input.int(defval=300, minval=1, step=10, title=indent_4+"Length", group=group_three_title)EMA_filter_source = input.source(defval=hl2, title=indent_4+"Source", group=group_three_title)ema_filter = ta.ema(EMA_filter_source, EMA_filter_length)ema_filter_smoothed = request.security(syminfo.tickerid, EMA_filter_timeframe, ema_filter[barstate.isrealtime ? 1 : 0], gaps=barmerge.gaps_on)plot(enable_EMA_filter ? ema_filter_smoothed: na, title="EMA Macro Filter", linewidth=2, color=white, editable=true)// Entry Settingsstop_loss_val = input.float(defval=2.0, title="Stop Loss (%)", step=0.1, group=group_two_title)/100take_profit_val = input.float(defval=2.0, title="Take Profit (%)", step=0.1, group=group_two_title)/100long_entry_limit_lookback = input.int(defval=3, title="Long Entry Limit Lookback", minval=1, step=1, group=group_two_title)short_entry_limit_lookback = input.int(defval=3, title="Short Entry Limit Lookback", minval=1, step=1, group=group_two_title)limit_order_long_price = ta.lowest(low, long_entry_limit_lookback)limit_order_short_price = ta.highest(high, short_entry_limit_lookback)start_trailing_after = input.float(defval=1, title="Start Trailing After (%)", step=0.1, group=group_two_title)/100trail_behind = input.float(defval=1, title="Trail Behind (%)", step=0.1, group=group_two_title)/100long_start_trailing_val = strategy.position_avg_price + (strategy.position_avg_price * start_trailing_after)short_start_trailing_val = strategy.position_avg_price - (strategy.position_avg_price * start_trailing_after)long_trail_behind_val = close - (strategy.position_avg_price * (trail_behind/100))short_trail_behind_val = close + (strategy.position_avg_price * (trail_behind/100))currently_in_a_long_postion = strategy.position_size > 0currently_in_a_short_postion = strategy.position_size < 0long_profit_target = strategy.position_avg_price * (1 + take_profit_val)long_stop_loss = strategy.position_avg_price * (1.0 - stop_loss_val)short_profit_target = strategy.position_avg_price * (1 - take_profit_val)short_stop_loss = strategy.position_avg_price * (1 + stop_loss_val)bars_since_entry = currently_in_a_long_postion or currently_in_a_short_postion ? bar_index - strategy.opentrades.entry_bar_index(strategy.opentrades - 1) + 1 : 5plot(bars_since_entry, editable=false, title="Bars Since Entry", color=green)long_run_up = ta.highest(high, bars_since_entry)long_trailing_stop = currently_in_a_long_postion and bars_since_entry > 0 and long_run_up > long_start_trailing_val ? long_run_up - (long_run_up * trail_behind) : long_stop_loss// long_run_up_line = plot(long_run_up, style=plot.style_stepline, editable=false, color=currently_in_a_long_postion ? green : transparent)long_trailing_stop_line = plot(long_trailing_stop, style=plot.style_stepline, editable=false, color=currently_in_a_long_postion ? long_trailing_stop > strategy.position_avg_price ? green : red : transparent)short_run_up = ta.lowest(low, bars_since_entry)short_trailing_stop = currently_in_a_short_postion and bars_since_entry > 0 and short_run_up < short_start_trailing_val ? short_run_up + (short_run_up * trail_behind) : short_stop_loss// short_run_up_line = plot(short_run_up, style=plot.style_stepline, editable=false, color=currently_in_a_short_postion ? green : transparent)short_trailing_stop_line = plot(short_trailing_stop, style=plot.style_stepline, editable=false, color=currently_in_a_short_postion ? short_trailing_stop < strategy.position_avg_price ? green : red : transparent)// Trade Conditionsfast_EMA_cross_down_slow_EMA = ta.crossunder(fast_EMA,slow_EMA)fast_EMA_cross_up_slow_EMA = ta.crossover(fast_EMA,slow_EMA)plotshape(fast_EMA_cross_down_slow_EMA ? close : na, title="Short Entry Symbol", color=red, style=shape.triangledown, location=location.belowbar)plotshape(fast_EMA_cross_up_slow_EMA ? close : na, title="Long Entry Symbol", color=green, style=shape.triangleup, location=location.abovebar)fast_EMA_is_above_slow_EMA = fast_EMA > slow_EMAfast_EMA_is_below_slow_EMA = fast_EMA < slow_EMAema_macro_filter_longs_only = fast_EMA > ema_filter_smoothed and slow_EMA > ema_filter_smoothedema_macro_filter_shorts_only = fast_EMA < ema_filter_smoothed and slow_EMA < ema_filter_smoothedlong_position_take_profit = ta.cross(close, long_trailing_stop) or close > long_profit_targetshort_position_take_profit = ta.cross(close, short_trailing_stop) or close > short_profit_targetlong_conditions_met = enable_EMA_filter ? ema_macro_filter_longs_only and fast_EMA_cross_up_slow_EMA and fast_EMA_is_above_slow_EMA and not currently_in_a_short_postion : fast_EMA_cross_up_slow_EMA and not currently_in_a_short_postionshort_conditions_met = enable_EMA_filter ? ema_macro_filter_shorts_only and fast_EMA_cross_down_slow_EMA and fast_EMA_is_below_slow_EMA and not currently_in_a_long_postion : fast_EMA_cross_down_slow_EMA and fast_EMA_is_below_slow_EMA and not currently_in_a_long_postion// Long Entrystrategy.entry(id="Long", direction=strategy.long, limit=limit_order_long_price, when=long_conditions_met)strategy.cancel(id="Cancel Long", when=ta.crossover(fast_EMA,slow_EMA))strategy.exit(id="Close Long", from_entry="Long", stop=long_trailing_stop, limit=long_profit_target, when=long_position_take_profit)// Short Entry strategy.entry(id="Short", direction=strategy.short, limit=limit_order_short_price, when=short_conditions_met)strategy.cancel(id="Cancel Short", when=ta.crossunder(fast_EMA,slow_EMA))strategy.exit(id="Close Short", from_entry="Short", stop=short_trailing_stop, limit=short_profit_target, when=short_position_take_profit)entry = plot(strategy.position_avg_price, editable=false, title="Entry", style=plot.style_stepline, color=currently_in_a_long_postion or currently_in_a_short_postion ? color.blue : transparent, linewidth=1)fill(entry,long_trailing_stop_line, editable=false, color=currently_in_a_long_postion ? long_trailing_stop > strategy.position_avg_price ? light_green : light_red : transparent)fill(entry,short_trailing_stop_line, editable=false, color=currently_in_a_short_postion ? short_trailing_stop < strategy.position_avg_price ? light_green : light_red : transparent)//ltp = plot(currently_in_a_long_postion ? long_profit_target : na, style=plot.style_stepline, title="Take Profit", color=currently_in_a_long_postion ? green : transparent, linewidth=1)//lsl = plot(currently_in_a_long_postion ? long_stop_loss : na, style=plot.style_stepline, title="Take Profit", color=currently_in_a_long_postion ? red : transparent, linewidth=1)//fill(entry,ltp, color= currently_in_a_long_postion ? light_green : light_red)//fill(entry,lsl, color= currently_in_a_long_postion ? light_red : light_green)//stp = plot(currently_in_a_short_postion ? short_profit_target : na, style=plot.style_stepline, title="Take Profit", color=currently_in_a_short_postion ? green : transparent, linewidth=1)//ssl = plot(currently_in_a_short_postion ? short_stop_loss : na, style=plot.style_stepline, title="Take Profit", color=currently_in_a_short_postion ? red : transparent, linewidth=1)//fill(entry,stp, color= currently_in_a_short_postion ? light_green : light_red)//fill(entry,ssl, color= currently_in_a_short_postion ? light_red : light_green)