Zeal Terminal Open in Zeal Terminal

Pine Script v5 · Strategy

CITI Moku Strategy(Free) by @MiaIsTheNewBird

A Pine Script v5 strategy built on ATR (length), Cross (src, spt) and Crossover (close, tenkan). It has 7 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 25% of equity and pays 0.025 commission. 111 settings; defaults include Tenkan 9, Tenkan mult 2. and Kijun 26.

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 CITI Moku Strategy(Free) by @MiaIsTheNewBird repaint?
Yes
At least one pattern in the source can repaint: intrabar recalculation.
How did CITI Moku Strategy(Free) by @MiaIsTheNewBird do on BTCUSDT 1D with default settings?
−8.74%
From 26 Jan 2024 to 21 Oct 2026, over 48 closed trades, against +102.5% for buy and hold. A backtest, not investment advice.
Does CITI Moku Strategy(Free) by @MiaIsTheNewBird 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: 48 before, 48 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 CITI Moku Strategy(Free) by @MiaIsTheNewBird use a stop loss?
Yes
strategy.exit sets a stop on line 407, 408, 409, 410, 411.
Does CITI Moku Strategy(Free) by @MiaIsTheNewBird run in Zeal Terminal?
Yes
It compiles in 228 ms and runs 1,000 bars in 600 ms, in the browser.

BTCUSDT · 1D · default settings

  • Tenkan-Sen
  • Kinjun-Sen
  • Chikou Span
  • Senkou Span A
  • Senkou Span B
  • Moving Average 1
  • Price
  • Bullish Signals
  • Long Exit
  • Bearish Signals
  • Short Exit
  • 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 (107)
🔰CITI Moku (Fr40,00060,00080,000100,000120,000AprJulOct2025AprJulOct2026AprJulOct$9,066$20,253Equity from $10,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. Lines, boxes and labels are the script's own drawings, the most recent ones its limits keep. 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
−8.74%
−$873.93
Buy and hold
+102.5%
same period
Closed trades
48
34 won · 14 lost
Profitable
70.8%
of closed trades
Profit factor
0.81
gross profit ÷ gross loss
Max drawdown
16.60%
−$1,660.12

One run with the author's default settings, $10,000 starting capital, commission as the script sets it. A long 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.

  • Note

    13 settings have no label

    In the settings dialog tenkan_mult (line 21), kijun_mult (line 23), spanB_mult (line 25), FilterType1MAType (line 159), FilterType1Len (line 160), setmaxLosingStreak (line 202), setmaxWinStreak (line 204), setmaxLosingDaysStreak (line 206), setMaxDrawdown (line 208), setMaxIntradayLoss (line 210), setNumberDailyTrades (line 212), setNumberWeeklyTrades (line 214), ontpBE (line 280) show an empty name. The labels on this page come from the variable names.

Settings

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

SettingDefaultType and rangeFeeds
Ichimoku Lines & Cloud Settings
Tenkan9inttenkan
Tenkan mult (no label in the script)2.floattenkan
Kijun26intkijun
Kijun mult (no label in the script)8.floatkijun
Senkou Span B52intsenkouB
Span B mult (no label in the script)8.floatsenkouB
Chikou Offset26intChikou Span
Kumo Offset26intSenkou Span A Senkou Span B Filter2Long Filter2Short Filter3Long Filter3Short Filter4Long Filter4Short
Entry Signals Settings - Select Conditions for Entry
Price Crossing Tenkan LinefalseboolEntry1Long Entry1Short
Tenkan Line Crossing Kijun LinetrueboolEntry2Long Entry2Short
Price Crossing Kijun LinefalseboolEntry3Long Entry3Short
Exit Signals Settings- Use as Indicator
Price Crossunder Tenkan LinefalseboolExit1Long Exit1Short
Tenkan Line Crossunder Kijun LinetrueboolExit2Long Exit2Short
Price Crossunder Kijun LinefalseboolExit3Long Exit3Short
Use as Indicator
Plot Buy Tradestrueboolplotshape
Plot Sell Tradestrueboolplotshape
Plot Buy- Exit Tradestrueboolplotshape
Plot Sell- Exit Tradestrueboolplotshape
Trade Direction
Long Deals trueboolgoLong
Short DealstrueboolgoShort
TP-SL Strategy
Wait End Deal trueboolgoLong goShort
ReEntry Deal truebooldirection
𝐓𝐚𝐤𝐞 𝐏𝐫𝐨𝐟𝐢𝐭ATR TPstring · options ['None', 'FIXED %', 'FIXED $', 'ATR TP', 'R:R', 'HH / LL']TypeStop stop0 tpcolor Take Stop line 305 line 310 line 328 line 340 line 350 plotchar
𝐒𝐭𝐨𝐩 𝐋𝐨𝐬𝐬 Fixed%- Fixed SL/TP in percent. \n' + 'Fixed$- Fixed SL/TP in cash. \n' + 'Trailing %- Trailing stop in % like on exchanges. Regulated by the "Trailing%" parameter. \n' + 'Fast Trail- If in a long, it immediately follows the price when it rises otherwise it stands still. Vice versa for shorts. Regulated by the "Trailing% parameter. \n' + 'ATR - Fixed TP/SL depending on the current ATR. It is regulated by the "ATR period" | "Multiplier" parameters. \n' + 'R:R- Risk Reward sets the TP depending on the size of the SL. For example, if SL is $100, and R:R = 2, then the TP is $200. \n' + 'HH/LL- Searches for the last Extremum (High/Low) for the specified number of bars and sets a fixed Take. \n' + 'LO/HI Sets the SL for High/Low candles. "LO/HI" = 1 Sets the SL for the last High/Low. \n' + 'MA- Movinng Average SL. A very diverse type of SL.ATR SLstring · options ['None', 'FIXED %', 'FIXED $', 'TRAILING', 'FAST TRAIL', 'ATR SL','ATR TRAIL','LO / HI', 'MA']DynamicStops TypeStop line 307 line 312 line 315 line 321 line 332 line 335 line 345
Profit % 4.5float · min 0.1 · step 0.1tpPrice
Stop % 1.5float · min 0.1 · step 0.1slPrice
Profit $ 333float · min 1 · step 5tpPrice
Stop $ 100float · min 1 · step 5slPrice
ATR TP Period 30int · min 1 · step 1StopATRTP
TP Multiplier3float · min 0.1 · step 0.1StopATRTP
ATR SL Period 30int · min 1 · step 1StopATRSL
SL Multiplier4float · min 0.1 · step 0.1StopATRSL
Trailing % 3float · min 0.1 · step 0.1StopL StopS stop
R:R 1:2float · min 0.5 · step 0.1tpPrice
Fixed RR𝐅𝐢𝐱𝐞𝐝 𝗥:𝗥 ➖ If the stop loss is Dynamic (Trailing or MA) then R:R can also be made Dynamictrueboolcheck
HH / LL 200int · min 1 · step 5HiStop LoStop
LO / HI 5int · min 1 · step 1HiStop LoStop
Add %𝐀𝐝𝐝 % ➖ If true, then with the "𝗦𝘁𝗼𝗽 %" parameter you can add percentages to any of the current SL. \nCan be especially useful when using Stop - 𝗔𝗧𝗥 or 𝗠𝗔 or 𝗟𝗢/𝗛𝗜. \nFor example with 𝗟𝗢/𝗛𝗜 to put a stop for the last High/Low and add 0.5% additional Stoplossfalseboolline 354
MA StopEMAstring · options ['EMA', 'HMA','SMA']maSType
Len15int · min 1 · step 2maSType
Step𝐌𝐀 𝐒𝐭𝐨𝐩 ➖ allows to choose which MA to use. \n𝐋𝐞𝐧 ➖ Length of chosen MA. \n𝐒𝐭𝐞𝐩 ➖% step of change MA. Step = 0 will use the selected MA without changes. \nWARNING: When 𝐀𝐝𝐝 % is on, the MA calculation changes..0.1float · min 0 · step 0.1Stop
Take Profit Levels
🇹🇵¹trueboolslbecheck exit End_1 TP 1
�5int · min 1 · max 100 · step 5exit End_1
🇹🇵²falseboolslbecheck exit End_2 TP 2
�20int · min 1 · max 100 · step 5exit End_2
🇹🇵³falseboolslbecheck exit End_3 TP 3
�50int · min 1 · max 100 · step 5exit End_3
🇸🇱⁰ falseboolexit End_0 SL 0
�30int · min 1 · max 100 · step 5exit End_0
Paint Strategy and TP/SL on ChartPlots trades for TP-SL StrategyfalseboolplotColx plotColy Take Stop Price plotchar TP 1 TP 2 TP 3 SL 0
SL 0 Position1int · min 1 · max 2stop0
Ontp BE (no label in the script)falseboolline 384
Breakeven on TP𝐒𝐋 𝟎 𝐏𝐨𝐬𝐢𝐭𝐢𝐨𝐧 ➖ Changes the position of the intermediate Stop Loss.\nThe value = 3 - the middle. \n𝐁𝐫𝐞𝐚𝐤𝐞𝐯𝐞𝐧 𝐨𝐧 𝐓𝐏 ➖ If true Set StopLoss to Breakeven after the specified TakeProfit is reached.2int · min 1 · max 3slbecheck slbe
CoolDown # BarsDo Not open a new position until # bars have passed since the last trade.\nValue=0 - disables the function.0int · min 0checkCoolDwn
Colors: FGcolor.new(color.teal,70)colorplotColx tpcolor Take plotchar
Bearcolor (no label in the script)color.new(color.red,70)colorplotColx Stop plotchar SL 0
BGcolor.new(color.teal,80)colorplotColy fill
Bearcolorb (no label in the script)color.new(color.red,80)colorplotColy fill
📆 Time Filter 📆
trueboolstart ftimestamp
trueboolend etimestamp
Start Timeㅤㅤtimestamp('UTC 01 Jan 2020 00:00')timestart ftimestamp
End Time ㅤ ㅤtimestamp('UTC 31 Dec 2050 23:45')timeend etimestamp
Time Session 00:00 - 00:00 to disable.0000-0000sessionses
UTC Match this time zone with that of your graph so that all values are displayed correctly.UTCstring · options ["UTC-10", "UTC-8", "UTC-7", "UTC-6", "UTC-5", "UTC-4", "UTC-3", "UTC", "UTC+1", "UTC+2", "UTC+3", "UTC+4", "UTC+4:30", "UTC+5", "UTC+5:30", "UTC+6", "UTC+7", "UTC+8", "UTC+9", "UTC+9:30", "UTC+10", "UTC+11", "UTC+12", "UTC+12:45", "UTC+13"]ses monF tueF wedF thuF friF satF sunF ftimestamp etimestamp
Monㅤ trueboolmonF
Tueㅤ truebooltueF
Wedㅤ trueboolwedF
Thuㅤ trueboolthuF
Friㅤ trueboolfriF
Satㅤ trueboolsatF
Sunㅤ trueboolsunF
Signal Filters
1. MA FiltertrueboolFilter1Ma Filter1Long Filter1Short
Filter Type1MAType (no label in the script)EMAstring · options ['EMA','HMA','SMA']ma Filter1Ma
Filter Type1Len (no label in the script)MA Type, MA Source, MA Length\nLong = close > MA\nShort = close < MA21int · min 1ma Filter1Ma
Show MA Line?falseboolMoving Average 1
2. Above/Below Kumo Cloud SettingstrueboolFilter2Long Filter2Short
3. Bullish/Bearish Kumo Cloud Filter SettingsfalseboolFilter3Long Filter3Short
4. Bullish/Bearish Kijun Filter SettingsfalseboolFilter4Long Filter4Short
Risk Management
Setmax Losing Streak (no label in the script)falseboolokToTradeLossStreak
Loss Streak 15int · min 1okToTradeLossStreak
Setmax Win Streak (no label in the script)falseboolokToTradeWinStreak
Win Streak 𝐋𝐨𝐬𝐬 𝐒𝐭𝐫𝐞𝐚𝐤 ➖ Set Max number of consecutive loss trades. \n𝐖𝐢𝐧 𝐒𝐭𝐫𝐞𝐚𝐤 ➖ Max Winning Streak Length.15int · min 1okToTradeWinStreak
Setmax Losing Days Streak (no label in the script)falseboolcountConsLossDays
Row Loss InDay3int · min 1countConsLossDays
Set Max Drawdown (no label in the script)falseboolcondmaxdrawdown
DrawDown %𝐑𝐨𝐰 𝐋𝐨𝐬𝐬 𝐈𝐧𝐃𝐚𝐲 ➖ Max of consecutive days with a loss in a row. \n𝐃𝐫𝐚𝐰𝐃𝐨𝐰𝐧% ➖ Max DrawDown (in % of strategy equity).10int · min 1 · max 100condmaxdrawdown
Set Max Intraday Loss (no label in the script)falseboolcondintradayloss
InDay Loss % 3int · min 1 · max 100condintradayloss
Set Number Daily Trades (no label in the script)falsebooltradesIntradayCount
Daily Trades 𝐈𝐧𝐃𝐚𝐲 𝐋𝐨𝐬𝐬 % ➖ Set Max Intraday Loss. \n𝐃𝐚𝐢𝐥𝐲 𝐓𝐫𝐚𝐝𝐞𝐬 ➖ Limit the number of MAX trades per day.10int · min 1 · max 100tradesIntradayCount
Set Number Weekly Trades (no label in the script)falseboolokToTradeWeekly
Weekly Trades𝐖𝐞𝐞𝐤𝐥𝐲 𝐓𝐫𝐚𝐝𝐞𝐬 ➖ Limit the number of MAX trades per week.50int · min 1 · max 100okToTradeWeekly
Order SizeEQUITYstring · options ['NONE', 'EQUITY', 'SIZE', 'CONTRACTS']eqty line 397
Use Net Profit𝐔𝐬𝐞 𝐍𝐞𝐭 𝐏𝐫𝐨𝐟𝐢𝐭 ➖ On/Off the use of profit in the following trades. *Only works if the type is EQUITYtrueboolline 397
​🇪​​🇶​​🇺​​🇮​​🇹​​🇾​30int · min 1 · max 100eqty
​🇸​​🇮​​🇿​​🇪1000int · min 1eqty
​🇨​​🇴​​🇳​​🇹​​🇷​​🇦​​🇨​​🇹​​🇸​𝐎𝐫𝐝𝐞𝐫 𝐒𝐢𝐳𝐞: \n𝐍𝐎𝐍𝐄 ➖ Use the default position size settings in Tab "Properties". \n𝐄𝐐𝐔𝐈𝐓𝐘 ➖ % per trade from the initial capital. \n𝐒𝐈𝐙𝐄 ➖ Fixed size amount of trade. \n𝐂𝐎𝐍𝐓𝐑𝐀𝐂𝐓𝐒 ➖ The fixed amount of the deal in contracts. \n1int · min 1eqty
API for Long Bot Alerts
API Long Entrytext_areaentry Short
API for Short Bot Alerts
API Short Entrytext_areaentry Short
API TP-SL Strategy Exit Alerts
API Exit 0text_areaexit End_0
API Exit 1text_areaexit End_1
API Exit 2text_areaexit End_2
API Exit 3text_areaexit End_3
API Exit Xtext_areaexit End_X
📊 Plots 📊
Plot Dashboard trueboolla
Profit ㅤ ㅤ🟢 if > to:0.1floatstatusProfit
ㅤ🔴 if < to: 0floatstatusProfit
Win Rateㅤ🟢 if > to: 70float · min 0 · max 100statusWinRate
ㅤ🔴 if < to: 50float · min 0 · max 100statusWinRate
P. Factorㅤ🟢 if > to: 2float · min 0statusPFactor
ㅤ🔴 if < to: 1float · min 0statusPFactor

What it calculates

  • ATRlengthatr · line 30
  • Crosssrc, sptmax · line 40
  • Crosssrc, sptmin · line 41
  • Crossoverclose, tenkanEntry1Long · line 61
  • Crossovertenkan, kijunEntry2Long · line 62
  • Crossoverclose, kijunEntry3Long · line 63
  • Crossunderclose, tenkanEntry1Short · line 64
  • Crossundertenkan, kijunEntry2Short · line 65
  • Crossunderclose, kijunEntry3Short · line 66
  • Crossunderclose, tenkanExit1Long · line 75
  • Crossundertenkan, kijunExit2Long · line 76
  • Crossunderclose, kijunExit3Long · line 77
  • Crossoverclose, tenkanExit1Short · line 78
  • Crossovertenkan, kijunExit2Short · line 79
  • Crossoverclose, kijunExit3Short · line 80
  • ATR ATR TP Period (30)StopATRTP · line 327
  • ATR ATR SL Period (30)StopATRSL · line 331
  • Highesthigh, HH / LL (200)HiStop · line 341
  • Lowestlow, HH / LL (200)LoStop · line 342
  • Valuewhenbarstate.isfirst, time, 0 · chosen by UTC ftimestamp · line 485

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

Order rules

OrderFires whenBy defaultLine
Open Short longgoLongOn400
Open Short shortgoShortOn403
Exit End_0 stop and limitinTradeOn407
Exit End_1 stop and limitinTradeOn408
Exit End_2 stop and limitinTradeOn409
Exit End_3 stop and limitinTradeOn410
Exit End_X stop and limitinTradeOn411

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.

14/14trades 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. On 11 of them the position changed while the bar was forming before it settled. Anyone watching live sees those changes; once the bar closes it matches history.
  • ClearHigher-timeframe dataThe script requests no other symbol or timeframe.
  • ClearFuture-bar referencesNo negative history offsets such as close[-1].
  • CheckIntrabar recalculationuses varip; reads 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.

MarketNetBuy and holdTradesWonProfit factorMax drawdownPeriod
BTCUSDT 1D−8.7%+102.5%4871%0.8116.6%26 Jan 2024 – 21 Oct 2026
BTCUSDT 4h−2.8%+5.5%3669%0.764.5%8 May 2026 – 21 Oct 2026
ETHUSDT 1D−13.1%+9.8%5074%0.8217.8%26 Jan 2024 – 21 Oct 2026
ETHUSDT 4h+4.2%+8.4%4678%1.275.4%8 May 2026 – 21 Oct 2026
SOLUSDT 1D−29.2%+16.7%3569%0.5437.9%26 Jan 2024 – 21 Oct 2026
SOLUSDT 4h+3.4%+21.5%5573%1.158.7%8 May 2026 – 21 Oct 2026
BNBUSDT 1D−19.7%+148.3%4965%0.6531.0%26 Jan 2024 – 21 Oct 2026
BNBUSDT 4h+0.0%+17.1%4971%1.006.3%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 market1669%−$271.55
Sideways market2273%−$490.69
Falling market1070%−$111.00

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

How bad could the drawdown be?

27.2%

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

0%31%
All 48 trades
SideEntryExitBarsP&L
short2 May 2024 58,365.0020 May 2024 71,023.7018−$32.62
short2 May 2024 58,365.0020 May 2024 71,023.7018−$619.71
short30 Jun 2024 60,986.704 Jul 2024 59,355.204$3.68
short30 Jun 2024 60,986.705 Jul 2024 54,460.905$283.81
short6 Jul 2024 56,628.808 Jul 2024 54,924.702$4.28
short6 Jul 2024 56,628.8017 Jul 2024 65,717.4011−$442.21
short5 Aug 2024 58,161.006 Aug 2024 54,018.801$9.76
short5 Aug 2024 58,161.0020 Oct 2024 69,169.8076−$497.58
long7 Nov 2024 75,572.0010 Nov 2024 77,341.103$2.99
long7 Nov 2024 75,572.0011 Nov 2024 82,648.204$231.12
long12 Nov 2024 88,648.0013 Nov 2024 90,667.701$2.99
long12 Nov 2024 88,648.0021 Nov 2024 96,726.809$230.96
long22 Nov 2024 98,317.105 Dec 2024 100,582.0013$3.10
long22 Nov 2024 98,317.1016 Dec 2024 107,375.0024$239.60
long17 Dec 2024 106,059.0030 Dec 2024 91,640.5013−$19.28
long17 Dec 2024 106,059.0030 Dec 2024 91,640.5013−$366.23
long3 Jan 2025 96,984.806 Jan 2025 99,745.003$3.79
long3 Jan 2025 96,984.8020 Jan 2025 108,025.0017$291.76
long21 Jan 2025 102,260.0022 Jan 2025 106,144.001$5.24
long21 Jan 2025 102,260.0026 Feb 2025 85,787.2036−$429.57
short27 Feb 2025 84,250.1028 Feb 2025 81,429.701$4.41
short27 Feb 2025 84,250.108 May 2025 99,291.9070−$454.54
long9 May 2025 103,262.0012 May 2025 105,644.003$2.86
long9 May 2025 103,262.0010 Jul 2025 112,790.0062$221.12
long11 Jul 2025 116,010.0012 Jul 2025 118,158.001$2.35
long11 Jul 2025 116,010.005 Oct 2025 124,604.0086$181.96
long6 Oct 2025 123,482.0010 Oct 2025 112,815.004−$11.55
long6 Oct 2025 123,482.0010 Oct 2025 112,815.004−$219.44
short17 Oct 2025 108,194.003 Nov 2025 105,477.0017$3.19
short17 Oct 2025 108,194.0014 Nov 2025 97,324.8028$246.01
short15 Nov 2025 94,594.0017 Nov 2025 91,710.102$4.00
short15 Nov 2025 94,594.0021 Nov 2025 83,058.406$307.52
short22 Nov 2025 85,129.4030 Jan 2026 82,095.5069$4.85
short22 Nov 2025 85,129.403 Feb 2026 72,993.8073$372.31
short4 Feb 2026 75,770.205 Feb 2026 73,165.801$4.86
short4 Feb 2026 75,770.205 Feb 2026 66,081.301$347.52
short6 Feb 2026 62,909.9017 Apr 2026 77,965.6070−$35.71
short6 Feb 2026 62,909.9017 Apr 2026 77,965.6070−$678.42
long27 Apr 2026 78,657.604 May 2026 80,585.007$3.32
long27 Apr 2026 78,657.602 Jun 2026 68,377.7036−$344.24
short3 Jun 2026 66,760.804 Jun 2026 64,142.801$5.15
short3 Jun 2026 66,760.805 Jun 2026 59,950.602$256.63
short6 Jun 2026 61,056.5024 Jun 2026 59,271.7018$3.94
short6 Jun 2026 61,056.5020 Aug 2026 70,575.3075−$407.07
long21 Aug 2026 73,027.0022 Aug 2026 78,338.001$9.45
long21 Aug 2026 73,027.0022 Aug 2026 78,800.801$195.36
long23 Aug 2026 77,074.9024 Aug 2026 78,542.701$2.48
long23 Aug 2026 77,074.9021 Sep 2026 82,946.0029$192.58

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
CITI Moku Strategy(Free) by @MiaIsTheNewBird this page—v5 strategy−8.7%4816.6%
Positive Bars - Strategy by tweakerIDlowest highest valuewhen atrv4 strategy−40.3%754.7%
Big Bar Strategy by tweakerIDlowest highest valuewhen atrv4 strategy−56.6%1357.1%
SuperTrend Multi Time Frame Long and Short Trading Strategy by ranga_technologiesatr highest lowest valuewhenv5 strategyNo trades on this market
Inside Bar Strategy w- SL by tweakerIDlowest highest valuewhen atrv4 strategy−61.3%2565.0%
Modulo Logic + EMA Strat by tweakerIDlowest highest valuewhen atrv4 strategy−50.8%1654.7%

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.

  • 8 settings use the untyped input() (line 20, 21, 22, 23, 24, 25, 26, 27). 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 48 trades and the same P&L on BTCUSDT 1D, 1,000 bars, in Zeal Terminal's engine.

  • Line 20: input() → input.int()
  • Line 21: input() → input.float()
  • Line 22: input() → input.int()
  • Line 23: input() → input.float()
  • Line 24: input() → input.int()
  • Line 25: input() → input.float()
  • Line 26: input() → input.int()
  • Line 27: input() → input.int()
⋯//-------------------------------------------------------------------------------tenkan_len  = input(9,'Tenkan',inline='tenkan',group="Ichimoku Lines & Cloud Settings")+tenkan_len  = input.int(9,'Tenkan',inline='tenkan',group="Ichimoku Lines & Cloud Settings")-tenkan_mult = input(2.,'',inline='tenkan',group="Ichimoku Lines & Cloud Settings")+tenkan_mult = input.float(2.,'',inline='tenkan',group="Ichimoku Lines & Cloud Settings")-kijun_len   = input(26,'Kijun',inline='kijun',group="Ichimoku Lines & Cloud Settings")+kijun_len   = input.int(26,'Kijun',inline='kijun',group="Ichimoku Lines & Cloud Settings")-kijun_mult  = input(8.,'',inline='kijun',group="Ichimoku Lines & Cloud Settings")+kijun_mult  = input.float(8.,'',inline='kijun',group="Ichimoku Lines & Cloud Settings")-spanB_len   = input(52,'Senkou Span B',inline='span',group="Ichimoku Lines & Cloud Settings")+spanB_len   = input.int(52,'Senkou Span B',inline='span',group="Ichimoku Lines & Cloud Settings")-spanB_mult  = input(8.,'',inline='span',group="Ichimoku Lines & Cloud Settings")+spanB_mult  = input.float(8.,'',inline='span',group="Ichimoku Lines & Cloud Settings")-chikou_offset      = input(26,'Chikou Offset',group="Ichimoku Lines & Cloud Settings")+chikou_offset      = input.int(26,'Chikou Offset',group="Ichimoku Lines & Cloud Settings")-kumo_offset        = input(26,'Kumo Offset',group="Ichimoku Lines & Cloud Settings")+kumo_offset        = input.int(26,'Kumo Offset',group="Ichimoku Lines & Cloud Settings")//------------------------------------------------------------------------------⋯

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: 48 before, 48 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.

// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/-//@version=5+//@version=6//@strategy_alert_message {{strategy.order.alert_message}}"⋯

Where it runs

EngineCompilesRunsMatches TradingView
Zeal Terminal · OpenPineScript v2Yes 228 msWith a workaround 1,000 bars in 600 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///@version=5//@strategy_alert_message {{strategy.order.alert_message}}"//Base Indicator SuperIchi from LuxALgo with changes//Created by Mia & Nomi//Backtester template from @Haldro //Dashboard & Time filter template from Vermtstrategy('CITI Moku Strategy(Free) by @MiaIsTheNewBird', shorttitle = "CITI Moku Strategy (Free)",         overlay           = true,         initial_capital   = 10000,         commission_value  = 0.025,         default_qty_value = 25,         slippage          = 1,         pyramiding        = 0,         max_lines_count   = 500,         max_labels_count  = 500,         currency          = currency.USD,         default_qty_type  = strategy.percent_of_equity)//------------------------------------------------------------------------------tenkan_len  = input(9,'Tenkan',inline='tenkan',group="Ichimoku Lines & Cloud Settings")tenkan_mult = input(2.,'',inline='tenkan',group="Ichimoku Lines & Cloud Settings")kijun_len   = input(26,'Kijun',inline='kijun',group="Ichimoku Lines & Cloud Settings")kijun_mult  = input(8.,'',inline='kijun',group="Ichimoku Lines & Cloud Settings")spanB_len   = input(52,'Senkou Span B',inline='span',group="Ichimoku Lines & Cloud Settings")spanB_mult  = input(8.,'',inline='span',group="Ichimoku Lines & Cloud Settings")chikou_offset      = input(26,'Chikou Offset',group="Ichimoku Lines & Cloud Settings")kumo_offset        = input(26,'Kumo Offset',group="Ichimoku Lines & Cloud Settings")//------------------------------------------------------------------------------avg(src,length,mult)=>    atr = ta.atr(length)*mult    up = hl2 + atr    dn = hl2 - atr    upper = 0.,lower = 0.    upper := src[1] < upper[1] ? math.min(up,upper[1]) : up    lower := src[1] > lower[1] ? math.max(dn,lower[1]) : dn       os = 0,max = 0.,min = 0.    os := src > upper ? 1 : src < lower ? 0 : os[1]    spt = os == 1 ? lower : upper    max := ta.cross(src,spt) ? math.max(src,max[1]) : os == 1 ? math.max(src,max[1]) : spt    min := ta.cross(src,spt) ? math.min(src,min[1]) : os == 0 ? math.min(src,min[1]) : spt    math.avg(max,min)tenkan = avg(close,tenkan_len,tenkan_mult)kijun = avg(close,kijun_len,kijun_mult)senkouA = math.avg(kijun,tenkan)senkouB = avg(close,spanB_len,spanB_mult)chikou = close//------------------------------------------------------------------------------plot(tenkan, title = 'Tenkan-Sen', linewidth=1, color=#32C4EE )plot(kijun, title = 'Kinjun-Sen', linewidth=1, color=#EC3E6F )plot(chikou, title = 'Chikou Span', linewidth=1, offset = -chikou_offset+1, color=color.fuchsia, display=display.none)cloud_a = #0C3D4E       cloud_b = #451721 A = plot(senkouA,'Senkou Span A',na,offset=kumo_offset-1)B = plot(senkouB,'Senkou Span B',na,offset=kumo_offset-1)fill(A,B,senkouA > senkouB ? cloud_a : cloud_b)//Entry SignalsEntry1 = input.bool(false, title="Price Crossing Tenkan Line", group="Entry Signals Settings - Select Conditions for Entry")Entry2 = input.bool(true, title="Tenkan Line Crossing Kijun Line", group="Entry Signals Settings - Select Conditions for Entry")Entry3 = input.bool(false, title="Price Crossing Kijun Line", group="Entry Signals Settings - Select Conditions for Entry")Entry1Long = Entry1 ? ta.crossover(close,tenkan) : trueEntry2Long = Entry2 ? ta.crossover(tenkan,kijun) : trueEntry3Long = Entry3 ? ta.crossover(close,kijun) : trueEntry1Short = Entry1 ? ta.crossunder(close,tenkan) : trueEntry2Short = Entry2 ? ta.crossunder(tenkan,kijun) : trueEntry3Short = Entry3 ? ta.crossunder(close,kijun) : true//Assemble EntrieslongEntry = Entry1Long and Entry2Long and Entry3Long shortEntry = Entry1Short and Entry2Short and Entry3Short // Exit SignalsExit1 = input.bool(false, title="Price Crossunder Tenkan Line", group="Exit Signals Settings- Use as Indicator")Exit2 = input.bool(true, title="Tenkan Line Crossunder Kijun Line", group="Exit Signals Settings- Use as Indicator")Exit3 = input.bool(false, title="Price Crossunder Kijun Line", group="Exit Signals Settings- Use as Indicator")//Assemble Exit FiltersExit1Long = Exit1 ? ta.crossunder(close,tenkan) : trueExit2Long = Exit2 ? ta.crossunder(tenkan,kijun) : trueExit3Long = Exit3 ? ta.crossunder(close,kijun) : trueExit1Short = Exit1 ? ta.crossover(close,tenkan) : trueExit2Short = Exit2 ? ta.crossover(tenkan,kijun) : trueExit3Short = Exit3 ? ta.crossover(close,kijun) : true//Assemble ExitslongExit = Exit1Long and Exit2Long and Exit3Long shortExit = Exit1Short and Exit2Short and Exit3Short ///Plot Letters as Indicatorsvar bool PlotLong = input.bool (true, "Plot Buy Trades" , group="Use as Indicator")var bool PlotShorts = input.bool (true, "Plot Sell Trades" , group="Use as Indicator")var bool PlotLongExit = input.bool (true, "Plot Buy- Exit Trades" , group="Use as Indicator")var bool PlotShortsExit = input.bool (true, "Plot Sell- Exit Trades" , group="Use as Indicator")//Backtester from @Haldro// —————— ToolTipsTTreversesignal  = 'Wait End Deal- Enable/Disable waiting for a trade to close at Stop Loss/Take Profit. Until the trade closes on the Stop Loss or Take Profit, no new trade will open.'TTreOpenDeal     = 'ReEntry Deal- If true trade was long and  SL/TP was reached then go long again and vice versa. \n'                 + 'ReOpen Deal- If true and Wait End Deal is false then in case you are in a Long position and a new signal to Long, you will reEnter a new Long position and vice versa for Shorts.'TTslType         = 'Fixed%- Fixed SL/TP in percent. \n'                 + 'Fixed$- Fixed SL/TP in cash. \n'                 + 'Trailing %- Trailing stop in % like on exchanges. Regulated by the "Trailing%" parameter. \n'                 + 'Fast Trail- If in a long, it immediately follows the price when it rises otherwise it stands still. Vice versa for shorts. Regulated by the "Trailing% parameter. \n'                 + 'ATR - Fixed TP/SL depending on the current ATR. It is regulated by the "ATR period" | "Multiplier" parameters. \n'                 + 'R:R- Risk Reward sets the TP depending on the size of the SL. For example, if SL is $100, and R:R = 2, then the TP is $200. \n'                 + 'HH/LL- Searches for the last Extremum (High/Low) for the specified number of bars and sets a fixed Take. \n'                 + 'LO/HI Sets the SL for High/Low candles. "LO/HI" = 1 Sets the SL for the last High/Low. \n'                 + 'MA- Movinng Average SL. A very diverse type of SL.'// —————— Main InputsbullDeal         = input.bool   (true,        ' Long Deals    ',      group='Trade Direction', inline='deal')    bearDeal         = input.bool   (true,        ' Short Deals',         group='Trade Direction', inline='deal')   groupset         = 'TP-SL Strategy'waitEndDeal      = input.bool   (true,        ' Wait End Deal ',      group=groupset, inline='ord1')    reEntryDeal      = input.bool   (true,       ' ReEntry Deal  ',      group=groupset, inline='ord1')tpType           = input.string ('ATR TP',       ' 𝐓𝐚𝐤𝐞 𝐏𝐫𝐨𝐟𝐢𝐭',        group=groupset, inline='type', options=['None', 'FIXED %', 'FIXED $', 'ATR TP', 'R:R', 'HH / LL'])slType           = input.string ('ATR SL', ' 𝐒𝐭𝐨𝐩 𝐋𝐨𝐬𝐬 ',          group=groupset, inline='type', options=['None', 'FIXED %', 'FIXED $', 'TRAILING', 'FAST TRAIL', 'ATR SL','ATR TRAIL','LO / HI', 'MA'], tooltip=TTslType)grouptakes       = 'Take Profit Levels'ontake1          = input.bool   (true,       '🇹🇵¹',                  group=grouptakes, inline='take')qtake1           = input.int    (5,          '�',                   group=grouptakes, inline='take', minval=1, step=5, maxval=100)ontake2          = input.bool   (false,       '🇹🇵²',                  group=grouptakes, inline='take')qtake2           = input.int    (20,          '�',                   group=grouptakes, inline='take', minval=1, step=5, maxval=100)ontake3          = input.bool   (false,       '🇹🇵³',                  group=grouptakes, inline='take')qtake3           = input.int    (50,          '�',                   group=grouptakes, inline='take', minval=1, step=5, maxval=100)onstop0          = input.bool   (false,       '🇸🇱⁰ ',                 group=grouptakes, inline='take')qstop0           = input.int    (30,          '�',                   group=grouptakes, inline='take', minval=1, step=5, maxval=100)// ———————————————— SIGNAL FOR BACKTEST SYSTEM ————————————————Entrysignals_ = longEntry ? +1 : shortEntry ? -1 : 0// —————— Variables InitialisationEntrysignals = nz(Entrysignals_)bull = Entrysignals == +1 // +1 is bull signalbear = Entrysignals == -1 // -1 is bear signal//Backtester //Credit ©VertMTstartFilter    = input.bool    (group='📆 Time Filter 📆', title="              ", defval=true, inline="Start")endFilter      = input.bool    (group='📆 Time Filter 📆', title="              ", defval=true, inline="End")startTime      = input.time    (group='📆 Time Filter 📆', title="Start Timeㅤㅤ", defval=timestamp('UTC 01 Jan 2020 00:00'),  inline="Start")endTime        = input.time    (group='📆 Time Filter 📆', title="End Time ㅤ ㅤ", defval=timestamp('UTC 31 Dec 2050 23:45'),  inline="End")session        = input.session (group='📆 Time Filter 📆', title="Time Session  ", defval='0000-0000', tooltip="00:00 - 00:00 to disable.")zoneTime       = input.string  (group='📆 Time Filter 📆', title="UTC           ", defval="UTC", options = ["UTC-10", "UTC-8", "UTC-7", "UTC-6", "UTC-5", "UTC-4", "UTC-3", "UTC", "UTC+1", "UTC+2", "UTC+3", "UTC+4", "UTC+4:30", "UTC+5", "UTC+5:30", "UTC+6", "UTC+7", "UTC+8", "UTC+9", "UTC+9:30", "UTC+10", "UTC+11", "UTC+12", "UTC+12:45", "UTC+13"], tooltip="Match this time zone with that of your graph so that all values are displayed correctly.")mon            = input.bool    (group='📆 Time Filter 📆', title="Monㅤ         ", defval=true,  inline="Days")tue            = input.bool    (group='📆 Time Filter 📆', title="Tueㅤ         ", defval=true,  inline="Days")wed            = input.bool    (group='📆 Time Filter 📆', title="Wedㅤ         ", defval=true,  inline="Days")thu            = input.bool    (group='📆 Time Filter 📆', title="Thuㅤ         ", defval=true,  inline="Days")fri            = input.bool    (group='📆 Time Filter 📆', title="Friㅤ         ", defval=true,  inline="Days")sat            = input.bool    (group='📆 Time Filter 📆', title="Satㅤ         ", defval=true,  inline="Days")sun            = input.bool    (group='📆 Time Filter 📆', title="Sunㅤ         ", defval=true,  inline="Days")// 📆 Time Filter 📆 —————tradeDateIsAllowed() =>    start = startFilter ? time >= startTime : true    end   = endFilter   ? time <= endTime   : true       ses   = time == time("S", session, zoneTime) ? true : false    monF  = ( dayofweek(time, zoneTime) == dayofweek.monday    ) and mon ? true : false    tueF  = ( dayofweek(time, zoneTime) == dayofweek.tuesday   ) and tue ? true : false    wedF  = ( dayofweek(time, zoneTime) == dayofweek.wednesday ) and wed ? true : false    thuF  = ( dayofweek(time, zoneTime) == dayofweek.thursday  ) and thu ? true : false    friF  = ( dayofweek(time, zoneTime) == dayofweek.friday    ) and fri ? true : false    satF  = ( dayofweek(time, zoneTime) == dayofweek.saturday  ) and sat ? true : false    sunF  = ( dayofweek(time, zoneTime) == dayofweek.sunday    ) and sun ? true : false    dayF   = monF or tueF or wedF or thuF or friF or satF or sunF ? true : false    filter = start ? end ? ses ? dayF ? true : false : false : false : falsedateRange = tradeDateIsAllowed()// ————————————————————————————————————————————— Signal Filters ——————————————————————————————————————————————————————————— \\ // Credit @pAulseperformancegroupsignal           = 'Signal Filters'FilterType1         = input.bool (true,           '1. MA Filter',                                           group=groupsignal, inline='FT1')FilterType1MAType    = input.string ('EMA',           '',                                                 group=groupsignal, inline='FT1', options=['EMA','HMA','SMA'])FilterType1Len       = input.int    (21,             '',                                                 group=groupsignal, inline='FT1', minval=1, tooltip='MA Type, MA Source, MA Length\nLong = close > MA\nShort = close < MA')var bool ma1Status      = input.bool(false, group=groupsignal, title="Show MA Line?")source = closeMA(FilterType4MAType, source, FilterType4Len) =>    ma = 0.0    if FilterType4MAType == "SMA" // Simple        ma := ta.sma(source, FilterType4Len)        if FilterType4MAType == "EMA" // Exponential        ma := ta.ema(source, FilterType4Len)        if FilterType4MAType == "VWMA" // Volume Weighted        ma := ta.vwma(source, FilterType4Len)        if FilterType4MAType == "HMA" // Hull MA        ma := ta.hma(source, FilterType4Len)        resultMA = mama = MA(FilterType1MAType, source, FilterType1Len)plot(ma, "Moving Average 1", color = ma1Status ? color.yellow : na)FilterType2          = input.bool   (true,           '2.  Above/Below Kumo Cloud Settings',                                           group=groupsignal, inline='FT2')FilterType3          = input.bool   (false,          '3. Bullish/Bearish Kumo Cloud Filter Settings',                                           group=groupsignal, inline='FT3')FilterType4         = input.bool   (false,            '4. Bullish/Bearish Kijun Filter Settings',                                           group=groupsignal, inline='FT4')// —————— Filter 1: Moving AverageFilter1Ma      = FilterType1 ? MA(FilterType1MAType, close, FilterType1Len) : 0.Filter1Long    = FilterType1 ? close > Filter1Ma : trueFilter1Short   = FilterType1 ? close < Filter1Ma : true// Filter 2: Above/Below Kumo Cloud SettingsFilter2Long  = FilterType2 ? close > math.max(senkouA[kumo_offset-1],senkouB[kumo_offset-1]): trueFilter2Short = FilterType2 ? close < math.min(senkouA[kumo_offset-1],senkouB[kumo_offset-1]): true// Filter 3: Bullish/Bearish Kumo Cloud Filter SettingsFilter3Long = FilterType3 ? senkouA[kumo_offset-1] > senkouB[kumo_offset-1] : true Filter3Short = FilterType3 ? senkouA[kumo_offset-1] < senkouB[kumo_offset-1]  : true// Filter 4: Bullish/Bearish Kijun Filter SettingsFilter4Long = FilterType4 ? kijun > math.max(senkouA[kumo_offset-1],senkouB[kumo_offset-1]) : trueFilter4Short = FilterType4 ? kijun < math.min(senkouA[kumo_offset-1],senkouB[kumo_offset-1]) : true//  —————— Filter 12: Bullish/Bearish Chikou Span Settings// —————— Assemble FiltersFilterLongOK    = Filter1Long and Filter2Long and Filter3Long and Filter4LongFilterShortOK   = Filter1Short and Filter2Short and Filter3Short and Filter4Short// Risk Managment \\ // Credit @Daveattgrouprisk               = 'Risk Management'setmaxLosingStreak      = input.bool   (false,           '',                   group=grouprisk, inline='1')maxLosingStreak         = input.int    (15,              'Loss Streak   ',     group=grouprisk, inline='1', minval=1)setmaxWinStreak         = input.bool   (false,           '',                   group=grouprisk, inline='1')maxWinStreak            = input.int    (15,              'Win Streak   ',      group=grouprisk, inline='1', minval=1, tooltip='𝐋𝐨𝐬𝐬 𝐒𝐭𝐫𝐞𝐚𝐤 ➖ Set Max number of consecutive loss trades. \n𝐖𝐢𝐧 𝐒𝐭𝐫𝐞𝐚𝐤 ➖ Max Winning Streak Length.')setmaxLosingDaysStreak  = input.bool   (false,           '',                   group=grouprisk, inline='2')maxLosingDaysStreak     = input.int    (3,               'Row Loss InDay',     group=grouprisk, inline='2', minval=1)setMaxDrawdown          = input.bool   (false,           '',                   group=grouprisk, inline='2')maxPercDd               = input.int    (10,              'DrawDown %',        group=grouprisk, inline='2', minval=1, maxval=100, tooltip='𝐑𝐨𝐰 𝐋𝐨𝐬𝐬 𝐈𝐧𝐃𝐚𝐲 ➖ Max of consecutive days with a loss in a row. \n𝐃𝐫𝐚𝐰𝐃𝐨𝐰𝐧% ➖ Max DrawDown (in % of strategy equity).')setMaxIntradayLoss      = input.bool   (false,           '',                   group=grouprisk, inline='3')maxIntradayLoss         = input.int    (3,               'InDay Loss % ',     group=grouprisk, inline='3', minval=1, maxval=100)setNumberDailyTrades    = input.bool   (false,           '',                   group=grouprisk, inline='3')maxDailyTrades          = input.int    (10,              'Daily Trades  ',     group=grouprisk, inline='3', minval=1, maxval=100, tooltip='𝐈𝐧𝐃𝐚𝐲 𝐋𝐨𝐬𝐬 % ➖ Set Max Intraday Loss. \n𝐃𝐚𝐢𝐥𝐲 𝐓𝐫𝐚𝐝𝐞𝐬 ➖ Limit the number of MAX trades per day.')setNumberWeeklyTrades   = input.bool   (false,           '',                   group=grouprisk, inline='4')maxWeeklyTrades         = input.int    (50,              'Weekly Trades',      group=grouprisk, inline='4', minval=1, maxval=100, tooltip='𝐖𝐞𝐞𝐤𝐥𝐲 𝐓𝐫𝐚𝐝𝐞𝐬 ➖ Limit the number of MAX trades per week.')QTYMethod               = input.string ('EQUITY',        '     Order Size',    group=grouprisk, inline=' ', options=['NONE', 'EQUITY', 'SIZE', 'CONTRACTS'])useNetProfit            = input.bool   (true,            'Use Net Profit',     group=grouprisk, inline=' ', tooltip='𝐔𝐬𝐞 𝐍𝐞𝐭 𝐏𝐫𝐨𝐟𝐢𝐭 ➖ On/Off the use of profit in the following trades. *Only works if the type is EQUITY')riskPerc                = input.int    (30,              '​🇪​​🇶​​🇺​​🇮​​🇹​​🇾​',              group=grouprisk, inline='.', minval=1, maxval=100)riskSize                = input.int    (1000,            '​🇸​​🇮​​🇿​​🇪',                group=grouprisk, inline='.', minval=1)riskCntr                = input.int    (1,               '​🇨​​🇴​​🇳​​🇹​​🇷​​🇦​​🇨​​🇹​​🇸​',           group=grouprisk, inline='.', minval=1, tooltip='𝐎𝐫𝐝𝐞𝐫 𝐒𝐢𝐳𝐞: \n𝐍𝐎𝐍𝐄 ➖ Use the default position size settings in Tab "Properties". \n𝐄𝐐𝐔𝐈𝐓𝐘 ➖ % per trade from the initial capital. \n𝐒𝐈𝐙𝐄 ➖ Fixed size amount of trade. \n𝐂𝐎𝐍𝐓𝐑𝐀𝐂𝐓𝐒 ➖ The fixed amount of the deal in contracts. \n')// —————— Order Sizeeqty = switch QTYMethod    'NONE'      => na    'EQUITY'    => riskPerc / close    'SIZE'      => riskSize / close    'CONTRACTS' => riskCntr//// —————— Intraday Loss %condintradayloss = setMaxIntradayLoss ? maxIntradayLoss : 100strategy.risk.max_intraday_loss(value=condintradayloss, type=strategy.percent_of_equity)// —————— Max Drawdown %condmaxdrawdown = setMaxDrawdown ? maxPercDd : 100strategy.risk.max_drawdown(value=condmaxdrawdown, type=strategy.percent_of_equity)// —————— Daily trades calculationtradesIntradayCount = setNumberDailyTrades ? maxDailyTrades : 1000strategy.risk.max_intraday_filled_orders(count=tradesIntradayCount)// —————— Weekly trades calculationtradesLastWeek = 0tradesLastWeek := dayofweek == dayofweek.monday and dayofweek != dayofweek[1] ? strategy.closedtrades[1] + strategy.opentrades[1] : tradesLastWeek[1]// —————— Calculate number of trades this weekweeklyTrades = strategy.closedtrades + strategy.opentrades - tradesLastWeekokToTradeWeekly = setNumberWeeklyTrades ? weeklyTrades < maxWeeklyTrades : true// —————— Consecutive loss days in a rowcountConsLossDays = setmaxLosingDaysStreak ? maxLosingDaysStreak : 1000strategy.risk.max_cons_loss_days(countConsLossDays)// —————— Calculate the total losing streaksnewLoss = strategy.losstrades > strategy.losstrades[1] and strategy.wintrades == strategy.wintrades[1] and strategy.eventrades == strategy.eventrades[1]// —————— Determine current losing streak lengthstreakLossLen = 0streakLossLen := newLoss ? nz(streakLossLen[1]) + 1 : strategy.wintrades > strategy.wintrades[1] or strategy.eventrades > strategy.eventrades[1] ? 0 : nz(streakLossLen[1])// —————— Check if losing streak is under max allowedokToTradeLossStreak = setmaxLosingStreak ? streakLossLen < maxLosingStreak : true// —————— Calculate the total winning streaksnewWin = strategy.wintrades > strategy.wintrades[1] and strategy.losstrades == strategy.losstrades[1] and strategy.eventrades == strategy.eventrades[1]// —————— Figure out current winning streak lengthstreakWinLen = 0streakWinLen := newWin ? nz(streakWinLen[1]) + 1 : strategy.losstrades > strategy.losstrades[1] or strategy.eventrades > strategy.eventrades[1] ? 0 : nz(streakWinLen[1])// —————— Check if winning streak is under max allowedokToTradeWinStreak = setmaxWinStreak ? streakWinLen < maxWinStreak : true// TP-SL Exit StrategypercentTP    = input.float  (4.5,             ' Profit %    ',            group=groupset, inline='fix', minval=0.1, step=0.1)percentSL    = input.float  (1.5,             ' Stop %  ',                group=groupset, inline='fix', minval=0.1, step=0.1)moneyTP      = input.float  (333,             ' Profit $    ',            group=groupset, inline='mon', minval=1,   step=5)moneySL      = input.float  (100,             ' Stop $  ',                group=groupset, inline='mon', minval=1,   step=5)ATRLenTP       = input.int    (30,              ' ATR TP Period  ',             group=groupset, inline='atrTP', minval=1,   step=1)ATRMultTP      = input.float  (3,               ' TP Multiplier',               group=groupset, inline='atrTP', minval=0.1, step=0.1)ATRLenSL       = input.int    (30,              ' ATR SL Period  ',             group=groupset, inline='atrSL', minval=1,   step=1)ATRMultSL     = input.float  (4,               'SL Multiplier',               group=groupset, inline='atrSL', minval=0.1, step=0.1)trailPerc    = input.float  (3,               ' Trailing %  ',            group=groupset, inline='trl', minval=0.1, step=0.1)riskReward   = input.float  (2,               ' R:R    1:',                group=groupset, inline='trl', minval=0.5, step=0.1)fixedRR      = input.bool   (true,            ' Fixed RR',                 group=groupset, inline='trl', tooltip='𝐅𝐢𝐱𝐞𝐝 𝗥:𝗥 ➖ If the stop loss is Dynamic (Trailing or MA) then R:R can also be made Dynamic')HHLL         = input.int    (200,             ' HH / LL   ',               group=groupset, inline='hls', minval=1,   step=5)LoHi         = input.int    (5,               '  LO / HI ',                group=groupset, inline='hls', minval=1,   step=1)addPerc      = input.bool   (false,           ' Add %',                   group=groupset, inline='hls', tooltip='𝐀𝐝𝐝 % ➖ If true, then with the "𝗦𝘁𝗼𝗽 %" parameter you can add percentages to any of the current SL. \nCan be especially useful when using Stop - 𝗔𝗧𝗥 or 𝗠𝗔 or 𝗟𝗢/𝗛𝗜. \nFor example with 𝗟𝗢/𝗛𝗜 to put a stop for the last High/Low and add 0.5% additional Stoploss')maStopType   = input.string ('EMA',           ' MA Stop',                  group=groupset, inline='mas', options=['EMA', 'HMA','SMA'])maStopLen    = input.int    (15,              ' Len',                      group=groupset, inline='mas', minval=1,   step=2)maPerc       = input.float  (0.1,             ' Step',                     group=groupset, inline='mas', minval=0,   step=0.1, tooltip='𝐌𝐀 𝐒𝐭𝐨𝐩 ➖ allows to choose which MA to use. \n𝐋𝐞𝐧 ➖ Length of chosen MA. \n𝐒𝐭𝐞𝐩 ➖% step of change MA. Step = 0 will use the selected MA without changes. \nWARNING: When 𝐀𝐝𝐝 % is on, the MA calculation changes..')var bool PaintStrategy= input.bool (false, "Paint Strategy and TP/SL on Chart" , group=grouptakes, tooltip="Plots trades for TP-SL Strategy")slNumber     = input.int    (1,               ' SL 0 Position',            group=grouptakes, inline='pos', minval=1, maxval=2)ontpBE       = input.bool   (false,           '',                          group=grouptakes, inline='pos')tpBEnumber   = input.int    (2,               'Breakeven on TP',           group=grouptakes, inline='pos', minval=1, maxval=3, tooltip='𝐒𝐋 𝟎 𝐏𝐨𝐬𝐢𝐭𝐢𝐨𝐧 ➖ Changes the position of the intermediate Stop Loss.\nThe value = 3 - the middle. \n𝐁𝐫𝐞𝐚𝐤𝐞𝐯𝐞𝐧 𝐨𝐧 𝐓𝐏 ➖ If true Set StopLoss to Breakeven after the specified TakeProfit is reached.')barCoolDwn   = input.int    (0,               ' CoolDown # Bars',          group=grouptakes, inline='   ', minval=0, tooltip='Do Not open a new position until # bars have passed since the last trade.\nValue=0 - disables the function.')// —————— Trade variablesentry        = strategy.position_avg_pricesizePos      = strategy.position_sizeinLong       = sizePos > 0inShort      = sizePos < 0inTrade      = inLong or inShortinPos        = (inLong and not inShort[1]) or (inShort and not inLong[1])var ID       = 'TradeID'var tpPrice  = float(na)var slPrice  = float(na)// —————— Entry solutionsdirection    = 0directionL   = bull and (nz(direction[1]) == 0 or nz(direction[1]) == -1)directionS   = bear and (nz(direction[1]) == 0 or nz(direction[1]) == +1)direction   := directionL ? +1 : directionS ? -1 : (reEntryDeal ? direction[1] : direction[0])checkCoolDwn = barCoolDwn >0 ? not inTrade[barCoolDwn] : trueOkToTrade    = dateRange and okToTradeLossStreak and okToTradeWinStreak and checkCoolDwngoLong       = ( waitEndDeal ? not inTrade and direction==+1 : direction==+1 ) and bullDeal and OkToTrade and FilterLongOK goShort      = ( waitEndDeal ? not inTrade and direction==-1 : direction==-1 ) and bearDeal and OkToTrade and FilterShortOK // ———————————————————————————————————————————————————————————————————————————————————————————————————————————————————————— \\DynamicStops = (slType == 'TRAILING' or slType == 'FAST TRAIL' or slType == 'MA')// —————— Fixed SL/TPif tpType == 'FIXED %'    tpPrice := inLong and not inTrade[1] ? entry * (1 + percentTP/100) : inShort and not inTrade[1] ? entry * (1 - percentTP/100) : tpPriceif slType == 'FIXED %'    slPrice := inLong and not inTrade[1] ? entry * (1 - percentSL/100) : inShort and not inTrade[1] ? entry * (1 + percentSL/100) : slPrice// —————— Money SL/TPif tpType == 'FIXED $'    tpPrice := inLong and not inTrade[1] ? entry + (moneyTP / math.abs(sizePos)) : inShort and not inTrade[1] ? entry - (moneyTP / math.abs(sizePos)) : tpPriceif slType == 'FIXED $'    slPrice := inLong and not inTrade[1] ? entry - (moneySL / math.abs(sizePos)) : inShort and not inTrade[1] ? entry + (moneySL / math.abs(sizePos)) : slPrice// —————— Trailing Stopif slType == 'TRAILING'    StopL    = 0., StopS = 0.    StopL   := inLong  ? math.max(close * (1 - trailPerc/100), StopL[1]) : 0    StopS   := inShort ? math.min(close * (1 + trailPerc/100), StopS[1]) : 999999    slPrice := inLong  ? StopL : inShort ? StopS : slPrice// —————— Fast Trailing Stopif slType == 'FAST TRAIL'    var stop = float(na)    stop    := inLong and not inTrade[1] ? entry * (1 - trailPerc/100) : inShort and not inTrade[1] ? entry * (1 + trailPerc/100) : stop    stop    := inLong and close > close[1] ? stop + (close - close[1]) : inShort and close < close[1] ? stop + (close - close[1]) : stop    slPrice := stop// —————— ATR Fixed TPStopATRTP     = ta.atr(ATRLenTP) * ATRMultTPif tpType == 'ATR TP'    tpPrice := inLong and not inTrade[1] ? entry + StopATRTP: inShort and not inTrade[1] ? entry - StopATRTP : tpPrice// —————— ATR Fixed SLStopATRSL     = ta.atr(ATRLenSL) * ATRMultSLif slType == 'ATR SL'    slPrice := inLong and not inTrade[1] ? entry - StopATRSL : inShort and not inTrade[1] ? entry + StopATRSL : slPrice// —————— LO / HI Stopif slType == 'LO / HI'    HiStop   = ta.highest(high, LoHi)    LoStop   = ta.lowest (low,  LoHi)    slPrice := inLong and not inTrade[1] ? LoStop : inShort and not inTrade[1] ? HiStop : slPrice// —————— HH / LL Takeif tpType == 'HH / LL'    HiStop   = ta.highest(high, HHLL)    LoStop   = ta.lowest (low,  HHLL)    tpPrice := inLong and not inTrade[1] ? HiStop : inShort and not inTrade[1] ? LoStop : tpPrice// —————— MA's Stopsif slType == 'MA'    maSType  = MA(maStopType, close, maStopLen)    Stop     = maSType * (maPerc / 100)    slPrice := inLong  ? math.max(nz(slPrice[1], 0), maSType - Stop) : inShort ? math.min(nz(slPrice[1], 999999), maSType + Stop) : na// —————— Risk Reward Takeif tpType == 'R:R'    check    = fixedRR ? not inTrade[1] : true    tpPrice := inLong and check ? entry + (entry - slPrice) * riskReward : inShort and check ? entry - (slPrice - entry) * riskReward : tpPrice// —————— Add Percents to SLif addPerc    check    = DynamicStops ? true : not inTrade[1]    slPrice := inLong and check ? slPrice * (1 - percentSL/100) : inShort and check ? slPrice * (1 + percentSL/100) : slPrice// —————— TPSL'sTypeStop = tpType != 'None' or slType == 'FIXED %' or slType == 'FIXED $' or slType == 'ATR' or slType == 'LO / HI'BuildLeveles(take, nTake) => // Creating Intermediate Levels of the SL/TP - by shifting the current TP/SL to the entry level    nTakes = 4    var offset = float(na)    offset := not inPos[1] ? (entry - take) : offset    xentry = take + offset    levels = array.new_float()    for i = 1 to nTakes - 1        array.push(levels, xentry + (take - xentry) * i / (nTakes))    result = nTake >= 0 and nTake <= nTakes ? array.get(levels, nTake) : naCheckLevels(lvl, isTake) => // Check if the SL/TP is reached     var float level = na    if isTake and ((inLong and high >= lvl) or (inShort and low <= lvl))        level := entry    if not isTake and ((inLong and low <= lvl) or (inShort and high >= lvl))        level := entry    if not inTrade        level := na    level// —————— Get and Check Levelsstop0 = tpType != 'None' ? BuildLeveles(slPrice, slNumber-1) : slPrice , checkStop0 = TypeStop ? CheckLevels(stop0, false) : CheckLevels(stop0, true )take1 = BuildLeveles(TypeStop ? tpPrice : slPrice, 0)                  , checkTake1 = TypeStop ? CheckLevels(take1, true ) : CheckLevels(take1, false)take2 = BuildLeveles(TypeStop ? tpPrice : slPrice, 1)                  , checkTake2 = TypeStop ? CheckLevels(take2, true ) : CheckLevels(take2, false)take3 = BuildLeveles(TypeStop ? tpPrice : slPrice, 2)                  , checkTake3 = TypeStop ? CheckLevels(take3, true ) : CheckLevels(take3, false)// —————— Move Stop to Breakevenslbecheck = (tpBEnumber==1 and ontake1) or (tpBEnumber==2 and ontake2) or (tpBEnumber==3 and ontake3) if ontpBE and slbecheck and not DynamicStops    slbe     = TypeStop ? CheckLevels(BuildLeveles(tpPrice, tpBEnumber-1), true) : CheckLevels(BuildLeveles(slPrice, tpBEnumber-1), false)    slPrice := slbe > 0 ? slbe : slPrice    stop0   := slPrice == entry ? slPrice : stop0// ALERTSi_alert_message_long_txt = input.text_area(defval = "",title = 'API Long Entry' , group = 'API for Long Bot Alerts')i_alert_message_short_txt =input.text_area(defval = "",title = 'API Short Entry' , group = 'API for Short Bot Alerts')i_alert_txt_exit_TPSL0 = input.text_area(defval = "",title = 'API Exit 0' , group = 'API TP-SL Strategy Exit Alerts')i_alert_txt_exit_TPSL1 = input.text_area(defval = "",title = 'API Exit 1' , group = 'API TP-SL Strategy Exit Alerts')i_alert_txt_exit_TPSL2 = input.text_area(defval = "",title = 'API Exit 2' , group = 'API TP-SL Strategy Exit Alerts')i_alert_txt_exit_TPSL3 = input.text_area(defval = "",title = 'API Exit 3' , group = 'API TP-SL Strategy Exit Alerts')i_alert_txt_exit_TPSLX = input.text_area(defval = "",title = 'API Exit X' , group = 'API TP-SL Strategy Exit Alerts')// —————— Entry'seqty(qty) => QTYMethod=='EQUITY' ? qty / 100 * (strategy.initial_capital + (useNetProfit ? strategy.netprofit : 0)) : QTYMethod=='SIZE' ? qty / syminfo.pointvalue : qtyif goLong    ID := 'Long'    strategy.entry(ID, strategy.long,  qty=eqty(eqty), comment=ID, alert_message = ID + i_alert_message_long_txt)if goShort    ID := 'Short'    strategy.entry(ID, strategy.short, qty=eqty(eqty), comment=ID, alert_message = ID + i_alert_message_short_txt)// —————— Exit'sqty(perc) => math.abs(sizePos*perc/100)if inTrade     strategy.exit('End_0', onstop0 ? ID : 'na', qty=qty(qstop0), limit=tpPrice,                    stop=stop0,                      comment_profit='TP 0', comment_loss='SL 0', alert_message= ID +  i_alert_txt_exit_TPSL0)    strategy.exit('End_1', ontake1 ? ID : 'na', qty=qty(qtake1), limit=TypeStop ? take1 : tpPrice, stop=TypeStop ? slPrice : take1, comment_profit='TP 1', comment_loss='SL 1', alert_message= ID + i_alert_txt_exit_TPSL1)    strategy.exit('End_2', ontake2 ? ID : 'na', qty=qty(qtake2), limit=TypeStop ? take2 : tpPrice, stop=TypeStop ? slPrice : take2, comment_profit='TP 2', comment_loss='SL 2', alert_message= ID + i_alert_txt_exit_TPSL2)    strategy.exit('End_3', ontake3 ? ID : 'na', qty=qty(qtake3), limit=TypeStop ? take3 : tpPrice, stop=TypeStop ? slPrice : take3, comment_profit='TP 3', comment_loss='SL 3', alert_message= ID + i_alert_txt_exit_TPSL3)    strategy.exit('End_X',           ID,                         limit=tpPrice,                    stop=slPrice,                    comment_profit='TP X', comment_loss='SL X', alert_message= ID + i_alert_txt_exit_TPSLX)// ========================================================================================================================///==============================================================================================================// Plotting and Debugging - Style 1 - Paint Strategy// ========================================================================================================================bullcolor    = input.color  (color.new(color.teal,70),     'Colors:  FG',               group=grouptakes, inline='col')bearcolor    = input.color  (color.new(color.red,70),     '',                          group=grouptakes, inline='col')bullcolorb   = input.color  (color.new(color.teal,80),     'BG',                        group=grouptakes, inline='col')bearcolorb   = input.color  (color.new(color.red,80),     '',                          group=grouptakes, inline='col')//Style 1- Paint Strategy on ChartplotColx = inLong and PaintStrategy? bullcolor  : inShort ? bearcolor  : naplotColy = inLong and PaintStrategy ? bullcolorb : inShort ? bearcolorb : natpcolor  = tpType != 'None' ? bullcolor : plotColxtp1 = plot(inPos and PaintStrategy? tpPrice : na, 'Take', color=tpType != 'None' ? bullcolor : plotColx, style=plot.style_linebr, editable=false)sl1 = plot(inPos and PaintStrategy ? slPrice : na, 'Stop', color=tpType != 'None' ? bearcolor : plotColx, style=plot.style_linebr, editable=false)en1 = plot(TypeStop and PaintStrategy ? (inLong and slPrice > entry or inShort and slPrice < entry ? slPrice : entry) : inPos ? close : na, 'Price', color=TypeStop ? #787b86 : na, style=plot.style_linebr)fill(tp1, en1, color=TypeStop ? bullcolorb : plotColy, editable=false)fill(sl1, en1, color=TypeStop ? bearcolorb : plotColy, editable=false)plotchar(inPos and not inPos[1] and PaintStrategy? tpPrice : na, 'Take Start', color=tpType != 'None' ? bullcolor : plotColx, char='?', location=location.absolute, size=size.tiny)plotchar(inPos and not inPos[1] and PaintStrategy? slPrice : na, 'Stop Start', color=tpType != 'None' ? bearcolor : plotColx, char='?', location=location.absolute, size=size.tiny)plot(inPos and ontake1 and not checkTake1[1] and PaintStrategy? take1 : na, 'TP 1', color=tpcolor,   style=plot.style_linebr, editable=false)plot(inPos and ontake2 and not checkTake2[1] and PaintStrategy? take2 : na, 'TP 2', color=tpcolor,   style=plot.style_linebr, editable=false)plot(inPos and ontake3 and not checkTake3[1] and PaintStrategy? take3 : na, 'TP 3', color=tpcolor,   style=plot.style_linebr, editable=false)plot(inPos and onstop0 and not checkStop0[1] and PaintStrategy? stop0 : na, 'SL 0', color=bearcolor, style=plot.style_linebr, editable=false)//Style- Plot Letters on Chartplotshape(goLong and PlotLong,'Bullish Signals',text='Buy',location=location.belowbar, style=shape.labelup, size=size.tiny , color=#32C4EE  , textcolor=color.white,offset=0)plotshape(inLong and longExit and PlotLong and PlotLongExit,'Long Exit',location=location.abovebar, style=shape.xcross , size=size.tiny, color=#32C4EE  , textcolor=color.white,offset=2)plotshape(goShort and PlotShorts ,'Bearish Signals',text='Sell', location=location.abovebar, style=shape.labeldown, size=size.tiny , color=#EC3E6F  , textcolor=color.white,offset=0)plotshape(inShort and shortExit and PlotShorts and PlotShortsExit ,'Short Exit',location=location.belowbar, style=shape.xcross, size=size.tiny, color=#EC3E6F  , textcolor=color.white,offset=2)//Plot Dashboard// 📊 Plots 📊//The data collected during the backtest will be displayed on screen within a dashboard and various drawings to visualize the operations.plotDashboard  = input.bool    (group="📊 Plots 📊", title="Plot Dashboard          ", defval=true)maxProfit      = input.float   (group="📊 Plots 📊", title="Profit ㅤ ㅤ🟢 if > to:", defval=0.1, inline="Profit")minProfit      = input.float   (group="📊 Plots 📊", title="ㅤ🔴 if < to:          ", defval=0,   inline="Profit")maxWinRate     = input.float   (group="📊 Plots 📊", title="Win Rateㅤ🟢 if > to:  ", defval=70,  inline="Winrate", minval = 0, maxval=100)minWinRate     = input.float   (group="📊 Plots 📊", title="ㅤ🔴 if < to:          ", defval=50,  inline="Winrate", minval = 0, maxval=100)maxPFactor     = input.float   (group="📊 Plots 📊", title="P. Factorㅤ🟢 if > to: ", defval=2,   inline="PFactor", minval=0)minPFactor     = input.float   (group="📊 Plots 📊", title="ㅤ🔴 if < to:          ", defval=1,   inline="PFactor", minval=0)bgcolor(dateRange ? na : color.new(color.white, 80))MTLabel(ftimestamp, etimestamp, statusProfit, statusWinRate, statusPFactor, maxWinRow, maxLossRow) =>    timefr = timeframe.isminutes ? 'min' : ''    string _text = '         🔰CITI Moku (Free)🔰' + '\n'    _text += '➖➖➖➖➖➖➖➖➖➖' + '\n'    _text += '' + '\n'    _text += ' Ticker:' + '\n'    _text += '     ' + syminfo.ticker + '  ' + timeframe.period + timefr    _text += '' + '\n\n'    _text += ' Since:' + '\n'    _text += str.format("    {0,date,long}  ", ftimestamp) + str.format("{0,time,HH:mm}", ftimestamp) + '\n'    _text += ' To:' + '\n'    _text += str.format("    {0,date,long}  ", etimestamp) + str.format("{0,time,HH:mm}", etimestamp) + '\n'    _text += '' + '\n'    _text += '➖➖➖➖➖➖➖➖➖➖' + '\n'    _text += '' + '\n'    _text += ' #Trades:  ' + str.tostring(strategy.closedtrades, '##.##') + '\n'    _text += '' + '\n'    _text += ' Profit:' + '\n'    _text += '     ' + str.tostring(statusProfit)  + str.tostring(( strategy.netprofit / strategy.initial_capital ) * 100, '##.##') + '% \n'    _text += ' Win Rate:' + '\n'    _text += '     ' + str.tostring(statusWinRate) + str.tostring(( strategy.wintrades / strategy.closedtrades )    * 100, '##.##') + '% \n'    _text += ' Profit Factor:' + '\n'    _text += '     ' + str.tostring(statusPFactor) + str.tostring(( strategy.grossprofit / strategy.grossloss ),           '##.###') + '\n'    _text += '' + '\n'    _text += ' Win Trades:   '  + str.tostring(strategy.wintrades, '######') + '\n'    _text += ' Loss Trades:   ' + str.tostring(strategy.losstrades, '######') + '\n'    _text += '' + '\n'    _text += ' Avg Win:  '  + str.tostring((( strategy.grossprofit / strategy.wintrades ) * 100 ) / strategy.initial_capital, '##.##') + '%\n'    _text += ' Avg Loss:  ' + str.tostring((( strategy.grossloss / strategy.losstrades ) * 100 ) / strategy.initial_capital, '##.##') + '%\n'    _text += '' + '\n'    _text += ' Max Win in a Row:  '  + str.tostring(maxWinRow, '######')  + '\n'    _text += ' Max Loss in a Row:  ' + str.tostring(maxLossRow, '######')  + '\n'    _text += '' + '\n'    _text += '➖➖➖➖➖➖➖➖➖➖' + '\n'ftimestamp = startFilter ? timestamp(year(startTime, zoneTime), month(startTime, zoneTime), dayofmonth(startTime, zoneTime), hour(startTime, zoneTime), minute(startTime, zoneTime), second(startTime, zoneTime)) : timestamp(year(ta.valuewhen(barstate.isfirst, time, 0), zoneTime),  month(ta.valuewhen(barstate.isfirst, time, 0), zoneTime),  dayofmonth(ta.valuewhen(barstate.isfirst, time, 0), zoneTime),  hour(ta.valuewhen(barstate.isfirst, time, 0), zoneTime),  minute(ta.valuewhen(barstate.isfirst, time, 0), zoneTime))etimestamp = endFilter   ? timestamp(year(endTime, zoneTime),   month(endTime, zoneTime),   dayofmonth(endTime, zoneTime),   hour(endTime, zoneTime),   minute(endTime, zoneTime),   second(endTime, zoneTime)) : timestamp(year(timenow, zoneTime), month(timenow, zoneTime), dayofmonth(timenow, zoneTime), hour(timenow, zoneTime), minute(timenow, zoneTime))statusProfit  = (( strategy.netprofit / strategy.initial_capital ) * 100) + 0.001 >= maxProfit  ? "🟢 " : (( strategy.netprofit / strategy.initial_capital ) * 100) - 0.001 <= minProfit  ? "🔴 " : "🟡 "statusWinRate = (( strategy.wintrades / strategy.closedtrades )    * 100) + 0.001 >= maxWinRate ? "🟢 " : (( strategy.wintrades / strategy.closedtrades )    * 100) - 0.001 <= minWinRate ? "🔴 " : "🟡 "statusPFactor = ( strategy.grossprofit / strategy.grossloss )             + 0.001 >= maxPFactor ? "🟢 " : ( strategy.grossprofit / strategy.grossloss )             - 0.001 <= minPFactor ? "🔴 " : "🟡 "varip int winRow     = 0varip int lossRow    = 0varip int maxWinRow  = 0varip int maxLossRow = 0if (strategy.wintrades  > strategy.wintrades[1]) and (strategy.losstrades == strategy.losstrades[1]) and (strategy.eventrades == strategy.eventrades[1])    lossRow := 0    winRow := winRow + 1    if winRow > maxWinRow        maxWinRow := winRowif (strategy.wintrades == strategy.wintrades[1]) and (strategy.losstrades  > strategy.losstrades[1]) and (strategy.eventrades == strategy.eventrades[1])    winRow := 0    lossRow := lossRow + 1    if lossRow > maxLossRow        maxLossRow := lossRowlabel la = nalabel.delete(la[1])la := plotDashboard ? label.new(x=bar_index + 5, y=close, text=MTLabel(ftimestamp, etimestamp, statusProfit, statusWinRate, statusPFactor, maxWinRow, maxLossRow), color=color.new(color.black, 50), style=label.style_label_left, textcolor=color.white, size=size.normal, textalign=text.align_left) : na