Pine Script v4 · Strategy
Ichimoku Long and Short Strategy
A Pine Script v4 strategy built on ATR (14). It has 8 order rules, 2 entries among them, and trades long and short with the default settings. Exits use a stop loss and a profit target. Each trade is one contract and pays no commission. 17 settings; defaults include Conversion Line Length 9, Base Line Length 26 and Lagging Span 2 Length 52.
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 Ichimoku Long and Short Strategy repaint?
- No
- No repainting patterns were found in the source, and a live tick-by-tick replay matched history on 3 of 3 trades.
- How did Ichimoku Long and Short Strategy do on BTCUSDT 1D with default settings?
- +80.91%
- From 26 Jan 2024 to 21 Oct 2026, over 13 closed trades, against +102.5% for buy and hold. A backtest, not investment advice.
- Can Ichimoku Long and Short Strategy be converted to Pine Script v5?
- Yes
- The upgrade takes 1 step, from v4; each was run before and after on the same candles with identical results, and the v5 script can be downloaded below.
- Does Ichimoku Long and Short Strategy use a stop loss?
- Yes
- strategy.exit sets a stop on line 68, 84.
- Does Ichimoku Long and Short Strategy run in Zeal Terminal?
- Yes
- It compiles in 51 ms and runs 1,000 bars in 116 ms, in the browser.
BTCUSDT · 1D · default settings
- Long Signal
- Short Signal
- Take profit
- Middle Line
- Stop Loss
- Conversion Line
- Base Line
- Lagging Span
- Lead 1
- Lead 2
- Winning trade
- Losing trade
- Equity
- Buy and hold
- Net profit
- +80.91%
- $80,913.50
- Buy and hold
- +102.5%
- same period
- Closed trades
- 13
- 6 won · 7 lost
- Profitable
- 46.2%
- of closed trades
- Profit factor
- 1.20
- gross profit ÷ gross loss
- Max drawdown
- 148.19%
- −$180,854.00
One run with the author's default settings, $100,000 starting capital, commission as the script sets it. A single backtest says little about future results and is not a recommendation. Backtests are simulations on historical data and are not investment advice.
Review
What a careful reader of this script would point out, found by checking the source and the backtest.
-
Check
1 setting does nothing
“Entry Strategy” is declared but never read.
-
Check
No commission
The backtest assumes free trading. Results on any real exchange will be lower.
-
Note
No slippage
Fills are assumed at the exact open price. Add slippage in the properties for a more realistic test.
Upgrade and export
Written in Pine Script v4. The upgrade to v5 takes 1 step, one per version, each applied to the result of the one before. A last clean-v5 pass then types the settings and moves when = into if blocks, which v6 requires. Every step runs before and after on the same candles in Zeal Terminal's engine; a step whose results differ is shown but not offered as a download. Upgrades preserve behaviour: bugs are fixed in the Review, never silently here.
- Upgrading to v5 renames avg → math.avg, lowest → ta.lowest, highest → ta.highest, atr → ta.atr, tostring → str.tostring.
v4 → v5
VerifiedSame 13 trades and the same P&L on BTCUSDT 1D, 1,000 bars, in Zeal Terminal's engine.
- Line 3: //@version=4 → //@version=5
- Line 10: input(type = input.string) → input.string()
- Line 11: input(type = input.string) → input.string()
- Line 12: input(type = input.integer) → input.int()
- Line 13: input(type = input.float) → input.float()
- Line 14: input(type = input.float) → input.float()
15 more edits
- Line 15: input(type = input.bool) → input.bool()
- Line 16: input(type = input.bool) → input.bool()
- Line 17: input(type = input.bool) → input.bool()
- Line 18: input(type = input.color) → input.color()
- Line 19: input(type = input.color) → input.color()
- Line 20: input(type = input.integer) → input.int()
- Line 21: input(type = input.bool) → input.bool()
- Line 22: input(type = input.bool) → input.bool()
- Line 23: avg → math.avg
- Line 23: lowest → ta.lowest
- Line 23: highest → ta.highest
- Line 26: avg → math.avg
- Line 52: atr → ta.atr
- Line 105: text is reserved in v5: renamed text_
- Line 127: tostring → str.tostring
⋯// © M3RZI-//@version=4+//@version=5strategy("Ichimoku Strategy", overlay = true)⋯displacement = input(26, minval=1, title="Displacement", group = "Ichimoku Settings")-entryStrategy = input(title = "Entry Strategy", defval = "Ichimoku", options = ["Ichimoku"], type = input.string, group = "Entry Strategy")+entryStrategy = input.string(title = "Entry Strategy", defval = "Ichimoku", options = ["Ichimoku"], group = "Entry Strategy")-exitStrategy = input(title = "Exit Strategy", defval = "Ichimoku", options = ["Ichimoku","ATR Pullback"], type = input.string, group = "Position Exit Settings")+exitStrategy = input.string(title = "Exit Strategy", defval = "Ichimoku", options = ["Ichimoku","ATR Pullback"], group = "Position Exit Settings")-exitATRLength = input(14, title = "ATR Length", minval = 1 ,type = input.integer, group = "Position Exit Settings")+exitATRLength = input.int(14, title = "ATR Length", minval = 1 , group = "Position Exit Settings")-exitATRMult = input(2, title = "ATR Multiplier", minval = 0.1 , step = 0.1 ,type = input.float, group = "Position Exit Settings")+exitATRMult = input.float(2, title = "ATR Multiplier", minval = 0.1 , step = 0.1 , group = "Position Exit Settings")-riskReward = input(2, title = "Risk Reward Ratio", minval = 0.1 , step = 0.1 ,type = input.float, group = "Position Exit Settings")+riskReward = input.float(2, title = "Risk Reward Ratio", minval = 0.1 , step = 0.1 , group = "Position Exit Settings")-closeLagBelow = input(true, title = "Close long position if lagging span crosses below the price", type = input.bool, group = "Position Exit Settings")+closeLagBelow = input.bool(true, title = "Close long position if lagging span crosses below the price", group = "Position Exit Settings")-closelagAbove = input(true, title = "Close short position if lagging span crosses above the price", type = input.bool, group = "Position Exit Settings")+closelagAbove = input.bool(true, title = "Close short position if lagging span crosses above the price", group = "Position Exit Settings")-showDash = input(true, title = "Show Dashboard", type = input.bool, group = "Dashboard Options")+showDash = input.bool(true, title = "Show Dashboard", group = "Dashboard Options")-colorDash = input(color.new(#696969, 80), title = "Background Color", type = input.color, inline = "Dash Colors", group = "Dashboard Options")+colorDash = input.color(color.new(#696969, 80), title = "Background Color", inline = "Dash Colors", group = "Dashboard Options")-colorTextDash = input(color.new(#FFFFFF,0), title = "Text Color", type = input.color, inline = "Dash Colors", group = "Dashboard Options")+colorTextDash = input.color(color.new(#FFFFFF,0), title = "Text Color", inline = "Dash Colors", group = "Dashboard Options")-distance = input(30, title = "Bars Distance (to rigth)", minval = 1 ,type = input.integer, group = "Dashboard Options")+distance = input.int(30, title = "Bars Distance (to rigth)", minval = 1 , group = "Dashboard Options")-showSignals = input(true, title = "Show Signals (long/short)", type = input.bool, group = "Extra Options")+showSignals = input.bool(true, title = "Show Signals (long/short)", group = "Extra Options")-showTargets = input(true, title = "Show Targets (Profit/Loss)", type = input.bool, group = "Extra Options")+showTargets = input.bool(true, title = "Show Targets (Profit/Loss)", group = "Extra Options")-donchian(len) => avg(lowest(len), highest(len))+donchian(len) => math.avg(ta.lowest(len), ta.highest(len))conversionLine = donchian(conversionPeriods)baseLine = donchian(basePeriods)-leadLine1 = avg(conversionLine, baseLine)+leadLine1 = math.avg(conversionLine, baseLine)leadLine2 = donchian(laggingSpan2Periods)⋯var pullPrice = 0.0-atrExit = atr(exitATRLength)+atrExit = ta.atr(exitATRLength)if conditionLong⋯decision(condition) =>- var text = ""+ var text_ = "" if condition- text := "🟢"+ text_ := "🟢" else- text := "🔴"+ text_ := "🔴"position = time+((time-time[1])*distance)⋯ +"\n\n---------------Extra---------------"- +"\n\nUnrealized P&L(%): "+tostring(PandL),+ +"\n\nUnrealized P&L(%): "+str.tostring(PandL), xloc = xloc.bar_time, textalign = text.align_left, style = label.style_label_left, color = colorDash, textcolor = colorTextDash)⋯Same 13 trades and the same P&L on BTCUSDT 1D, 1,000 bars, in Zeal Terminal's engine.
- Line 6: input() → input.int()
- Line 7: input() → input.int()
- Line 8: input() → input.int()
- Line 9: input() → input.int()
⋯//ICHIMOKU--------conversionPeriods = input(9, minval=1, title="Conversion Line Length", group = "Ichimoku Settings")+conversionPeriods = input.int(9, minval=1, title="Conversion Line Length", group = "Ichimoku Settings")-basePeriods = input(26, minval=1, title="Base Line Length", group = "Ichimoku Settings")+basePeriods = input.int(26, minval=1, title="Base Line Length", group = "Ichimoku Settings")-laggingSpan2Periods = input(52, minval=1, title="Lagging Span 2 Length", group = "Ichimoku Settings")+laggingSpan2Periods = input.int(52, minval=1, title="Lagging Span 2 Length", group = "Ichimoku Settings")-displacement = input(26, minval=1, title="Displacement", group = "Ichimoku Settings")+displacement = input.int(26, minval=1, title="Displacement", group = "Ichimoku Settings")entryStrategy = input.string(title = "Entry Strategy", defval = "Ichimoku", options = ["Ichimoku"], group = "Entry Strategy")⋯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: 13 before, 0 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.
⋯// © M3RZI-//@version=5+//@version=6strategy("Ichimoku Strategy", overlay = true)⋯Settings
Every input the script declares, with its default and what it feeds. Bounds are the ones the script enforces.
| Setting | Default | Type and range | Feeds |
|---|---|---|---|
| Ichimoku Settings | |||
| Conversion Line Length | 9 | int · min 1 | conversionLine |
| Base Line Length | 26 | int · min 1 | baseLine |
| Lagging Span 2 Length | 52 | int · min 1 | leadLine2 |
| Displacement | 26 | int · min 1 | closeAbvCloud lagSpanAbvCloud closeBlwCloud lagSpanBlwCloud loss Lead 1 Lead 2 close Long close Short line 86 line 95 Lagging Span |
| Entry Strategy | |||
| Entry Strategy | Ichimoku | string · options ["Ichimoku"] | unused |
| Position Exit Settings | |||
| Exit Strategy | Ichimoku | string · options ["Ichimoku","ATR Pullback"] | line 59 line 75 |
| ATR Length | 14 | int (written input.integer) · min 1 | atrExit |
| ATR Multiplier | 2 | float · min 0.1 · step 0.1 | loss |
| Risk Reward Ratio | 2 | float · min 0.1 · step 0.1 | profit |
| Close long position if lagging span crosses below the price | true | bool | close Long line 86 |
| Close short position if lagging span crosses above the price | true | bool | close Short line 95 |
| Dashboard Options | |||
| Show Dashboard | true | bool | line 112 |
| Background Color | color.new(#696969, 80) | color | dashBoard |
| Text Color | color.new(#FFFFFF,0) | color | dashBoard |
| Bars Distance (to rigth) | 30 | int (written input.integer) · min 1 | position |
| Extra Options | |||
| Show Signals (long/short) | true | bool | Long Signal Short Signal |
| Show Targets (Profit/Loss) | true | bool | Take profit Middle Line Stop Loss |
What it calculates
- ATR (
atr,ta.atrin v5)ATR Length (14)atrExit · line 52
Signal flow
How price data and settings reach the orders. Each box is a name in the script, or several computed the same way; each arrow is a value one of them reads. Hover a box for its members.
Order rules
| Order | Fires when | By default | Line |
|---|---|---|---|
| Open Long long | conditionLong | On | 67 |
| Exit Long exit stop and limit | conditionLong | On | 68 |
| Open Short short | conditionShort | On | 83 |
| Exit Short exit stop and limit | conditionShort | On | 84 |
| Close Long | closeLagBelow and open < close[displacement + 1] | On | 89 |
| Close Long | high[1] >= profit or low[1] <= loss | On | 93 |
| Close Short | closelagAbove and open > close[displacement + 1] | On | 98 |
| Close Short | low[1] <= profit or high[1] >= loss | On | 102 |
Each order is guarded by the setting shown. “Off” orders never fire unless that setting is switched on.
Does it repaint?
No
No repainting patterns in the source, and the live replay matched history.
- ClearHigher-timeframe dataThe script requests no other symbol or timeframe.
- ClearFuture-bar referencesNo negative history offsets such as close[-1].
- ClearIntrabar recalculationNo varip, calc_on_every_tick or realtime-only state. Orders are decided once per closed bar.
- ClearOrder timingOrders fill at the next bar's open, after the signal bar has closed.
The checks read the source; the replay runs it. Together they catch the common causes, not every possible one.
Other markets
The same script with default settings on 8 Binance markets. Each row is a separate backtest over the most recent 1,000 bars.
| Market | Net | Buy and hold | Trades | Won | Profit factor | Max drawdown | Period |
|---|---|---|---|---|---|---|---|
| BTCUSDT 1D | +80.9% | +102.5% | 13 | 46% | 1.20 | 148.2% | 26 Jan 2024 – 21 Oct 2026 |
| BTCUSDT 4h | +108.9% | +5.5% | 11 | 36% | 2.58 | 31.3% | 8 May 2026 – 21 Oct 2026 |
| ETHUSDT 1D | −3.4% | +9.8% | 8 | 50% | 0.70 | 7.9% | 26 Jan 2024 – 21 Oct 2026 |
| ETHUSDT 4h | +1.3% | +8.4% | 11 | 55% | 1.53 | 1.7% | 8 May 2026 – 21 Oct 2026 |
| SOLUSDT 1D | −0.1% | +16.7% | 9 | 33% | 0.93 | 0.9% | 26 Jan 2024 – 21 Oct 2026 |
| SOLUSDT 4h | +0.0% | +21.5% | 9 | 44% | 1.34 | 0.1% | 8 May 2026 – 21 Oct 2026 |
| BNBUSDT 1D | +2.4% | +148.3% | 9 | 78% | 5.50 | 1.1% | 26 Jan 2024 – 21 Oct 2026 |
| BNBUSDT 4h | +0.1% | +17.1% | 9 | 22% | 1.22 | 0.5% | 8 May 2026 – 21 Oct 2026 |
Backtests are simulations on historical data and are not investment advice.
The trades
By market direction
| At entry, last 90 bars | Trades | Won | P&L |
|---|---|---|---|
| Rising market | 1 | 0% | −$41,043.50 |
| Sideways market | 12 | 50% | $121,957.00 |
| Falling market | 0 | — | $0.00 |
Rising and falling mean the market moved more than 15% over the 90 bars before entry.
How bad could the drawdown be?
3,897.7%
The 95th percentile of the worst drawdown when the same 13 trades are reshuffled 5,000 times. The bar spans the 5th to 95th percentile, 103.2% to 3,897.7%; the tick is what actually happened, 146.1%. Order luck alone moves it this much.
All 13 trades
| Side | Entry | Exit | Bars | P&L |
|---|---|---|---|---|
| long | 22 May 2024 70,148.30 | 15 Jun 2024 66,044.00 | 24 | −$41,043.50 |
| short | 25 Jun 2024 60,293.30 | 5 Jul 2024 54,401.40 | 10 | $58,919.10 |
| long | 27 Jul 2024 67,908.00 | 1 Aug 2024 63,336.90 | 5 | −$45,710.50 |
| short | 8 Aug 2024 55,133.80 | 8 Aug 2024 62,741.50 | 0 | −$76,077.20 |
| long | 25 Sep 2024 64,262.70 | 10 Oct 2024 59,215.00 | 15 | −$50,477.00 |
| short | 24 Feb 2025 96,258.00 | 25 Feb 2025 86,547.80 | 1 | $97,102.00 |
| long | 25 Apr 2025 93,980.50 | 22 May 2025 111,160.00 | 27 | $171,793.00 |
| short | 7 Sep 2025 110,188.00 | 16 Sep 2025 115,350.00 | 9 | −$51,617.30 |
| long | 6 Oct 2025 123,482.00 | 10 Oct 2025 111,778.00 | 4 | −$117,045.00 |
| short | 16 Oct 2025 110,763.00 | 17 Oct 2025 107,355.00 | 1 | $34,078.90 |
| long | 2 May 2026 78,231.10 | 20 May 2026 76,834.40 | 18 | −$13,967.70 |
| short | 3 Jun 2026 66,760.80 | 25 Jun 2026 58,655.00 | 22 | $81,058.40 |
| long | 21 Aug 2026 73,027.00 | 18 Sep 2026 76,417.00 | 28 | $33,899.90 |
Similar scripts
Indicators and strategies built from the same calculations, run on BTCUSDT 1D with their own defaults so they can be compared directly.
| Script | Shares | Type | Net | Trades | Max drawdown |
|---|---|---|---|---|---|
| Ichimoku Long and Short Strategy this page | — | v4 strategy | +80.9% | 13 | 148.2% |
| SOJA PIVOT by ParaBellum68 | atr | v4 strategy | +3.3% | 9 | 18.2% |
| Volatility System by EduardoMattje | atr | v5 strategy | +150.2% | 2 | 21.5% |
| ATR Stop Buy Strategy by phobo3s | atr | v4 strategy | No trades on this market | ||
| VBand Strategy by Saravanan_Ragavan | atr | v4 strategy | No trades on this market | ||
| Volatility Breakout Strategy [Angel Algo] by AngelAlgo | atr | v5 strategy | +3.1% | 18 | 3.6% |
Where it runs
| Engine | Compiles | Runs | Matches TradingView |
|---|---|---|---|
| Zeal Terminal · OpenPineScript v2 | Yes 51 ms | Yes 1,000 bars in 116 ms | Not measured |
| PineTS | No v5 and v6 only | — | Not measured |
“Matches TradingView” needs this script's own output exported from TradingView and compared bar by bar, which has not been done for this script. The engine is built on OpenPineScript, whose conformance results are in its conformance report. PineTS runs Pine Script v5 and v6 only.
Source
Copied verbatim from the author's published script, with its licence header intact. The author may have updated the original since this snapshot.
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/// © M3RZI//@version=4strategy("Ichimoku Strategy", overlay = true)//ICHIMOKU-------conversionPeriods = input(9, minval=1, title="Conversion Line Length", group = "Ichimoku Settings")basePeriods = input(26, minval=1, title="Base Line Length", group = "Ichimoku Settings")laggingSpan2Periods = input(52, minval=1, title="Lagging Span 2 Length", group = "Ichimoku Settings")displacement = input(26, minval=1, title="Displacement", group = "Ichimoku Settings")entryStrategy = input(title = "Entry Strategy", defval = "Ichimoku", options = ["Ichimoku"], type = input.string, group = "Entry Strategy")exitStrategy = input(title = "Exit Strategy", defval = "Ichimoku", options = ["Ichimoku","ATR Pullback"], type = input.string, group = "Position Exit Settings")exitATRLength = input(14, title = "ATR Length", minval = 1 ,type = input.integer, group = "Position Exit Settings")exitATRMult = input(2, title = "ATR Multiplier", minval = 0.1 , step = 0.1 ,type = input.float, group = "Position Exit Settings")riskReward = input(2, title = "Risk Reward Ratio", minval = 0.1 , step = 0.1 ,type = input.float, group = "Position Exit Settings")closeLagBelow = input(true, title = "Close long position if lagging span crosses below the price", type = input.bool, group = "Position Exit Settings")closelagAbove = input(true, title = "Close short position if lagging span crosses above the price", type = input.bool, group = "Position Exit Settings")showDash = input(true, title = "Show Dashboard", type = input.bool, group = "Dashboard Options")colorDash = input(color.new(#696969, 80), title = "Background Color", type = input.color, inline = "Dash Colors", group = "Dashboard Options")colorTextDash = input(color.new(#FFFFFF,0), title = "Text Color", type = input.color, inline = "Dash Colors", group = "Dashboard Options")distance = input(30, title = "Bars Distance (to rigth)", minval = 1 ,type = input.integer, group = "Dashboard Options")showSignals = input(true, title = "Show Signals (long/short)", type = input.bool, group = "Extra Options")showTargets = input(true, title = "Show Targets (Profit/Loss)", type = input.bool, group = "Extra Options")donchian(len) => avg(lowest(len), highest(len))conversionLine = donchian(conversionPeriods)baseLine = donchian(basePeriods)leadLine1 = avg(conversionLine, baseLine)leadLine2 = donchian(laggingSpan2Periods)//---------------------var long = falsevar short = falsevar signalLong = falsevar signalShort = false//LONG conAbvBase = conversionLine > baseLine cloudGreen = leadLine1 > leadLine2 closeAbvCloud = open > leadLine1[displacement] and open > leadLine2[displacement] lagSpanAbvCloud = close > leadLine1[displacement*2] and close > leadLine2[displacement*2] conditionLong = not long and conAbvBase and cloudGreen and closeAbvCloud and lagSpanAbvCloud //SHORTconBlwBase = conversionLine < baseLine cloudRed = leadLine2 > leadLine1 closeBlwCloud = open < leadLine1[displacement] and open < leadLine2[displacement] lagSpanBlwCloud = close < leadLine1[displacement*2] and close < leadLine2[displacement*2] conditionShort = not short and conBlwBase and cloudRed and closeBlwCloud and lagSpanBlwCloud var drawing = falsevar waitingLong = falsevar waitingShort = falsevar profit = 0.0var current = 0.0var loss = 0.0var pullPrice = 0.0atrExit = atr(exitATRLength)if conditionLong long := true short := false signalLong := true signalShort := false drawing := true if exitStrategy == "Ichimoku" loss := leadLine2[displacement] < leadLine1[displacement] ? leadLine2[displacement] : leadLine1[displacement] profit := open + ((open - loss) * riskReward) current := open else loss := open - atrExit * exitATRMult current := open profit := open + (open - loss) * riskReward strategy.entry("Long", strategy.long, 10 ,alert_message = "Long Position Open") strategy.exit("Long exit", "Long", limit = profit, stop = loss, alert_message = "Long Position Close")if conditionShort short := true long := false signalShort := true signalLong := false drawing := true if exitStrategy == "Ichimoku" loss := leadLine2[displacement] > leadLine1[displacement] ? leadLine2[displacement] : leadLine1[displacement] profit := open - ((loss - open) * riskReward) current := open else loss := open + atrExit * exitATRMult current := open profit := open - (loss - open) * riskReward strategy.entry("Short", strategy.short, 10 , alert_message = "Short Position Open") strategy.exit("Short exit","Short", limit = profit, stop = loss, alert_message = "Short Position Close")if long if closeLagBelow and open < close[displacement + 1] drawing := false signalLong := false strategy.close("Long", alert_message = "Long Closed by Lagging Span Crossing Below Price") else if high[1] >= profit or low[1] <= loss drawing := false signalLong := false strategy.close("Long", alert_message = "Long Closed")if short if closelagAbove and open > close[displacement + 1] drawing := false signalShort := false strategy.close("Short", alert_message = "Short Closed by Lagging Span Crossing Above Price") else if low[1] <= profit or high[1] >= loss drawing := false signalShort := false strategy.close("Short", alert_message = "Short Closed") decision(condition) => var text = "" if condition text := "🟢" else text := "🔴"position = time+((time-time[1])*distance)PandL = signalLong ? ((open-current)/current)*100 : signalShort ? (((open-current)/current)*100)*-1 : 0.0if showDash label dashBoard = label.new(position,open, text = "-----------Long conditions-----------" +"\n\n"+decision(signalLong)+" Long position is open" +"\n\n"+decision(conAbvBase)+" Conversion line above base line" +"\n\n"+decision(cloudGreen)+" Cloud is green" +"\n\n"+decision(closeAbvCloud)+" Price closed above cloud" +"\n\n"+decision(lagSpanAbvCloud)+" Lagging span above cloud" +"\n\n-----------Short conditions-----------" +"\n\n"+decision(signalShort)+" Short position is open" +"\n\n"+decision(conBlwBase)+" Conversion line below base line" +"\n\n"+decision(cloudRed)+" Cloud is red" +"\n\n"+decision(closeBlwCloud)+" Price closed below cloud" +"\n\n"+decision(lagSpanBlwCloud)+" Lagging span below cloud" +"\n\n---------------Extra---------------" +"\n\nUnrealized P&L(%): "+tostring(PandL), xloc = xloc.bar_time, textalign = text.align_left, style = label.style_label_left, color = colorDash, textcolor = colorTextDash) label.delete(dashBoard[1])//DRAWINGplotshape(showSignals ? conditionLong : na, title = "Long Signal", location=location.belowbar,style=shape.labelup,color=color.green,textcolor=color.white,size=size.small,text="Long")plotshape(showSignals ? conditionShort : na, title = "Short Signal", location=location.abovebar,style=shape.labeldown,color=color.red,textcolor=color.white,size=size.small,text="Short")profitLine = plot(showTargets ? drawing ? profit : na : na, title = "Take profit", color = color.green, style = plot.style_linebr)currentLine =plot(showTargets ? drawing ? current : na : na, title = "Middle Line", color = color.white, style = plot.style_linebr)lossLine = plot(showTargets ? drawing ? loss : na : na, title = "Stop Loss", color = color.red, style = plot.style_linebr)fill(currentLine,profitLine, title = "Profit Background" ,color = color.new(color.green,75))fill(currentLine,lossLine, title = "Loss Background" ,color = color.new(color.red,75))plot(conversionLine, color = #0496ff, title = "Conversion Line")plot(baseLine, color = color.yellow, title = "Base Line")plot(close, offset = -displacement + 1, color = color.purple, title = "Lagging Span")p1 = plot(leadLine1, offset = displacement - 1, color=color.green, title="Lead 1")p2 = plot(leadLine2, offset = displacement - 1, color=color.red, title="Lead 2")fill(p1, p2, title = "Lead 1 and 2 Background" ,color = leadLine1 > leadLine2 ? color.green : color.red)//------NOTE FOR ALERTS//IF YOU WANT TO RECIVE A ALERT JUST FOLLOW THE NEXT STEPS://1.-GO TO ALERTS AND CLICK IN "CREATE NEW ALERT"//2.-IN CONDITION CHOOSE THE "ICHIMOKU STRATEGY"//3.-GIVE THE ALERT A NAME//4.-IN MESSAGE YOU ARE GOING TO WRITE "{{strategy.order.alert_message}}", WITH THIS WHEN A SHORT OR LONG SIGNAL APPEAR WILL SHOW THE "alert_message" IN THE ALERT.//THE alert_message IS DEFINED IN THE "strategy.entry" and "strategy.exit"//------NOTE IF YOU WANT TO USE A BOT WITH THIS STRATEGY//THIS IS A STRATEGY SO YOU ONLY CAN RECIVE ALERTS FROM THE "strategy.entry" AND "strategy.exit" BUT THIS ARE ONLY IN ONE ALERT//SO IF YOU WANT TO USE A BOTH WITH THE STRATEGY FOLLOW THE NEXT STEPS://1.-ALREADY HAVE A BOT CREATED//2.-LOCATE YOUR WEBHOOK AND COMMANDS FOR THE BOT //3.-IN THE "alert_message" OF THE "strategy.entry (LINE 95)" YOU WILL PASTE THE COMMAND OF YOUR BOT FOR ENTER A LONG AND IN THE "strategy.exit (LINE 96)" THAT ARE BELOW IN THE "alert_message" PASTE THE COMMAND THAT IS FOR CLOSE THE LONG POSITION//4.-YOU WILL DO THE SAME FOR THE "strategy.entry (LINE 109)" AND THE "strategy.exit (LINE 110)" BUT THIS TIME WITH THE COMMAND OF OPEN A SHORT AND CLOSE A SHORT//5.-AFTER THE PREVIOUS STEPS GO TO ALERTS AND CLICK IN "CREATE NEW ALERT"//6.-IN CONDITION CHOOSE THE "ICHIMOKU STRATEGY"//7.-SELECT "URL from webhook"//8.-GIVE THE ALERT A NAME//9.-IN MESSAGE WRITE "{{strategy.order.alert_message}}"//10.-NOW WITH ALL THIS EACH TIME A SIGNAL APPEAR IN THE STRATEGY THIS WILL SEND THE COMMAND TO YOUR BOT TO OPEN OR CLOSE A LONG OR SHORT////------ANOTHER IMPORTANT NOTE FOR PEOPLE THAT WANT TO USE A BOT//I NOW THAT I'M SO BAD EXPLAINING THINGS SO WATCH THE FOLLOWING VIDEO THAT EXPLAINS BETTER THAN ME, ITS FROM THE CHANNEL "The Art of Trading"//AND ALSO U CAN CHECK HIS TRADINGVIEW ACCOUNT, HE CREATE AN AMAZING SCRIPT FOR THE COMMUNITY AND CHECK HIS CHANNEL TO LEARN PINE SCRIPT//https://www.youtube.com/watch?v=-d_rFRd3o-0//https://es.tradingview.com/u/ZenAndTheArtOfTrading/#published-charts