Zeal Terminal Open in Zeal Terminal

Pine Script v4 · Strategy

[EURUSD60] BB Expansion Strategy

A Pine Script v4 strategy built on SMA (close[index], 40), Stdev (close[index], 40) and EMA (close[index], 14). It has 8 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 Large BB Length 40, Small BB Length 20 and BB StdDev 2.0.

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 [EURUSD60] BB Expansion Strategy repaint?
No
No repainting patterns were found in the source. The live replay was not measured: it had no trades to compare.
How did [EURUSD60] BB Expansion Strategy do on BTCUSDT 1D with default settings?
Not measured
It closed no trades there from 26 Jan 2024 to 21 Oct 2026 with the default settings, so there is no result to report. Its entry conditions never all held on this data. On BTCUSDT 4h it did trade; that row of the markets table below has its figures. A backtest, not investment advice.
Can [EURUSD60] BB Expansion Strategy be converted to Pine Script v5?
Yes
The upgrade takes 1 step, from v4; each was run before and after on the same candles with identical results, and the v5 script can be downloaded below.
Does [EURUSD60] BB Expansion Strategy use a stop loss?
Yes
strategy.exit sets a stop on line 113, 117.
Does [EURUSD60] BB Expansion Strategy run in Zeal Terminal?
Yes
It compiles in 37 ms and runs 1,000 bars in 113 ms, in the browser.

BTCUSDT · 1D · default settings

  • Large BB Basis
  • Large BB Upper
  • Large BB Lower
  • Small BB Basis
  • Small BB Upper
  • Small BB Lower
  • Winning trade
  • Losing trade
  • Equity
  • Buy and hold
40,00060,00080,000100,000120,000AprJulOct2025AprJulOct2026AprJulOct$100,000$202,527Equity from $100,000
Binance BTCUSDT 1D candles, 26 Jan 2024 to 21 Oct 2026, 1,000 bars, default settings. Triangles mark entries; circles mark exits. Lines are what the script plots. The live re-run is not offered here: the script requests BINANCE:BTCUSDT 240, which this page cannot load in your browser.

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
0.00%
$0.00
Buy and hold
+102.5%
same period
Closed trades
0
0 won · 0 lost
Profitable
0.0%
of closed trades
Profit factor
—
gross profit ÷ gross loss
Max drawdown
0.00%
$0.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.

  • 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 121, 123, 125, 127. The upgraded version below moves each call inside an if block.

Upgrade and export

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

  • Upgrading to v5 renames security → request.security, sma → ta.sma, stdev → ta.stdev, ema → ta.ema, atr → ta.atr, round → math.round.
  • 4 strategy calls use the when = argument (line 121, 123, 125, 127). It is deprecated in v5 and removed in v6, where each call moves inside an if block.

v4 → v5

Verified

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

  • Line 3: //@version=4 → //@version=5
  • Line 7: input(type = input.resolution) → input.timeframe()
  • Line 8: input(type = input.integer) → input.int()
  • Line 9: input(type = input.resolution) → input.timeframe()
  • Line 10: input(type = input.integer) → input.int()
  • Line 11: input(type = input.float) → input.float()
20 more edits
  • Line 14: input(type = input.resolution) → input.timeframe()
  • Line 23: input(type = input.float) → input.float()
  • Line 24: input(type = input.float) → input.float()
  • Line 25: input(type = input.float) → input.float()
  • Line 26: input(type = input.float) → input.float()
  • Line 60: security → request.security
  • Line 60: sma → ta.sma
  • Line 61: security → request.security
  • Line 61: stdev → ta.stdev
  • Line 65: security → request.security
  • Line 65: sma → ta.sma
  • Line 66: security → request.security
  • Line 66: stdev → ta.stdev
  • Line 71: security → request.security
  • Line 71: ema → ta.ema
  • Line 72: security → request.security
  • Line 72: ema → ta.ema
  • Line 79: atr → ta.atr
  • Line 81: round → math.round
  • Line 82: round → math.round
⋯// © kasaism-//@version=4+//@version=5strategy(title="[EURUSD60] BB Expansion Strategy", shorttitle="[EURUSD60] BBEXP",overlay=true, max_bars_back=5000, max_labels_count=500)⋯////BB-largeBbRes = input(title="Large BB Resolution", type=input.resolution, defval="", group="BB")+largeBbRes = input.timeframe(title="Large BB Resolution", defval="", group="BB")-largeBbLength = input(title="Large BB Length", type=input.integer, defval=40, minval=1, group="BB")+largeBbLength = input.int(title="Large BB Length", defval=40, minval=1, group="BB")-smallBbRes = input(title="Small BB Resolution ", type=input.resolution, defval="", group="BB")+smallBbRes = input.timeframe(title="Small BB Resolution ", defval="", group="BB")-smallBbLength = input(title="Small BB Length", type=input.integer, defval=20, minval=1, group="BB")+smallBbLength = input.int(title="Small BB Length", defval=20, minval=1, group="BB")-multi = input(title="BB StdDev", type=input.float, defval=2.0, maxval=10, minval=0.01, group="BB")+multi = input.float(title="BB StdDev", defval=2.0, maxval=10, minval=0.01, group="BB")validLen = input(title="BB expand valid length", defval=14, group="BB")// 3 each EMA settings. EMA directions are as each time frame directions. -resFirstTime = input(title="EMA Trend t/f", type=input.resolution, defval="240", group="SMT")+resFirstTime = input.timeframe(title="EMA Trend t/f", defval="240", group="SMT")// resSecondTime = input(title="Second t/f", type=input.resolution, defval="30", group="SMT") ⋯riskManagementRule = input(riskManagementRule1, "Detect Risk Management Based On", options=[riskManagementRule1, riskManagementRule2, "No detection"], group="Trade")-atrMulti = input(3.0, title="ATR Multiple", type=input.float, minval = 1.0, group="ATR")+atrMulti = input.float(3.0, title="ATR Multiple", minval = 1.0, group="ATR")-riskRewardRatio = input(1.5, title="Risk Reward Ratio for ATR", type=input.float, minval = 0.01, group="ATR")+riskRewardRatio = input.float(1.5, title="Risk Reward Ratio for ATR", minval = 0.01, group="ATR")-stopLossPoint = input(100, title="Stop Loss Point for Braket(tick)", type=input.float, minval = 1.0, group="Bracket")+stopLossPoint = input.float(100, title="Stop Loss Point for Braket(tick)", minval = 1.0, group="Bracket")-takeProfitPoint = input(200, title="Take Profit Point for Braket(tick)", type=input.float, minval = 1.0, group="Bracket")+takeProfitPoint = input.float(200, title="Take Profit Point for Braket(tick)", minval = 1.0, group="Bracket")// === /INPUTS/ === //⋯//large BB-lrgBbBasis = security(syminfo.tickerid, largeBbRes, sma(close[index], largeBbLength))+lrgBbBasis = request.security(syminfo.tickerid, largeBbRes, ta.sma(close[index], largeBbLength))-lrgBbDev = multi * security(syminfo.tickerid, largeBbRes, stdev(close[index], largeBbLength))+lrgBbDev = multi * request.security(syminfo.tickerid, largeBbRes, ta.stdev(close[index], largeBbLength))lrgBbUpper = lrgBbBasis + lrgBbDev⋯//small BB-smlBbBasis = security(syminfo.tickerid, smallBbRes, sma(close[index], smallBbLength))+smlBbBasis = request.security(syminfo.tickerid, smallBbRes, ta.sma(close[index], smallBbLength))-smlBbDev = multi * security(syminfo.tickerid, smallBbRes, stdev(close[index], smallBbLength))+smlBbDev = multi * request.security(syminfo.tickerid, smallBbRes, ta.stdev(close[index], smallBbLength))smlBbUpper = smlBbBasis + smlBbDev⋯//EMA Trend-base=security(syminfo.tickerid, resFirstTime, ema(close[index],emaLen))+base=request.security(syminfo.tickerid, resFirstTime, ta.ema(close[index],emaLen))-sig=security(syminfo.tickerid, resFirstTime, ema(base[index],smooth))+sig=request.security(syminfo.tickerid, resFirstTime, ta.ema(base[index],smooth))emaTrend = not(na(base) or na(sig)) ? base < sig ? dn : up : na⋯float takeProfitLineForShort = na-atr_ = atr(14) * atrMulti+atr_ = ta.atr(14) * atrMultiif riskManagementRule == riskManagementRule1-    stopLossLineForLong := strategy.position_size > 0 ? stopLossLineForLong[1] ? stopLossLineForLong[1] : round(close[index] - atr_,3) : na+    stopLossLineForLong := strategy.position_size > 0 ? stopLossLineForLong[1] ? stopLossLineForLong[1] : math.round(close[index] - atr_,3) : na-    stopLossLineForShort := strategy.position_size < 0 ? stopLossLineForShort[1] ? stopLossLineForShort[1] : round(close[index] + atr_,3) : na+    stopLossLineForShort := strategy.position_size < 0 ? stopLossLineForShort[1] ? stopLossLineForShort[1] : math.round(close[index] + atr_,3) : na    takeProfitLineForLong := strategy.position_size > 0 ? takeProfitLineForLong[1] ? takeProfitLineForLong[1] : close[index] + atr_*riskRewardRatio : na⋯

Clean v5

VerifiedDownload the v5 script

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

  • Line 12: input() → input.int()
  • Line 17: input() → input.int()
  • Line 18: input() → input.int()
  • Line 121: when = isAtrLongStop → if block
  • Line 123: when = isAtrShortStop → if block
  • Line 125: when = isAtrLongLimit → if block
  • Line 127: when = isAtrShortLimit → if block
⋯multi = input.float(title="BB StdDev", defval=2.0, maxval=10, minval=0.01, group="BB")-validLen = input(title="BB expand valid length", defval=14, group="BB")+validLen = input.int(title="BB expand valid length", defval=14, group="BB")// 3 each EMA settings. EMA directions are as each time frame directions. ⋯// resThirdTime = input(title="Third t/f", type=input.resolution, defval="", group="SMT")-emaLen = input(14, minval=1, title="Length", group="SMT") +emaLen = input.int(14, minval=1, title="Length", group="SMT") -smooth = input(3, minval=1, title="Smooth factor", group="SMT")+smooth = input.int(3, minval=1, title="Smooth factor", group="SMT")//Lisk Management⋯    if(isAtrLongStop)-        strategy.close("LongEntry", when=isAtrLongStop, comment="ATR Stop")+        if isAtrLongStop+            strategy.close("LongEntry", comment="ATR Stop")    if(isAtrShortStop)-        strategy.close("ShortEntry", when=isAtrShortStop, comment="ATR Stop")+        if isAtrShortStop+            strategy.close("ShortEntry", comment="ATR Stop")    if(isAtrLongLimit)-        strategy.close("LongEntry", when=isAtrLongLimit, comment="ATR Limit")+        if isAtrLongLimit+            strategy.close("LongEntry", comment="ATR Limit")    if(isAtrShortLimit)-        strategy.close("ShortEntry", when=isAtrShortLimit, comment="ATR Limit")+        if isAtrShortLimit+            strategy.close("ShortEntry", comment="ATR Limit")//  === /TRADE/ === //⋯

Does it run in Pine Script v6?

No

The v6 version does not run in Zeal Terminal's engine: Pine Script v6 Error at @L81:C56: cannot use 'float' as a condition — Pine Script v6 does not cast 'int' or 'float' to 'bool' implicitly. Wrap it in bool(). The v6 version is shown for reference and is not offered as a download. It differs from the v5 version by 1 edit.

⋯// © kasaism-//@version=5+//@version=6strategy(title="[EURUSD60] BB Expansion Strategy", shorttitle="[EURUSD60] BBEXP",overlay=true, max_bars_back=5000, max_labels_count=500)⋯

Settings

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

SettingDefaultType and rangeFeeds
BB
Large BB Resolutiontimeframe (written input.resolution)lrgBbBasis lrgBbDev
Large BB Length40int (written input.integer) · min 1lrgBbBasis lrgBbDev
Small BB Resolution timeframe (written input.resolution)smlBbBasis smlBbDev
Small BB Length20int (written input.integer) · min 1smlBbBasis smlBbDev
BB StdDev2.0float · min 0.01 · max 10lrgBbDev smlBbDev
BB expand valid length14intline 94
SMT
EMA Trend t/f240timeframe (written input.resolution)base sig
Length14int · min 1base
Smooth factor3int · min 1sig
Trade
Detect Risk Management Based OnriskManagementRule1value · options [riskManagementRule1, riskManagementRule2, "No detection"]exit LongEntry exit ShortEntry line 80 line 85 line 112 line 116 line 119
ATR
ATR Multiple3.0float · min 1.0atr_
Risk Reward Ratio for ATR1.5float · min 0.01takeProfitLineForLong takeProfitLineForShort
Bracket
Stop Loss Point for Braket(tick)100float · min 1.0stopLossLineForLong stopLossLineForShort exit LongEntry exit ShortEntry
Take Profit Point for Braket(tick)200float · min 1.0takeProfitLineForLong takeProfitLineForShort exit LongEntry exit ShortEntry

What it calculates

  • SMA (sma, ta.sma in v5)close[index], Large BB Length (40)lrgBbBasis · line 60
  • Stdev (stdev, ta.stdev in v5)close[index], Large BB Length (40)lrgBbDev · line 61
  • SMA (sma, ta.sma in v5)close[index], Small BB Length (20)smlBbBasis · line 65
  • Stdev (stdev, ta.stdev in v5)close[index], Small BB Length (20)smlBbDev · line 66
  • EMA (ema, ta.ema in v5)close[index], Length (14)base · line 71
  • EMA (ema, ta.ema in v5)base[index], Smooth factor (3)sig · line 72
  • ATR (atr, ta.atr in v5)14atr_ · line 79

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

OrderFires whenBy defaultLine
Open LongEntry long(isBbLong and isEmaLong)On111
Exit LongEntry stop and limitriskManagementRule == riskManagementRule2On113
Open ShortEntry short(isBbShort and isEmaShort)On115
Exit ShortEntry stop and limitriskManagementRule == riskManagementRule2On117
Close LongEntryisAtrLongStoplow[index] <= stopLossLineForLongOn121
Close ShortEntryisAtrShortStophigh[index] >= stopLossLineForShortOn123
Close LongEntryisAtrLongLimithigh[index] >= takeProfitLineForLongOn125
Close ShortEntryisAtrShortLimitlow[index] <= takeProfitLineForShortOn127

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.

Not measuredNo trades to compareThe last 300 bars, from 26 Dec 2025, were fed to the engine as live ticks, but neither the live nor the historical run produced any trades in them, so the replay says nothing either way.
  • ClearHigher-timeframe data6 security call(s), none with lookahead on.
  • 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

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.

Similar scripts

Indicators and strategies built from the same calculations, run on BTCUSDT 1D with their own defaults so they can be compared directly.

ScriptSharesTypeNetTradesMax drawdown
[EURUSD60] BB Expansion Strategy this page—v4 strategy0.0%00.0%
Trend Following with Bollinger Bands by Robrecht99sma stdev ema atrv5 strategy+2.5%71.7%
[KL] BOLL + MACD Strategy v2 (published) by DojiEmojisma stdev ema atrv4 strategy−32.1%2854.0%
[KL] Bollinger bands + RSI Strategy by DojiEmojisma stdev atr emav4 strategy+28.2%3014.7%
[KL] Bollinger Bands Consolidation Strategy by DojiEmojisma stdev atr emav4 strategy+39.1%3319.6%
Full strategy AllinOne with risk management MACD RSI PSAR ATR MA by SoftKill21sma stdev ema atrv4 strategy+2,985,110.0%32,350,820.0%

Where it runs

EngineCompilesRunsMatches TradingView
Zeal Terminal · OpenPineScript v2Yes 37 msYes 1,000 bars in 113 msNot measured
PineTSNo v5 and v6 only—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. 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/// © kasaism//@version=4strategy(title="[EURUSD60] BB Expansion Strategy", shorttitle="[EURUSD60] BBEXP",overlay=true, max_bars_back=5000, max_labels_count=500)// === INPUTS === //////BBlargeBbRes = input(title="Large BB Resolution", type=input.resolution, defval="", group="BB")largeBbLength = input(title="Large BB Length", type=input.integer, defval=40, minval=1, group="BB")smallBbRes = input(title="Small BB Resolution ", type=input.resolution, defval="", group="BB")smallBbLength = input(title="Small BB Length", type=input.integer, defval=20, minval=1, group="BB")multi = input(title="BB StdDev", type=input.float, defval=2.0, maxval=10, minval=0.01, group="BB")validLen = input(title="BB expand valid length", defval=14, group="BB")// 3 each EMA settings. EMA directions are as each time frame directions. resFirstTime = input(title="EMA Trend t/f", type=input.resolution, defval="240", group="SMT")// resSecondTime = input(title="Second t/f", type=input.resolution, defval="30", group="SMT") // resThirdTime = input(title="Third t/f", type=input.resolution, defval="", group="SMT")emaLen = input(14, minval=1, title="Length", group="SMT") smooth = input(3, minval=1, title="Smooth factor", group="SMT")//Lisk Managementvar riskManagementRule1 = "ATR"var riskManagementRule2 = "Bracket"riskManagementRule = input(riskManagementRule1, "Detect Risk Management Based On", options=[riskManagementRule1, riskManagementRule2, "No detection"], group="Trade")atrMulti = input(3.0, title="ATR Multiple", type=input.float, minval = 1.0, group="ATR")riskRewardRatio = input(1.5, title="Risk Reward Ratio for ATR", type=input.float, minval = 0.01, group="ATR")stopLossPoint = input(100, title="Stop Loss Point for Braket(tick)", type=input.float, minval = 1.0, group="Bracket")takeProfitPoint = input(200, title="Take Profit Point for Braket(tick)", type=input.float, minval = 1.0, group="Bracket")// === /INPUTS/ === //// === CONSTANT === ////For barmerge.lookahead_offindex = barstate.isrealtime ? 1 : 0//For EntryNOENTRY=0LONG=1SHORT=2//SMT colorint up=1int dn=2int up_HL=3int dn_HL=4//label colorcolor_bearish = color.redcolor_bullish = color.blueC_label_color_bearish = color.redC_label_color_bullish = color.blue// === /CONSTANT/ === //// === FUNCTIONS === ////BB trade directionbbTradeDetection(lrgUpper, lrgLower, smlUpper, smlLower) =>    if not(na(lrgUpper) or na(lrgLower) or na(smlUpper) or na(smlLower))        if lrgUpper < smlUpper and lrgLower > smlLower            true        else            false    else        na// === /FUNCTIONS/ === //// === CALCURATES === //////BB//large BBlrgBbBasis = security(syminfo.tickerid, largeBbRes, sma(close[index], largeBbLength))lrgBbDev = multi * security(syminfo.tickerid, largeBbRes, stdev(close[index], largeBbLength))lrgBbUpper = lrgBbBasis + lrgBbDevlrgBbLower = lrgBbBasis - lrgBbDev//small BBsmlBbBasis = security(syminfo.tickerid, smallBbRes, sma(close[index], smallBbLength))smlBbDev = multi * security(syminfo.tickerid, smallBbRes, stdev(close[index], smallBbLength))smlBbUpper = smlBbBasis + smlBbDevsmlBbLower = smlBbBasis - smlBbDevbbTrade = bbTradeDetection(lrgBbUpper, lrgBbLower, smlBbUpper, smlBbLower)//EMA Trendbase=security(syminfo.tickerid, resFirstTime, ema(close[index],emaLen))sig=security(syminfo.tickerid, resFirstTime, ema(base[index],smooth))emaTrend = not(na(base) or na(sig)) ? base < sig ? dn : up : na////LISK MANAGEMENTfloat stopLossLineForLong = nafloat stopLossLineForShort = nafloat takeProfitLineForLong = nafloat takeProfitLineForShort = naatr_ = atr(14) * atrMultiif riskManagementRule == riskManagementRule1    stopLossLineForLong := strategy.position_size > 0 ? stopLossLineForLong[1] ? stopLossLineForLong[1] : round(close[index] - atr_,3) : na    stopLossLineForShort := strategy.position_size < 0 ? stopLossLineForShort[1] ? stopLossLineForShort[1] : round(close[index] + atr_,3) : na    takeProfitLineForLong := strategy.position_size > 0 ? takeProfitLineForLong[1] ? takeProfitLineForLong[1] : close[index] + atr_*riskRewardRatio : na    takeProfitLineForShort := strategy.position_size < 0 ? takeProfitLineForShort[1] ? takeProfitLineForShort[1] :close[index] - atr_*riskRewardRatio : naif riskManagementRule == riskManagementRule2    stopLossLineForLong := strategy.position_size > 0 ? stopLossLineForLong[1] ? stopLossLineForLong[1] : close[index] - stopLossPoint * syminfo.mintick : na    stopLossLineForShort := strategy.position_size < 0 ? stopLossLineForShort[1] ? stopLossLineForShort[1] : close[index] + stopLossPoint * syminfo.mintick : na    takeProfitLineForLong := strategy.position_size > 0 ? takeProfitLineForLong[1] ? takeProfitLineForLong[1] : close[index] +takeProfitPoint * syminfo.mintick : na    takeProfitLineForShort := strategy.position_size < 0 ? takeProfitLineForShort[1] ? takeProfitLineForShort[1] :close[index] - takeProfitPoint * syminfo.mintick : na// === /CALCURATES/ === //// === CONDITIONS === ////BBbool isBbEntry = nafor i=0 to validLen    isBbEntry := bbTrade==true ? true : bbTrade[i]==true ? true : false//plotshape(isBbEntry, style=shape.circle, location=location.bottom)isBbLong = isBbEntry and open[index] < smlBbBasis[index] and close[index] > smlBbBasis[index]isBbShort = isBbEntry and open[index] > smlBbBasis[index] and close[index] < smlBbBasis[index]  //SMTisEmaLong = emaTrend == up isEmaShort = emaTrend == dn//ATRisAtrLongStop = low[index] <= stopLossLineForLongisAtrShortStop = high[index] >= stopLossLineForShortisAtrLongLimit = high[index] >= takeProfitLineForLongisAtrShortLimit = low[index] <= takeProfitLineForShort// === /CONDITIONS/ === //// === TRADE === ////ENTRYif (isBbLong and isEmaLong)    strategy.entry("LongEntry", strategy.long, 1000000, comment="LongEntry")    if riskManagementRule == riskManagementRule2        strategy.exit("LongEntry", loss=stopLossPoint, profit=takeProfitPoint, comment="bracket")if (isBbShort and isEmaShort)    strategy.entry("ShortEntry", strategy.short, 1000000, comment="ShortEntry")    if riskManagementRule == riskManagementRule2                    strategy.exit("ShortEntry", loss=stopLossPoint, profit=takeProfitPoint, comment="bracket")//EXITif riskManagementRule == riskManagementRule1    if(isAtrLongStop)        strategy.close("LongEntry", when=isAtrLongStop, comment="ATR Stop")    if(isAtrShortStop)        strategy.close("ShortEntry", when=isAtrShortStop, comment="ATR Stop")    if(isAtrLongLimit)        strategy.close("LongEntry", when=isAtrLongLimit, comment="ATR Limit")    if(isAtrShortLimit)        strategy.close("ShortEntry", when=isAtrShortLimit, comment="ATR Limit")//  === /TRADE/ === //// === PLOTS === //plot(lrgBbBasis, title="Large BB Basis", linewidth=2, color=color.gray)plot(lrgBbUpper, title="Large BB Upper", linewidth=2, color=color.gray)plot(lrgBbLower, title="Large BB Lower", linewidth=2, color=color.gray)plot(smlBbBasis, title="Small BB Basis", color=color.white)plot(smlBbUpper, title="Small BB Upper", color=color.white)plot(smlBbLower, title="Small BB Lower", color=color.white)plot(base, title="EMA Line", color= emaTrend==dn ? color_bearish : emaTrend==up ? color_bullish : color.gray)plot(stopLossLineForLong ? stopLossLineForLong : na, title="S/L Line For Long", color=color.yellow, style=plot.style_circles)plot(stopLossLineForShort ? stopLossLineForShort : na, title="S/L Line For Short", color=color.yellow, style=plot.style_circles)plot(takeProfitLineForLong ? takeProfitLineForLong : na, title="T/P Line For Long", color=color.purple, style=plot.style_circles)plot(takeProfitLineForShort ? takeProfitLineForShort : na, title="T/P Line For Short", color=color.purple, style=plot.style_circles)// /=== PLOTS ===/ //