Zeal Terminal Open in Zeal Terminal

Pine Script v5 · Strategy

Strategy Myth-Busting #1 - UT Bot+STC+Hull [MYN]

A Pine Script v5 strategy built on ATR (6), EMA (src, 1) and Crossover (ema, xATRTrailingStop). It has 9 order rules, 2 entries among them, and trades long and short with the default settings. Exits use a profit target and no stop loss. Each trade commits 1.0% of equity and pays 0.075 commission. 35 settings; defaults include Key Vaule. \'This changes the sensitivity\' 2, ATR Period 6 and Length 80.

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 Myth-Busting #1 - UT Bot+STC+Hull [MYN] repaint?
No
No repainting patterns were found in the source, and a live tick-by-tick replay matched history on 4 of 4 trades.
How did Strategy Myth-Busting #1 - UT Bot+STC+Hull [MYN] do on BTCUSDT 1D with default settings?
−30.72%
From 26 Jan 2024 to 21 Oct 2026, over 10 closed trades, against +102.5% for buy and hold. A backtest, not investment advice.
What alerts does Strategy Myth-Busting #1 - UT Bot+STC+Hull [MYN] have?
8
UT Long; UT Short; Red; Green; and more.
Does Strategy Myth-Busting #1 - UT Bot+STC+Hull [MYN] run in Pine Script v6?
No
The v6 version does not run in Zeal Terminal's engine: Pine Script v6 Error at @L132:C76: 'plot' has no 'transp' parameter in Pine Script v6. Use color.new(color, transparency) instead. The v6 version is shown for reference and is not offered as a download.
Does Strategy Myth-Busting #1 - UT Bot+STC+Hull [MYN] use a stop loss?
No
Its exits set a profit target but no stop.

BTCUSDT · 1D · default settings

  • MHULL
  • SHULL
  • Winning trade
  • Losing trade
  • Equity
  • Buy and hold
Prerendered with the defaults. Change anything and run it here. The script runs in your browser.
Settings (35)
40,00060,00080,000100,000120,000AprJulOct2025AprJulOct2026AprJulOct$305$1,013Equity from $500
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 engine's host API cannot yet declare a chart's symbol and timeframe, so this page sets them on the engine directly for each market.
Net profit
−30.72%
−$153.60
Buy and hold
+102.5%
same period
Closed trades
10
4 won · 6 lost
Profitable
40.0%
of closed trades
Profit factor
0.50
gross profit ÷ gross loss
Max drawdown
63.47%
−$317.37

One run with the author's default settings, $500 starting capital, commission as the script sets it. A short position was still open at the last bar. 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

    ta.ema(src, 1) ignores the settings line 27

    Line 27 hard-codes 1 where line 61 uses “FastLength”. Changing those settings moves one band but not this one.

    ta.ema(src, 1)ta.ema(src, BBBB)
  • Check

    2 settings do nothing

    “░░░░░░░░░░░░░░░░░░░░░░░░░”, “░░░░░░░░░░░░░░░░░░░░░░░░░” are declared but never read.

  • Check

    No stop loss

    strategy.exit is used without a stop, loss or trailing stop.

  • Note

    3 settings have no label

    In the settings dialog AAA (line 66), startPeriodTime (line 152), endPeriodTime (line 154) 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.

  • Note

    Uses an argument v6 removed

    when = on line 211, 212, 213. 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.

SettingDefaultType and rangeFeeds
Key Vaule. \'This changes the sensitivity\'2intnLoss
ATR Period6intxATR
Signals from Heikin Ashi Candlesfalseboolsrc
░░░░░░░░░░░░░░░░░░░░░░░░░falseboolunused
Length80intCCC CCCC DDDD DDDDD mAAAAA
FastLength27intfastMA BBBBBB mAAAAA
SlowLength50intslowMA BBBBBB mAAAAA
AAA (no label in the script)0.5floatDDD EEEEE
░░░░░░░░░░░░░░░░░░░░░░░░░falseboolunused
Sourceclosesource_hull
Hull VariationHmastring · options ['Hma', 'Thma', 'Ehma']_hull line 122
Length(180-200 for floating S/R , 55 for swing entry)55int_hull
Length multiplier (Used to view higher timeframes with straight band)1.0float_hull
Show Hull MA from X timeframe? (good for scalping)falseboolHULL
Higher timeframe240timeframeHULL
Color Hull according to trend?trueboolhullColor barcolor
Color candles based on Hull\'s Trend?falseboolbarcolor
Show as a Band?trueboolSHULL
Line Thickness1intMHULL SHULL
Band Transparency40int · step 5Band Filler
Date Range
Starttrueboolstart
Start Period Time (no label in the script)timestamp('1 Jan 2019')timestart
Endtrueboolend
End Period Time (no label in the script)timestamp('31 Dec 2030')timeend
Trade Direction
Trade DirectionLong and Shortstring · options ['Long and Short', 'Long Only', 'Short Only']entry Long entry Short line 200 line 203
Take Profit
Take Profit 1 - Target %100float · min 0.0 · step 0.5exit TP1
% Of Position100int · min 0exit TP1
Take Profit 2 - Target %100float · min 0.0 · step 0.5exit TP2
% Of Position100int · min 0exit TP2
Take Profit 3 - Target %100float · min 0.0 · step 0.5exit TP3
% Of Position100int · min 0exit TP3
Take Profit 4 - Target %100float · min 0.0 · step 0.5exit TP4
Stop Loss
Stop Loss (%)15float · min 0.01slLongClose slShortClose
Leverage
Leverage1float · step .5contracts
ProfitView Alert Syntax
Alert Syntax PrefixPV-AccountNameHere_Strategy-Name-HerestringalertSyntaxBase

What it calculates

  • ATRATR Period (6)xATR · line 16
  • EMAsrc, 1ema · line 27
  • Crossoverema, xATRTrailingStopabove · line 28
  • CrossoverxATRTrailingStop, emabelow · line 29
  • EMABBB, FastLength (27)fastMA · line 61
  • EMABBB, SlowLength (50)slowMA · line 62
  • LowestBBBBBB, Length (80)CCC · line 72
  • HighestBBBBBB, Length (80)CCCC · line 73
  • LowestDDD, Length (80)DDDD · line 76
  • HighestDDD, Length (80)DDDDD · line 77

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

Order rules

OrderFires whenBy defaultLine
Open Long longlongCondition and tradeDirection != 'Short Only' and isInLongPosition == falseOn201
Open Short shortshortCondition and tradeDirection != 'Long Only' and isInShortPosition == falseOn204
Exit TP1 limitcalcPeriodOn207
Exit TP2 limitcalcPeriodOn208
Exit TP3 limitcalcPeriodOn209
Exit TP4 limitcalcPeriodOn210
Close LongslLongCloseclose < strategy.position_avg_price * (1 - stoplossPercent)On211
Close ShortslShortCloseclose > strategy.position_avg_price * (1 + stoplossPercent)On212
Close closeLongCondition or closeShortConditionOn213

Each order is guarded by the setting shown. “Off” orders never fire unless that setting is switched on.

Alerts

AlertCallMessageLine
UT LongalertconditionUT Long38
UT ShortalertconditionUT Short39
(no title)alertRed84
(no title)alertGreen86
Hull trending up.alertconditionHull trending up.134
Hull trending down.alertconditionHull trending down.135
(no title)alertalertSyntaxBase + 'side:long'202
(no title)alertalertSyntaxBase + 'side:short'205

Does it repaint?

No

No repainting patterns in the source, and the live replay matched history.

4/4trades identical when replayed liveThe last 300 bars, from 26 Dec 2025, were fed to the engine as live ticks, four per bar, and compared with the historical run. Orders are decided once per closed bar, so nothing can change mid-bar.
  • ClearHigher-timeframe data2 request.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

The same script with default settings on 8 Binance markets. Each row is a separate backtest over the most recent 1,000 bars.

MarketNetBuy and holdTradesWonProfit factorMax drawdownPeriod
BTCUSDT 1D−30.7%+102.5%1040%0.5063.5%26 Jan 2024 – 21 Oct 2026
BTCUSDT 4h+22.5%+5.5%1354%1.6918.1%8 May 2026 – 21 Oct 2026
ETHUSDT 1D−29.5%+9.8%1040%0.5565.6%26 Jan 2024 – 21 Oct 2026
ETHUSDT 4h−13.8%+8.4%1242%0.7740.7%8 May 2026 – 21 Oct 2026
SOLUSDT 1D−28.3%+16.7%1729%0.7561.1%26 Jan 2024 – 21 Oct 2026
SOLUSDT 4h+37.2%+21.5%1040%1.7126.4%8 May 2026 – 21 Oct 2026
BNBUSDT 1D−42.9%+148.3%1338%0.4274.2%26 Jan 2024 – 21 Oct 2026
BNBUSDT 4h+31.0%+17.1%1145%3.4215.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 barsTradesWonP&L
Rising market30%−$142.75
Sideways market367%−$0.79
Falling market450%−$9.81

Rising and falling mean the market moved more than 15% over the 90 bars before entry.

How bad could the drawdown be?

58.8%

The 95th percentile of the worst drawdown when the same 10 trades are reshuffled 5,000 times. The bar spans the 5th to 95th percentile, 33.7% to 58.8%; the tick is what actually happened, 61.3%. Order luck alone moves it this much.

0%70%
All 10 trades
SideEntryExitBarsP&L
short14 Jun 2024 66,773.0011 Nov 2024 80,370.00150−$102.64
long18 Jan 2025 104,077.0027 Feb 2025 84,250.1040−$76.24
short8 Apr 2025 79,163.2023 Apr 2025 93,443.0015−$58.45
short2 Jun 2025 105,643.0016 Jul 2025 117,758.0044−$30.54
long16 Jul 2025 117,758.0014 Nov 2025 99,692.00121−$35.97
long9 Dec 2025 90,634.4024 Jan 2026 89,600.3046−$2.53
short24 Jan 2026 89,600.305 Mar 2026 72,666.8040$36.36
long5 Mar 2026 72,666.8018 May 2026 77,457.7074$14.81
short18 May 2026 77,457.705 Jul 2026 63,144.0048$44.94
long5 Jul 2026 63,144.0016 Sep 2026 75,644.5073$56.91

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
Strategy Myth-Busting #1 - UT Bot+STC+Hull [MYN] this page—v5 strategy−30.7%1063.5%
Richard's Strategy by Deepak8369highest lowest atr emav4 strategy+34.6%7026.3%
Classic Long Term Trend Following System by Robrecht99ema highest lowest atrv5 strategy+2.9%51.1%
Strategy for UT Bot Alerts indicator by StrategiesForEveryoneema atr highest lowestv5 strategy−4.5%4215.7%
Simple and Profitable Scalping Strategy (ForexSignals TV) by kevinmck100ema atr highest lowestv5 strategyNo trades on this market
ATR + STC + MA by Romediusema lowest highest atrv5 strategy−1.2%153.3%

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.

  • 3 strategy calls use the when = argument (line 211, 212, 213). It is deprecated in v5 and removed in v6, where each call moves inside an if block.
  • 17 settings use the untyped input() (line 13, 14, 15, 56, 57, 58, 59, 66, 97, 99, 101, 102, 103, 105, 106, 107, 108). It still compiles in v6; input.int, input.float or input.source state the type.
  • No v6-only features. v6 is not needed to run this script.

Clean v5

VerifiedDownload the v5 script

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

  • Line 13: input() → input.int()
  • Line 14: input() → input.int()
  • Line 15: input() → input.bool()
  • Line 56: input() → input.bool()
  • Line 57: input() → input.int()
  • Line 58: input() → input.int()
14 more edits
  • Line 59: input() → input.int()
  • Line 66: input() → input.float()
  • Line 97: input() → input.bool()
  • Line 99: input() → input.source()
  • Line 101: input() → input.int()
  • Line 102: input() → input.float()
  • Line 103: input() → input.bool()
  • Line 105: input() → input.bool()
  • Line 106: input() → input.bool()
  • Line 107: input() → input.bool()
  • Line 108: input() → input.int()
  • Line 211: when = slLongClose → if block
  • Line 212: when = slShortClose → if block
  • Line 213: when = closeLongCondition or closeShortCondition → if block
⋯// Inputs-a = input(2, title='Key Vaule. \'This changes the sensitivity\'')+a = input.int(2, title='Key Vaule. \'This changes the sensitivity\'')-c = input(6, title='ATR Period')+c = input.int(6, title='ATR Period')-h = input(false, title='Signals from Heikin Ashi Candles')+h = input.bool(false, title='Signals from Heikin Ashi Candles')xATR = ta.atr(c)⋯//indicator(title='[SHK] Schaff Trend Cycle (STC)', shorttitle='STC', overlay=false)-STCDivider = input(false, '░░░░░░░░░░░░░░░░░░░░░░░░░')+STCDivider = input.bool(false, '░░░░░░░░░░░░░░░░░░░░░░░░░')-EEEEEE = input(80, 'Length')+EEEEEE = input.int(80, 'Length')-BBBB = input(27, 'FastLength')+BBBB = input.int(27, 'FastLength')-BBBBB = input(50, 'SlowLength')+BBBBB = input.int(50, 'SlowLength')AAAA(BBB, BBBB, BBBBB) =>⋯AAAAA(EEEEEE, BBBB, BBBBB) =>-    AAA = input(0.5)+    AAA = input.float(0.5)    var CCCCC = 0.0⋯//study("Hull Suite by InSilico", overlay=true)-HullDivider = input(false, '░░░░░░░░░░░░░░░░░░░░░░░░░')+HullDivider = input.bool(false, '░░░░░░░░░░░░░░░░░░░░░░░░░')//INPUT-srcHull = input(close, title='Source')+srcHull = input.source(close, title='Source')modeSwitch = input.string('Hma', title='Hull Variation', options=['Hma', 'Thma', 'Ehma'])-length = input(55, title='Length(180-200 for floating S/R , 55 for swing entry)')+length = input.int(55, title='Length(180-200 for floating S/R , 55 for swing entry)')-lengthMult = input(1.0, title='Length multiplier (Used to view higher timeframes with straight band)')+lengthMult = input.float(1.0, title='Length multiplier (Used to view higher timeframes with straight band)')-useHtf = input(false, title='Show Hull MA from X timeframe? (good for scalping)')+useHtf = input.bool(false, title='Show Hull MA from X timeframe? (good for scalping)')htf = input.timeframe('240', title='Higher timeframe')-switchColor = input(true, 'Color Hull according to trend?')+switchColor = input.bool(true, 'Color Hull according to trend?')-candleCol = input(false, title='Color candles based on Hull\'s Trend?')+candleCol = input.bool(false, title='Color candles based on Hull\'s Trend?')-visualSwitch = input(true, title='Show as a Band?')+visualSwitch = input.bool(true, title='Show as a Band?')-thicknesSwitch = input(1, title='Line Thickness')+thicknesSwitch = input.int(1, title='Line Thickness')transpSwitch = input.int(40, title='Band Transparency', step=5)⋯    strategy.exit('TP4', profit=per(tp4))-    strategy.close('Long', qty_percent=100, comment='SL Long', when=slLongClose)+    if slLongClose+        strategy.close('Long', qty_percent=100, comment='SL Long')-    strategy.close('Short', qty_percent=100, comment='SL Short', when=slShortClose)+    if slShortClose+        strategy.close('Short', qty_percent=100, comment='SL Short')-    strategy.close_all(when=closeLongCondition or closeShortCondition, comment='Close Postion')+    if closeLongCondition or closeShortCondition+        strategy.close_all(comment='Close Postion')

Does it run in Pine Script v6?

No

The v6 version does not run in Zeal Terminal's engine: Pine Script v6 Error at @L132:C76: 'plot' has no 'transp' parameter in Pine Script v6. Use color.new(color, transparency) instead. The v6 version is shown for reference and is not offered as a download. It differs from the v5 version by 1 edit.

⋯// © myn-//@version=5+//@version=6strategy('Strategy Myth-Busting #1 - UT Bot+STC+Hull+ [MYN]', max_bars_back=5000, overlay=true, pyramiding=0, initial_capital=500, currency='USD', default_qty_type=strategy.percent_of_equity, default_qty_value=1.0, commission_value=0.075)⋯

Where it runs

EngineCompilesRunsMatches TradingView
Zeal Terminal · OpenPineScript v2Yes 98 msWith a workaround 1,000 bars in 160 msNot measured
PineTSNot testedNot testedNot measured

The engine's host API cannot yet declare a chart's symbol and timeframe, so this page sets them on the engine directly for each market.

“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/// © myn//@version=5strategy('Strategy Myth-Busting #1 - UT Bot+STC+Hull+ [MYN]', max_bars_back=5000, overlay=true, pyramiding=0, initial_capital=500, currency='USD', default_qty_type=strategy.percent_of_equity, default_qty_value=1.0, commission_value=0.075)///////////////////////////////////////* Put your strategy logic below */////////////////////////////////////////2oVDibie_bk/// UT Bot Alerts by QuantNomad - https://www.tradingview.com/script/n8ss8BID-UT-Bot-Alerts/// ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░//study(title="UT Bot Alerts", overlay = true)// Inputsa = input(2, title='Key Vaule. \'This changes the sensitivity\'')c = input(6, title='ATR Period')h = input(false, title='Signals from Heikin Ashi Candles')xATR = ta.atr(c)nLoss = a * xATRsrc = h ? request.security(ticker.heikinashi(syminfo.tickerid), timeframe.period, close, lookahead=barmerge.lookahead_off) : closexATRTrailingStop = 0.0iff_1 = src > nz(xATRTrailingStop[1], 0) ? src - nLoss : src + nLossiff_2 = src < nz(xATRTrailingStop[1], 0) and src[1] < nz(xATRTrailingStop[1], 0) ? math.min(nz(xATRTrailingStop[1]), src + nLoss) : iff_1xATRTrailingStop := src > nz(xATRTrailingStop[1], 0) and src[1] > nz(xATRTrailingStop[1], 0) ? math.max(nz(xATRTrailingStop[1]), src - nLoss) : iff_2pos = 0iff_3 = src[1] > nz(xATRTrailingStop[1], 0) and src < nz(xATRTrailingStop[1], 0) ? -1 : nz(pos[1], 0)pos := src[1] < nz(xATRTrailingStop[1], 0) and src > nz(xATRTrailingStop[1], 0) ? 1 : iff_3xcolor = pos == -1 ? color.red : pos == 1 ? color.green : color.blueema = ta.ema(src, 1)above = ta.crossover(ema, xATRTrailingStop)below = ta.crossover(xATRTrailingStop, ema)buy = src > xATRTrailingStop and abovesell = src < xATRTrailingStop and belowbarbuy = src > xATRTrailingStopbarsell = src < xATRTrailingStop//plotshape(buy,  title = "Buy",  text = 'Buy',  style = shape.labelup,   location = location.belowbar, color= color.green, textcolor = color.white, transp = 0, size = size.tiny)//plotshape(sell, title = "Sell", text = 'Sell', style = shape.labeldown, location = location.abovebar, color= color.red,   textcolor = color.white, transp = 0, size = size.tiny)barcolor(barbuy ? color.green : na)barcolor(barsell ? color.red : na)alertcondition(buy, 'UT Long', 'UT Long')alertcondition(sell, 'UT Short', 'UT Short')/////////////////////////////////////////////////======[ Position Check (long/short) ]======/////////////////////////////////////////////////last_longCondition = float(na)last_shortCondition = float(na)last_longCondition := buy ? time : nz(last_longCondition[1])last_shortCondition := sell ? time : nz(last_shortCondition[1])in_longCondition = last_longCondition > last_shortConditionin_shortCondition = last_shortCondition > last_longConditionUTBotBuyZone = in_longConditionUTBotSellZone = in_shortCondition/// STC Indicator - A Better MACD [SHK] By shayankm - https://www.tradingview.com/script/WhRRThMI-STC-Indicator-A-Better-MACD-SHK/// ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░//[SHK] STC colored indicator//https://www.tradingview.com/u/shayankm///indicator(title='[SHK] Schaff Trend Cycle (STC)', shorttitle='STC', overlay=false)STCDivider = input(false, '░░░░░░░░░░░░░░░░░░░░░░░░░')EEEEEE = input(80, 'Length')BBBB = input(27, 'FastLength')BBBBB = input(50, 'SlowLength')AAAA(BBB, BBBB, BBBBB) =>    fastMA = ta.ema(BBB, BBBB)    slowMA = ta.ema(BBB, BBBBB)    AAAA = fastMA - slowMA    AAAAAAAAA(EEEEEE, BBBB, BBBBB) =>    AAA = input(0.5)    var CCCCC = 0.0    var DDD = 0.0    var DDDDDD = 0.0    var EEEEE = 0.0    BBBBBB = AAAA(close, BBBB, BBBBB)    CCC = ta.lowest(BBBBBB, EEEEEE)    CCCC = ta.highest(BBBBBB, EEEEEE) - CCC    CCCCC := CCCC > 0 ? (BBBBBB - CCC) / CCCC * 100 : nz(CCCCC[1])    DDD := na(DDD[1]) ? CCCCC : DDD[1] + AAA * (CCCCC - DDD[1])    DDDD = ta.lowest(DDD, EEEEEE)    DDDDD = ta.highest(DDD, EEEEEE) - DDDD    DDDDDD := DDDDD > 0 ? (DDD - DDDD) / DDDDD * 100 : nz(DDDDDD[1])    EEEEE := na(EEEEE[1]) ? DDDDDD : EEEEE[1] + AAA * (DDDDDD - EEEEE[1])    EEEEEmAAAAA = AAAAA(EEEEEE, BBBB, BBBBB)mColor = mAAAAA > mAAAAA[1] ? color.new(color.green, 20) : color.new(color.red, 20)if mAAAAA[3] <= mAAAAA[2] and mAAAAA[2] > mAAAAA[1] and mAAAAA > 75    alert('Red', alert.freq_once_per_bar)if mAAAAA[3] >= mAAAAA[2] and mAAAAA[2] < mAAAAA[1] and mAAAAA < 25    alert('Green', alert.freq_once_per_bar)//plot(mAAAAA, color=mColor, title='STC', linewidth=2)//ul = plot(25, color=color.new(color.white, 0 ))//ll = plot(75, color=color.new(color.purple, 0))//fill(ul, ll, color=color.new(color.gray, 96))STCGreenAndBelow25AndRising = mAAAAA > mAAAAA[1] and mAAAAA < 25STCRedAndAndAbove75AndFalling = mAAAAA < mAAAAA[1] and mAAAAA > 75/// Hull Suite by InSilico// ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░//Basic Hull Ma Pack tinkered by InSilico - https://www.tradingview.com/script/hg92pFwS-Hull-Suite///study("Hull Suite by InSilico", overlay=true)HullDivider = input(false, '░░░░░░░░░░░░░░░░░░░░░░░░░')//INPUTsrcHull = input(close, title='Source')modeSwitch = input.string('Hma', title='Hull Variation', options=['Hma', 'Thma', 'Ehma'])length = input(55, title='Length(180-200 for floating S/R , 55 for swing entry)')lengthMult = input(1.0, title='Length multiplier (Used to view higher timeframes with straight band)')useHtf = input(false, title='Show Hull MA from X timeframe? (good for scalping)')htf = input.timeframe('240', title='Higher timeframe')switchColor = input(true, 'Color Hull according to trend?')candleCol = input(false, title='Color candles based on Hull\'s Trend?')visualSwitch = input(true, title='Show as a Band?')thicknesSwitch = input(1, title='Line Thickness')transpSwitch = input.int(40, title='Band Transparency', step=5)//FUNCTIONS//HMAHMA(_src, _length) =>    ta.wma(2 * ta.wma(_src, _length / 2) - ta.wma(_src, _length), math.round(math.sqrt(_length)))//EHMA    EHMA(_src, _length) =>    ta.ema(2 * ta.ema(_src, _length / 2) - ta.ema(_src, _length), math.round(math.sqrt(_length)))//THMA    THMA(_src, _length) =>    ta.wma(ta.wma(_src, _length / 3) * 3 - ta.wma(_src, _length / 2) - ta.wma(_src, _length), _length)//SWITCHMode(modeSwitch, src, len) =>    modeSwitch == 'Hma' ? HMA(src, len) : modeSwitch == 'Ehma' ? EHMA(src, len) : modeSwitch == 'Thma' ? THMA(src, len / 2) : na//OUT_hull = Mode(modeSwitch, srcHull, int(length * lengthMult))HULL = useHtf ? request.security(syminfo.ticker, htf, _hull) : _hullMHULL = HULL[0]SHULL = HULL[2]//COLORhullColor = switchColor ? HULL > HULL[2] ? #00ff00 : #ff0000 : #ff9800//PLOT///< FrameFi1 = plot(MHULL, title='MHULL', color=hullColor, linewidth=thicknesSwitch, transp=50)Fi2 = plot(visualSwitch ? SHULL : na, title='SHULL', color=hullColor, linewidth=thicknesSwitch, transp=50)alertcondition(ta.crossover(MHULL, SHULL), title='Hull trending up.', message='Hull trending up.')alertcondition(ta.crossover(SHULL, MHULL), title='Hull trending down.', message='Hull trending down.')///< Ending Fillerfill(Fi1, Fi2, title='Band Filler', color=hullColor, transp=transpSwitch)///BARCOLORbarcolor(color=candleCol ? switchColor ? hullColor : na : na)HullGreen = hullColor == #00ff00HullRed = hullColor == #ff0000////////////////////////////////////////* Put your strategy rules below *///////////////////////////////////////longCondition = STCGreenAndBelow25AndRising and HullGreen and UTBotBuyZoneshortCondition = STCRedAndAndAbove75AndFalling and HullRed and UTBotSellZone//define as 0 if do not want to usecloseLongCondition = 0closeShortCondition = 0//░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░useStartPeriodTime = input.bool(true, 'Start', group='Date Range', inline='Start Period')startPeriodTime = input.time(timestamp('1 Jan 2019'), '', group='Date Range', inline='Start Period')useEndPeriodTime = input.bool(true, 'End', group='Date Range', inline='End Period')endPeriodTime = input.time(timestamp('31 Dec 2030'), '', group='Date Range', inline='End Period')start = useStartPeriodTime ? startPeriodTime >= time : falseend = useEndPeriodTime ? endPeriodTime <= time : falsecalcPeriod = not start and not end// Trade Direction // ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░tradeDirection = input.string('Long and Short', title='Trade Direction', options=['Long and Short', 'Long Only', 'Short Only'], group='Trade Direction')// Percent as Points// ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░per(pcnt) =>    strategy.position_size != 0 ? math.round(pcnt / 100 * strategy.position_avg_price / syminfo.mintick) : float(na)// Take profit 1// ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░tp1 = input.float(title='Take Profit 1 - Target %', defval=100, minval=0.0, step=0.5, group='Take Profit', inline='Take Profit 1')q1 = input.int(title='% Of Position', defval=100, minval=0, group='Take Profit', inline='Take Profit 1')// Take profit 2// ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░tp2 = input.float(title='Take Profit 2 - Target %', defval=100, minval=0.0, step=0.5, group='Take Profit', inline='Take Profit 2')q2 = input.int(title='% Of Position', defval=100, minval=0, group='Take Profit', inline='Take Profit 2')// Take profit 3// ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░tp3 = input.float(title='Take Profit 3 - Target %', defval=100, minval=0.0, step=0.5, group='Take Profit', inline='Take Profit 3')q3 = input.int(title='% Of Position', defval=100, minval=0, group='Take Profit', inline='Take Profit 3')// Take profit 4// ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░tp4 = input.float(title='Take Profit 4 - Target %', defval=100, minval=0.0, step=0.5, group='Take Profit')/// Stop Loss// ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░stoplossPercent = input.float(title='Stop Loss (%)', defval=15, minval=0.01, group='Stop Loss') * 0.01slLongClose = close < strategy.position_avg_price * (1 - stoplossPercent)slShortClose = close > strategy.position_avg_price * (1 + stoplossPercent)/// Leverage// ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░leverage = input.float(1, 'Leverage', step=.5, group='Leverage')contracts = math.min(math.max(.000001, strategy.equity / close * leverage), 1000000000)/// Trade State Management// ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░isInLongPosition = strategy.position_size > 0isInShortPosition = strategy.position_size < 0/// ProfitView Alert Syntax String Generation// ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░alertSyntaxPrefix = input.string(defval='PV-AccountNameHere_Strategy-Name-Here', title='Alert Syntax Prefix', group='ProfitView Alert Syntax')alertSyntaxBase = alertSyntaxPrefix + '\n#' + str.tostring(open) + ',' + str.tostring(high) + ',' + str.tostring(low) + ',' + str.tostring(close) + ',' + str.tostring(volume) + ','/// Trade Execution// ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░if calcPeriod    if longCondition and tradeDirection != 'Short Only' and isInLongPosition == false        strategy.entry('Long', strategy.long, qty=contracts)        alert(message=alertSyntaxBase + 'side:long', freq=alert.freq_once_per_bar_close)    if shortCondition and tradeDirection != 'Long Only' and isInShortPosition == false        strategy.entry('Short', strategy.short, qty=contracts)        alert(message=alertSyntaxBase + 'side:short', freq=alert.freq_once_per_bar_close)    //Inspired by Multiple %% profit exits example By adolgo https://www.tradingview.com/script/kHhCik9f-Multiple-profit-exits-example/    strategy.exit('TP1', qty_percent=q1, profit=per(tp1))    strategy.exit('TP2', qty_percent=q2, profit=per(tp2))    strategy.exit('TP3', qty_percent=q3, profit=per(tp3))    strategy.exit('TP4', profit=per(tp4))    strategy.close('Long', qty_percent=100, comment='SL Long', when=slLongClose)    strategy.close('Short', qty_percent=100, comment='SL Short', when=slShortClose)    strategy.close_all(when=closeLongCondition or closeShortCondition, comment='Close Postion')