Zeal Terminal Open Zeal Terminal

Pine Script v5 · Strategy

Strategy Designer

A Pine Script v5 strategy built on ATR (14), BB (close, 5) and BBW (middle, 5). It has 5 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. 78 settings; defaults include ATR Length 14, BB Middle close and BB Length 5.

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 Strategy Designer repaint?
No
No repainting patterns were found in the source.
Does Strategy Designer run in Pine Script v6?
Not tested
The v5 script does not run in Zeal Terminal's engine (Pine Script v5 Error at @L183:C24: 'array' has no member 'every'.), so this step could not be checked. The v6 version is shown for reference and is not offered as a download.
Does Strategy Designer use a stop loss?
Yes
strategy.exit sets a stop on line 216, 217.
Does Strategy Designer run in Zeal Terminal?
No
Not yet: Pine Script v5 Error at @L183:C24: 'array' has no member 'every'.
Does not run in Zeal Terminal yetPine Script v5 Error at @L183:C24: 'array' has no member 'every'. The settings, logic and review below are read from the source, which does not need a run.

Review

What a careful reader of this script would point out, found by checking the source.

  • Check

    1 setting does nothing

    “Source” is declared but never read.

  • Check

    No commission

    The backtest assumes free trading. Results on any real exchange will be lower.

  • Note

    11 settings have no label

    In the settings dialog ma1Type (line 37), ma2Type (line 42), willStopValue (line 99), willTpValue (line 102), willTSLValue (line 105), s1Mid (line 121), s2Mid (line 133), s3Mid (line 144), s4Mid (line 155), s5Mid (line 166), s6Mid (line 177) show an empty name. The labels on this page come from the variable names.

  • Note

    No slippage

    Fills are assumed at the exact open price. Add slippage in the properties for a more realistic test.

Settings

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

SettingDefaultType and rangeFeeds
ATR
ATR Length14int · min 1atr
BB
BB Middleclosesourcemiddle upper lower
BB Length5int · min 1middle upper lower bbw
BB Mult4int · min 1middle upper lower bbw
CCI
CCI Sourceclosesourcecci
CCI Len10int · min 1cci
MA 1
Ma1Type (no label in the script)EMAstring · options ["EMA", "SMA", "RMA", "WMA"]ma1
Period20int · min 1ma1
Sourceclosesourcema1 ma2
MA 2
Ma2Type (no label in the script)EMAstring · options ["EMA", "SMA", "RMA", "WMA"]ma2
Period50int · min 1ma2
Sourceclosesourceunused
RSI
RSI Sourceclosesourcersi
RSI Length14int · min 1rsi
ADX
DI Length17int · min 1diplus diminus adx
ADX Smoothing14int · min 1 · max 50diplus diminus adx
MFI
MFI Sourceclosesourcemfi
MFI Length14int · min 1mfi
MOM
MOM Sourceclosesourcemom
MOM Length14int · min 1mom
SETTINGS
USE Backtest at Start DatetrueboolinTrade
Start Datetimestamp("1 Jan 2011")timeinTrade
Stop Datetimestamp("2025")timeinTrade
Show Tabletrueboolline 218
BUY/LONG CONNECTANDstring · options ["AND","OR"]entry BUY line 183
SELL/SHORT CONNECTANDstring · options ["AND","OR"]line 185
FUTURE OR SPOT ?SPOTstring · options ["SPOT","FUTURE"]close BUY entry SELL line 186
STOPfalseboolexit EXIT
Will Stop Value (no label in the script)5.floatbuyStop sellStop
%trueboolbuyStop sellStop
TPfalseboolexit EXIT
Will Tp Value (no label in the script)5.floatbuyTp sellTp
%trueboolbuyTp sellTp
Trailing SLfalseboolplot exit EXIT
Will TSLValue (no label in the script)2.floatstopValue
%truebooltslShortPercent tslLongPercent stopValue
❗️❗️❗️❗️ CONDITION 1 ❗️❗️❗️❗️
CONDITION Activefalseboolline 126
DirectionBUY/LONGstring · options ["BUY/LONG","SELL/SHORT"]line 126
1️⃣CCIstring · options ["ATR","MA 1","MA 2","RSI","CCI","BBW", "ADX","MFI","MOM"]s1Series
S1Mid (no label in the script)>=string · options [">","<",">=","<=","=","!=","CROSS ABOVE","CROSS BELOW"]s1Series
2️⃣CCIstring · options ["ATR","MA 1","MA 2","RSI","CCI","BBW", "ADX","MFI","MOM"]s1Series
VALUE falsebools1Series
2️⃣0.floats1Series
❗️❗️❗️❗️ CONDITION 2 ❗️❗️❗️❗️
CONDITION Activefalseboolline 138
DirectionBUY/LONGstring · options ["BUY/LONG","SELL/SHORT"]line 138
1️⃣CCIstring · options ["ATR","MA 1","MA 2","RSI","CCI","BBW", "ADX","MFI","MOM"]s2Series
S2Mid (no label in the script)>=string · options [">","<",">=","<=","=","!=","CROSS ABOVE","CROSS BELOW"]s2Series
2️⃣CCIstring · options ["ATR","MA 1","MA 2","RSI","CCI","BBW", "ADX","MFI","MOM"]s2Series
VALUE falsebools2Series
2️⃣0.floats2Series
❗️❗️❗️❗️ CONDITION 3 ❗️❗️❗️❗️
CONDITION Activefalseboolline 149
DirectionBUY/LONGstring · options ["BUY/LONG","SELL/SHORT"]line 149
1️⃣CCIstring · options ["ATR","MA 1","MA 2","RSI","CCI","BBW", "ADX","MFI","MOM"]s3Series
S3Mid (no label in the script)>=string · options [">","<",">=","<=","=","!=","CROSS ABOVE","CROSS BELOW"]s3Series
2️⃣CCIstring · options ["ATR","MA 1","MA 2","RSI","CCI","BBW", "ADX","MFI","MOM"]s3Series
VALUE falsebools3Series
2️⃣0.floats3Series
❗️❗️❗️❗️ CONDITION 4 ❗️❗️❗️❗️
CONDITION Activefalseboolline 160
DirectionBUY/LONGstring · options ["BUY/LONG","SELL/SHORT"]line 160
1️⃣CCIstring · options ["ATR","MA 1","MA 2","RSI","CCI","BBW", "ADX","MFI","MOM"]s4Series
S4Mid (no label in the script)>=string · options [">","<",">=","<=","=","!=","CROSS ABOVE","CROSS BELOW"]s4Series
2️⃣CCIstring · options ["ATR","MA 1","MA 2","RSI","CCI","BBW", "ADX","MFI","MOM"]s4Series
VALUE falsebools4Series
2️⃣0.floats4Series
❗️❗️❗️❗️ CONDITION 5 ❗️❗️❗️❗️
CONDITION Activefalseboolline 171
DirectionBUY/LONGstring · options ["BUY/LONG","SELL/SHORT"]line 171
1️⃣CCIstring · options ["ATR","MA 1","MA 2","RSI","CCI","BBW", "ADX","MFI","MOM"]s5Series
S5Mid (no label in the script)>=string · options [">","<",">=","<=","=","!=","CROSS ABOVE","CROSS BELOW"]s5Series
2️⃣CCIstring · options ["ATR","MA 1","MA 2","RSI","CCI","BBW", "ADX","MFI","MOM"]s5Series
VALUE falsebools5Series
2️⃣0.floats5Series
❗️❗️❗️❗️ CONDITION 6 ❗️❗️❗️❗️
CONDITION Activefalseboolline 182
DirectionBUY/LONGstring · options ["BUY/LONG","SELL/SHORT"]line 182
1️⃣CCIstring · options ["ATR","MA 1","MA 2","RSI","CCI","BBW", "ADX","MFI","MOM"]s6Series
S6Mid (no label in the script)>=string · options [">","<",">=","<=","=","!=","CROSS ABOVE","CROSS BELOW"]s6Series
2️⃣CCIstring · options ["ATR","MA 1","MA 2","RSI","CCI","BBW", "ADX","MFI","MOM"]s6Series
VALUE falsebools6Series
2️⃣0.floats6Series

What it calculates

  • ATRATR Length (14)atr · line 25
  • BBBB Middle (close), BB Length (5), BB Mult (4)middle · line 30
  • BBBB Middle (close), BB Length (5), BB Mult (4)upper · line 30
  • BBBB Middle (close), BB Length (5), BB Mult (4)lower · line 30
  • BBWmiddle, BB Length (5), BB Mult (4)bbw · line 31
  • CCICCI Source (close), CCI Len (10)cci · line 35
  • RSIRSI Source (close), RSI Length (14)rsi · line 49
  • DMIDI Length (17), ADX Smoothing (14)diplus · line 53
  • DMIDI Length (17), ADX Smoothing (14)diminus · line 53
  • DMIDI Length (17), ADX Smoothing (14)adx · line 53
  • MFIMFI Source (close), MFI Length (14)mfi · line 57
  • MOMMOM Source (close), MOM Length (14)mom · line 61

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 82 named inputs, calculations, conditions and outputs, too many to draw legibly here; the tables above list them.

Order rules

OrderFires whenBy defaultLine
Open BUY longandORLong == "AND" ? array.every(buyList) : array.includes(buyList,true) and inTradeOn184
Close BUYfutureOrSpot == "SPOT"On187
Open SELL shortfutureOrSpot == "SPOT"On189
Exit EXIT stop and limitevery barOn216
Exit EXIT stop and limitevery barOn217

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.

The live replay needs a run, and this script does not run in Zeal Terminal yet; the answer comes from the checks on the source alone.

  • 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.

Similar scripts

No other indicator or strategy here shares enough of its calculations.

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.

  • No v6-only features. v6 is not needed to run this script.

Clean v5

Verified

Nothing to change.

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 @L183:C24: 'array' has no member 'every'.), 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.

⋯// © only_fibonacci-//@version=5+//@version=6strategy("Strategy Designer", overlay=true)⋯

Where it runs

EngineCompilesRunsMatches TradingView
Zeal Terminal · OpenPineScript v2No Pine Script v5 Error at @L183:C24: 'array' has no member 'every'.Not measured
PineTSNot testedNot testedNot 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 184, 189) 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/// © only_fibonacci//@version=5strategy("Strategy Designer", overlay=true)// FUNCTIONSoperatorReturn(i1,selected,i2)=>    switch selected        ">" => i1 > i2        "<" => i1 < i2        ">=" => i1 >= i2        "<=" => i1 <= i2        "=" => i1 == i2        "!=" => i1 != i2        "CROSS ABOVE" => ta.crossover(i1, i2)        "CROSS BELOW" => ta.crossunder(i1,i2)maTypeToMa(maType,maPeriod,src)=>    switch maType        "EMA" => ta.ema(src, maPeriod)        "SMA" => ta.sma(src, maPeriod)        "RMA" => ta.rma(src, maPeriod)        => ta.wma(src, maPeriod)// Indicators// ATRatrLen      = input.int(defval = 14,minval = 1, title = "ATR Length", group = "ATR")atr         = ta.atr(atrLen) // ATR// BBbbMiddle    = input.source(defval = close, title = "BB Middle", group = "BB")bbLen       = input.int(defval = 5, title = "BB Length",minval = 1, group = "BB")bbMult      = input.int(defval = 4, title = "BB Mult",minval = 1, group = "BB" )[middle, upper, lower] = ta.bb(bbMiddle, bbLen, bbMult) // BBbbw         = ta.bbw(middle, bbLen, bbMult) // BB Genişlik// CCIcciSrc      = input.source(defval = close, title = "CCI Source", group = "CCI")cciLen      = input.int(defval = 10, title = "CCI Len", minval = 1, group = "CCI")cci         = ta.cci(cciSrc,cciLen) // CCI// MA1ma1Type = input.string("EMA", "", options = ["EMA", "SMA", "RMA", "WMA"], group = "MA 1", inline = "2ma1")ma1Period = input.int(defval = 20, title = "Period", minval = 1, group = "MA 1", inline = "2ma1")ma1Src = input.source(defval = close, title = "Source", group = "MA 1", inline = "2ma1")ma1 = maTypeToMa(ma1Type,ma1Period,ma1Src)// MA2ma2Type = input.string("EMA", "", options = ["EMA", "SMA", "RMA", "WMA"], group = "MA 2", inline = "2ma2")ma2Period = input.int(defval = 50, title = "Period", minval = 1, group = "MA 2", inline = "2ma2")ma2Src = input.source(defval = close, title = "Source", group = "MA 2", inline = "2ma2")ma2 = maTypeToMa(ma2Type,ma2Period,ma1Src)// RSIrsiSrc = input.source(defval = close, title = "RSI Source", group = "RSI")rsiLen = input.int(defval = 14, title = "RSI Length", minval = 1, group = "RSI")rsi = ta.rsi(rsiSrc,rsiLen)// ADXlenAdx = input.int(17, minval=1, title="DI Length", group = "ADX")lensigAdx = input.int(14, title="ADX Smoothing", minval=1, maxval=50, group = "ADX")[diplus, diminus, adx] = ta.dmi(lenAdx, lensigAdx)// MFImfiSrc = input.source(defval = close, title = "MFI Source", group = "MFI")mfiLen = input.int(defval = 14, title = "MFI Length", minval = 1, group = "MFI")mfi = ta.mfi(mfiSrc,mfiLen)// MOMmomSrc = input.source(defval = close, title = "MOM Source", group = "MOM")momLen = input.int(defval = 14, title = "MOM Length", minval = 1, group = "MOM")mom = ta.mom(momSrc,momLen)indicators(selected)=>    switch selected        "MA 1" => ma1        "MA 2" => ma2        "ATR" => atr        "CCI" => cci        "RSI" => rsi        "BBW" => bbw        "ADX" => adx        "MFI" => mfi        "MOM" => mom                    position(data)=>    switch data        "ABOVE" => location.abovebar        => location.belowbarlocation(data)=>    switch data        "ABOVE" => true        => falsestyle(data)=>    switch data        "ABOVE" => shape.labeldown        => shape.labelup// SETTINGS /////////// USE BACKTEST START DATEuseFilter = input.bool(true, title="USE Backtest at Start Date", group="SETTINGS")backtestStartDate = input.time(timestamp("1 Jan 2011"),    title="Start Date", group="SETTINGS")backtestStopDate =  input.time(timestamp("2025"), title="Stop Date", group="SETTINGS")inTrade = not useFilter or (time >= backtestStartDate and time <= backtestStopDate )tableShow = input.bool(defval = true, title = "Show Table", group = "SETTINGS")andORLong = input.string(defval = "AND", title = "BUY/LONG CONNECT", options = ["AND","OR"], group = "SETTINGS") andORShort = input.string(defval = "AND", title = "SELL/SHORT CONNECT", options = ["AND","OR"], group = "SETTINGS") futureOrSpot =  input.string(defval = "SPOT", title = "FUTURE OR SPOT ?", options = ["SPOT","FUTURE"], group = "SETTINGS") willStop = input.bool(defval = false, title = "STOP", group = "SETTINGS", inline = "stop")willStopValue = input.float(defval = 5., title = "", group = "SETTINGS", inline = "stop")percentageStop = input.bool(defval = true, title = "%", group = "SETTINGS", inline = "stop")willTp = input.bool(defval = false, title = "TP", group = "SETTINGS", inline = "TP")willTpValue = input.float(defval = 5., title = "", group = "SETTINGS", inline = "TP")percentageTP = input.bool(defval = true, title = "%", group = "SETTINGS", inline = "TP")willTSL = input.bool(defval = false, title = "Trailing SL", group = "SETTINGS", inline = "TSL")willTSLValue = input.float(defval = 2., title = "", group = "SETTINGS", inline = "TSL")percentageTSL = input.bool(defval = true, title = "%", group = "SETTINGS", inline = "TSL")buyList = array.new_bool()sellList = array.new_bool()detect(status,series,di)=>    if status        if di == "BUY/LONG"            array.push(buyList,series)        else            array.push(sellList,series)// CONDITION 1s1Group     = "❗️❗️❗️❗️ CONDITION #1 ❗️❗️❗️❗️"s1Inline    = "s1i"s1Status    = input.bool(defval = false, title = "CONDITION Active", group = s1Group )s1Direction = input.string(defval = "BUY/LONG", title = "Direction",options = ["BUY/LONG","SELL/SHORT"], group = s1Group)s1Left      = input.string(defval = "CCI", title = "1️⃣", options = ["ATR","MA 1","MA 2","RSI","CCI","BBW", "ADX","MFI","MOM"], group = s1Group, inline = s1Inline)s1Mid       = input.string(defval = ">=", title = "", options = [">","<",">=","<=","=","!=","CROSS ABOVE","CROSS BELOW"], group = s1Group, inline = s1Inline)s1Right     = input.string(defval = "CCI", title = "2️⃣", options = ["ATR","MA 1","MA 2","RSI","CCI","BBW", "ADX","MFI","MOM"], group = s1Group, inline = s1Inline)s1ValueBool = input.bool(defval = false, title = "VALUE ", group = s1Group, inline = "v1")s1EndRight  = input.float(defval = 0. , title = "2️⃣", group = s1Group, inline = "v1")s1Series    = operatorReturn(indicators(s1Left),s1Mid,s1ValueBool ? s1EndRight : indicators(s1Right))detect(s1Status,s1Series,s1Direction)// CONDITION 2s2Group     = "❗️❗️❗️❗️ CONDITION #2 ❗️❗️❗️❗️"s2Inline    = "s2i"s2Status    = input.bool(defval = false, title = "CONDITION Active", group = s2Group )s2Direction = input.string(defval = "BUY/LONG", title = "Direction",options = ["BUY/LONG","SELL/SHORT"], group = s2Group)s2Left      = input.string(defval = "CCI", title = "1️⃣", options = ["ATR","MA 1","MA 2","RSI","CCI","BBW", "ADX","MFI","MOM"], group = s2Group, inline = s2Inline)s2Mid       = input.string(defval = ">=", title = "", options = [">","<",">=","<=","=","!=","CROSS ABOVE","CROSS BELOW"], group = s2Group, inline = s2Inline)s2Right     = input.string(defval = "CCI", title = "2️⃣", options = ["ATR","MA 1","MA 2","RSI","CCI","BBW", "ADX","MFI","MOM"], group = s2Group, inline = s2Inline)s2ValueBool = input.bool(defval = false, title = "VALUE ", group = s2Group, inline = "v2")s2EndRight  = input.float(defval = 0. , title = "2️⃣", group = s2Group, inline = "v2")s2Series    = operatorReturn(indicators(s2Left),s2Mid,s2ValueBool ? s2EndRight : indicators(s2Right))detect(s2Status,s2Series,s2Direction)s3Group     = "❗️❗️❗️❗️ CONDITION #3 ❗️❗️❗️❗️"s3Inline    = "s3i"s3Status    = input.bool(defval = false, title = "CONDITION Active", group = s3Group )s3Direction = input.string(defval = "BUY/LONG", title = "Direction",options = ["BUY/LONG","SELL/SHORT"], group = s3Group)s3Left      = input.string(defval = "CCI", title = "1️⃣", options = ["ATR","MA 1","MA 2","RSI","CCI","BBW", "ADX","MFI","MOM"], group = s3Group, inline = s3Inline)s3Mid       = input.string(defval = ">=", title = "", options = [">","<",">=","<=","=","!=","CROSS ABOVE","CROSS BELOW"], group = s3Group, inline = s3Inline)s3Right     = input.string(defval = "CCI", title = "2️⃣", options = ["ATR","MA 1","MA 2","RSI","CCI","BBW", "ADX","MFI","MOM"], group = s3Group, inline = s3Inline)s3ValueBool = input.bool(defval = false, title = "VALUE ", group = s3Group, inline = "v3")s3EndRight  = input.float(defval = 0. , title = "2️⃣", group = s3Group, inline = "v3")s3Series    = operatorReturn(indicators(s3Left),s3Mid,s3ValueBool ? s3EndRight : indicators(s3Right))detect(s3Status,s3Series,s3Direction)s4Group     = "❗️❗️❗️❗️ CONDITION #4 ❗️❗️❗️❗️"s4Inline    = "s4i"s4Status    = input.bool(defval = false, title = "CONDITION Active", group = s4Group )s4Direction = input.string(defval = "BUY/LONG", title = "Direction",options = ["BUY/LONG","SELL/SHORT"], group = s4Group)s4Left      = input.string(defval = "CCI", title = "1️⃣", options = ["ATR","MA 1","MA 2","RSI","CCI","BBW", "ADX","MFI","MOM"], group = s4Group, inline = s4Inline)s4Mid       = input.string(defval = ">=", title = "", options = [">","<",">=","<=","=","!=","CROSS ABOVE","CROSS BELOW"], group = s4Group, inline = s4Inline)s4Right     = input.string(defval = "CCI", title = "2️⃣", options = ["ATR","MA 1","MA 2","RSI","CCI","BBW", "ADX","MFI","MOM"], group = s4Group, inline = s4Inline)s4ValueBool = input.bool(defval = false, title = "VALUE ", group = s4Group, inline = "v3")s4EndRight  = input.float(defval = 0. , title = "2️⃣", group = s4Group, inline = "v3")s4Series    = operatorReturn(indicators(s4Left),s4Mid,s4ValueBool ? s4EndRight : indicators(s4Right))detect(s4Status,s4Series,s4Direction)s5Group     = "❗️❗️❗️❗️ CONDITION #5 ❗️❗️❗️❗️"s5Inline    = "s5i"s5Status    = input.bool(defval = false, title = "CONDITION Active", group = s5Group )s5Direction = input.string(defval = "BUY/LONG", title = "Direction",options = ["BUY/LONG","SELL/SHORT"], group = s5Group)s5Left      = input.string(defval = "CCI", title = "1️⃣", options = ["ATR","MA 1","MA 2","RSI","CCI","BBW", "ADX","MFI","MOM"], group = s5Group, inline = s5Inline)s5Mid       = input.string(defval = ">=", title = "", options = [">","<",">=","<=","=","!=","CROSS ABOVE","CROSS BELOW"], group = s5Group, inline = s5Inline)s5Right     = input.string(defval = "CCI", title = "2️⃣", options = ["ATR","MA 1","MA 2","RSI","CCI","BBW", "ADX","MFI","MOM"], group = s5Group, inline = s5Inline)s5ValueBool = input.bool(defval = false, title = "VALUE ", group = s5Group, inline = "v3")s5EndRight  = input.float(defval = 0. , title = "2️⃣", group = s5Group, inline = "v3")s5Series    = operatorReturn(indicators(s5Left),s5Mid,s5ValueBool ? s5EndRight : indicators(s5Right))detect(s5Status,s5Series,s5Direction)s6Group     = "❗️❗️❗️❗️ CONDITION #6 ❗️❗️❗️❗️"s6Inline    = "s6i"s6Status    = input.bool(defval = false, title = "CONDITION Active", group = s6Group )s6Direction = input.string(defval = "BUY/LONG", title = "Direction",options = ["BUY/LONG","SELL/SHORT"], group = s6Group)s6Left      = input.string(defval = "CCI", title = "1️⃣", options = ["ATR","MA 1","MA 2","RSI","CCI","BBW", "ADX","MFI","MOM"], group = s6Group, inline = s6Inline)s6Mid       = input.string(defval = ">=", title = "", options = [">","<",">=","<=","=","!=","CROSS ABOVE","CROSS BELOW"], group = s6Group, inline = s6Inline)s6Right     = input.string(defval = "CCI", title = "2️⃣", options = ["ATR","MA 1","MA 2","RSI","CCI","BBW", "ADX","MFI","MOM"], group = s6Group, inline = s6Inline)s6ValueBool = input.bool(defval = false, title = "VALUE ", group = s6Group, inline = "v3")s6EndRight  = input.float(defval = 0. , title = "2️⃣", group = s6Group, inline = "v3")s6Series    = operatorReturn(indicators(s6Left),s6Mid,s6ValueBool ? s6EndRight : indicators(s6Right))detect(s6Status,s6Series,s6Direction)if andORLong == "AND" ? array.every(buyList) : array.includes(buyList,true) and inTrade    strategy.entry(id = "BUY", direction = strategy.long)if andORShort == "AND" ? array.every(sellList) : array.includes(sellList,true) and inTrade    if futureOrSpot == "SPOT"        strategy.close(id = "BUY")    else        strategy.entry(id = "SELL", direction = strategy.short)buyStop = 0.sellStop = 0.entry = strategy.position_avg_pricebuyStop := percentageStop ? entry *(100 - willStopValue) / 100 : entry - willStopValuesellStop := percentageStop ? entry *(100 + willStopValue) / 100 : entry + willStopValuebuyTp = percentageTP ? entry *(100 + willTpValue) / 100 : entry + willTpValuesellTp = percentageTP ? entry *(100 - willTpValue) / 100 : entry - willTpValue//////// TSLtrailingLongPrice = 0.0trailingShortPrice = 0.0tslShortPercent = percentageTSLtslLongPercent = percentageTSLif strategy.position_size > 0    stopValue = percentageTSL ? low * (100 - willTSLValue) / 100 : low - willTSLValue    trailingLongPrice := math.max(stopValue, trailingLongPrice[1])    else    trailingLongPrice:=0if strategy.position_size <0    stopValue = percentageTSL ? high * (100 + willTSLValue) / 100 : high + willTSLValue    trailingShortPrice := math.min(stopValue, trailingShortPrice[1])    else    trailingShortPrice :=99999plot(strategy.position_size > 0 and willTSL ? trailingLongPrice : na , color=color.green, linewidth=3,style = plot.style_linebr)plot(strategy.position_size < 0  and willTSL ? trailingShortPrice : na , color = color.red, linewidth=3, style = plot.style_linebr)strategy.exit("EXIT", from_entry = "BUY", stop = willStop and willTSL ? trailingLongPrice : willTSL ? trailingLongPrice : willStop and willTSL == false ? buyStop :na, limit = willTp ? buyTp : na )strategy.exit("EXIT", from_entry = "SELL", stop = willStop and willTSL ? trailingShortPrice : willTSL ? trailingShortPrice : willStop and willTSL == false ? sellStop :na, limit = willTp ? sellTp : na)if tableShow    // COLUMNS    var table tablo = table.new(position.top_right,2,7,border_width=4,border_color=color.gray, frame_color=color.gray, frame_width=4)    table.cell(tablo,0,0,bgcolor=color.black,text_color=color.white, text="NET PROFIT")    table.cell(tablo,0,1,bgcolor=color.black,text_color=color.white, text="TOTAL PROFIT")    table.cell(tablo,0,2,bgcolor=color.black,text_color=color.white, text="TOTAL LOSS")    table.cell(tablo,0,3,bgcolor=color.black,text_color=color.white, text="PROFIT FACTOR")    table.cell(tablo,0,4,bgcolor=color.black,text_color=color.white, text="WIN TRADES")    table.cell(tablo,0,5,bgcolor=color.black,text_color=color.white, text="LOSS TRADES")    table.cell(tablo,0,6,bgcolor=color.black,text_color=color.white, text="TOTAL NET PROFIT")    // ROWS    table.cell(tablo,1,0,bgcolor=strategy.netprofit>0 ? color.green : color.red,text_color=color.white, text=str.tostring(strategy.netprofit))    table.cell(tablo,1,1,bgcolor=color.black,text_color=color.white, text=str.tostring(strategy.grossprofit))    table.cell(tablo,1,2,bgcolor=color.black,text_color=color.white, text=str.tostring(strategy.grossloss))    table.cell(tablo,1,3,bgcolor=strategy.grossprofit / strategy.grossloss >1 ? color.green : color.red,text_color=color.white, text=str.tostring(math.round(strategy.grossprofit / strategy.grossloss,3)))    table.cell(tablo,1,4,bgcolor=color.black,text_color=color.white, text=str.tostring(strategy.wintrades))    table.cell(tablo,1,5,bgcolor=color.black,text_color=color.white, text=str.tostring(strategy.losstrades))    table.cell(tablo,1,6,bgcolor=color.black,text_color=color.white, text=str.tostring(math.round(strategy.netprofit/strategy.initial_capital*100,2))+" %")