Pine Script v5 · Strategy
tvbot Trend Following with Mean Reversion algo
A Pine Script v5 strategy built on EMA (close, 420), VWMA (close, 94) and Crossover (close, hull). It has 8 order rules, 4 entries among them, and trades long and short with the default settings. Exits wait for a signal; there is no stop loss. Each trade commits 10% of equity and pays 0.075% commission. 16 settings; defaults include Exchange Coinex, Ordertype Market and Cash per Trade 10.
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 tvbot Trend Following with Mean Reversion algo repaint?
- No
- No repainting patterns were found in the source. The live replay was not measured: the script acts only when barstate.isconfirmed is true, which Zeal Terminal's engine never reports during a live replay (it does not run a bar's closing update in live mode), so the replay cannot test this script.
- How did tvbot Trend Following with Mean Reversion algo do on BTCUSDT 1D with default settings?
- Not measured
- It closed no trades there from 26 Jan 2024 to 21 Oct 2026 with the default settings; it opened a long position that was still open on the last bar, so there is no result to report. Its code limits trading to a date window, which can leave this period out. On ETHUSDT 1D it did trade; that row of the markets table below has its figures. A backtest, not investment advice.
- Does tvbot Trend Following with Mean Reversion algo run in Pine Script v6?
- Yes
- Same 1 trades and the same P&L on ETHUSDT 1D, 1,000 bars, in Zeal Terminal's engine. Both versions were run on Zeal Terminal's engine, and the results are identical. The v6 script can be downloaded below.
- Does tvbot Trend Following with Mean Reversion algo use a stop loss?
- No
- Every exit waits for a signal; nothing limits a losing trade before it fires.
- Does tvbot Trend Following with Mean Reversion algo run in Zeal Terminal?
- Yes
- It compiles in 240 ms and runs 1,000 bars in 118 ms, in the browser.
BTCUSDT · 1D · default settings
- Plot
- Plot
- trend mean
- trend following
- Reversion
- Winning trade
- Losing trade
- Equity
- Buy and hold
- Net profit
- −0.01%
- −$0.75
- Buy and hold
- +102.5%
- same period
- Closed trades
- 0
- 0 won · 0 lost
- Profitable
- 0.0%
- of closed trades
- Profit factor
- 0.00
- gross profit ÷ gross loss
- Max drawdown
- 0.75%
- −$75.03
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.
-
Check
No stop loss
Every exit waits for a signal. Nothing limits a losing trade before the exit condition fires.
-
Note
Uses an argument v6 removed
when = on line 167, 168, 169, 170. 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.
| Setting | Default | Type and range | Feeds |
|---|---|---|---|
| Enable / Disable | |||
| Enable Long | true | bool | entry Buy Trend entry Buy Reversion line 173 line 181 |
| Enable Short | true | bool | entry Sell Trend entry Sell Reversion line 176 line 184 |
| SERVER SIDE | |||
| Exchange | Coinex | string · options ["Coinex"] | LEmessage LCmessage SEmessage SCmessage line 36 |
| Ordertype | Market | string · options ["Market", "Limit"] | LEmessage LCmessage SEmessage SCmessage |
| Cash per Trade | 10 | float · min -100 | ordervolume line 39 line 41 |
| Leverage | 0 | int · min 0 | LEmessage LCmessage SEmessage SCmessage line 33 line 36 |
| Start Time | timestamp("01 Jan 2021 13:30 +0000") | time | afterStartDate |
| Passphrase | | string | LEmessage LCmessage SEmessage SCmessage |
| key | | string | LEmessage LCmessage SEmessage SCmessage |
| Secret | | string | LEmessage LCmessage SEmessage SCmessage |
| TrendLine | |||
| Source | close | source | ma hull hull1 ma1 entry Buy Trend entry Sell Trend entry Buy Reversion entry Sell Reversion close Buy Trend close Sell Trend close Buy Reversion close Sell Reversion line 173 line 176 line 181 line 184 |
| Entry | 94 | int · min 1 | hull |
| ma | 420 | int · min 1 | ma |
| SMA Touch | |||
| SMA Touch Difference (%) | 0.2 | float · min 0.0 · step 0.1 | longExitPrice shortExitPrice |
| Reversion | |||
| Entry | 277 | int · min 1 | hull1 |
| ma | 1100 | int · min 1 | ma1 |
What it calculates
- EMASource (close), ma (420)
ma · line 61 - VWMASource (close), Entry (94)
hull · line 62 - Crossoverclose, hull
buyhullcross · line 83 - Crossunderclose, hull
sellhullcross · line 84 - WMA2*ta.wma(averageData, length2/2)-ta.wma(averageData, length2), math.floor(math.sqrt(length2))
hull1 · line 119 - EMASource (close), ma (1100)
ma1 · line 120 - Crossoverclose, hull1
buyhullcross1 · line 130 - Crossunderclose, hull1
sellhullcross1 · line 131
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 |
|---|---|---|---|
| Close Buy Trend | sellcdn or sellcdn1 and averageData > triggerup | On | 167 |
| Close Sell Trend | buycdn or buycdn1 and averageData < triggerdown | On | 168 |
| Close Buy Reversion | sellcdn1 or sellcdn and (averageData < ma) and is_sma_touch[1] | On | 169 |
| Close Sell Reversion | buycdn1 or buycdn and (averageData > ma) and is_sma_touch[1] | On | 170 |
| Open Buy Trend long | buycdn and (averageData > ma) and is_sma_touch[1] and enableLong and afterStartDate | On | 174 |
| Open Sell Trend short | sellcdn and (averageData < ma) and is_sma_touch[1] and enableShort and afterStartDate | On | 177 |
| Open Buy Reversion long | buycdn1 and averageData < triggerdown and enableLong and afterStartDate | On | 182 |
| Open Sell Reversion short | sellcdn1 and averageData > triggerup and enableShort and afterStartDate | On | 185 |
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.
- 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 | −0.0% | +102.5% | 0 | 0% | 0.00 | 0.8% | 26 Jan 2024 – 21 Oct 2026 |
| BTCUSDT 4h | 0.0% | +5.5% | 0 | 0% | — | 0.0% | 8 May 2026 – 21 Oct 2026 |
| ETHUSDT 1D | +1.3% | +9.8% | 1 | 100% | — | 2.5% | 26 Jan 2024 – 21 Oct 2026 |
| ETHUSDT 4h | 0.0% | +8.4% | 0 | 0% | — | 0.0% | 8 May 2026 – 21 Oct 2026 |
| SOLUSDT 1D | +1.1% | +16.7% | 2 | 50% | 1.51 | 3.7% | 26 Jan 2024 – 21 Oct 2026 |
| SOLUSDT 4h | +0.8% | +21.5% | 2 | 50% | 1.60 | 1.5% | 8 May 2026 – 21 Oct 2026 |
| BNBUSDT 1D | +3.5% | +148.3% | 1 | 100% | 458.26 | 0.3% | 26 Jan 2024 – 21 Oct 2026 |
| BNBUSDT 4h | 0.0% | +17.1% | 0 | 0% | — | 0.0% | 8 May 2026 – 21 Oct 2026 |
Backtests are simulations on historical data and are not investment advice.
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 |
|---|---|---|---|---|---|
| tvbot Trend Following with Mean Reversion algo this page | — | v5 strategy | −0.0% | 0 | 0.8% |
| SL1 Pips after TP2 (MA) by gpadihar | ema wma | v4 strategy | +0.4% | 33 | 0.1% |
| TriautoETF(TQQQ) Short Strategy B1 by BBcom | vwma ema | v5 strategy | No trades on this market | ||
| Escaping of Rate from Avarage By Mustafa OZVER Strategy by Mustafaozver | wma ema | v4 strategy | +122.0% | 96 | 79.1% |
| Bollinger Band with Fib Golden Ratio (0.618) by mohanee | vwma ema | v4 strategy | No trades on this market | ||
| Forex SWING Trader by SoftKill21 | wma ema | v4 strategy | No trades on this market | ||
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.
- 4 strategy calls use the when = argument (line 167, 168, 169, 170). It is deprecated in v5 and removed in v6, where each call moves inside an if block.
- No v6-only features. v6 is not needed to run this script.
Same 1 trades and the same P&L on ETHUSDT 1D, 1,000 bars, in Zeal Terminal's engine.
- Line 167: when = sellcdn or sellcdn1 and averageData > triggerup → if block
- Line 168: when = buycdn or buycdn1 and averageData < triggerdown → if block
- Line 169: when = sellcdn1 or sellcdn and (averageData < ma) and is_sma_touch[1] → if block
- Line 170: when = buycdn1 or buycdn and (averageData > ma) and is_sma_touch[1] → if block
⋯//takeprofit conditions////////////////////-strategy.close('Buy Trend', when = sellcdn or sellcdn1 and averageData > triggerup, alert_message = LCmessage) // this is the take profit condition, when the base entry is triggered it will take profit or an entry condtion from the mean reversion system+if sellcdn or sellcdn1 and averageData > triggerup+ strategy.close('Buy Trend', alert_message = LCmessage) // this is the take profit condition, when the base entry is triggered it will take profit or an entry condtion from the mean reversion system-strategy.close('Sell Trend', when = buycdn or buycdn1 and averageData < triggerdown, alert_message = SCmessage) // this is the take profit condition, when the base entry is triggered it will take profit or an entry condtion from the mean reversion system+if buycdn or buycdn1 and averageData < triggerdown+ strategy.close('Sell Trend', alert_message = SCmessage) // this is the take profit condition, when the base entry is triggered it will take profit or an entry condtion from the mean reversion system-strategy.close('Buy Reversion', when = sellcdn1 or sellcdn and (averageData < ma) and is_sma_touch[1], alert_message = LCmessage) // this is the take profit condition, when the base entry is triggered it will take profit or an entry condition from the trend following system +if sellcdn1 or sellcdn and (averageData < ma) and is_sma_touch[1]+ strategy.close('Buy Reversion', alert_message = LCmessage) // this is the take profit condition, when the base entry is triggered it will take profit or an entry condition from the trend following system -strategy.close('Sell Reversion', when = buycdn1 or buycdn and (averageData > ma) and is_sma_touch[1], alert_message = SCmessage) // this is the take profit condition, when the base entry is triggered it will take profit or an entry condtion from the trend following system+if buycdn1 or buycdn and (averageData > ma) and is_sma_touch[1]+ strategy.close('Sell Reversion', alert_message = SCmessage) // this is the take profit condition, when the base entry is triggered it will take profit or an entry condtion from the trend following system/////////////////////////////////⋯Does it run in Pine Script v6?
Yes
Same 1 trades and the same P&L on ETHUSDT 1D, 1,000 bars, in Zeal Terminal's engine. Both versions were run on Zeal Terminal's engine, and the results are identical. It differs from the v5 version by 1 edit.
⋯// © tvbot-//@version=5+//@version=6strategy("tvbot Trend Following Algo", overlay=true, precision=2, commission_value=0.075, commission_type=strategy.commission.percent, initial_capital=10000, currency=currency.USD, default_qty_type=strategy.percent_of_equity, default_qty_value=10, slippage=1, pyramiding=0)⋯Where it runs
| Engine | Compiles | Runs | Matches TradingView |
|---|---|---|---|
| Zeal Terminal · OpenPineScript v2 | Yes 240 ms | With a workaround 1,000 bars in 118 ms | Not measured |
| PineTS | Not tested | Not tested | Not measured |
Zeal Terminal's engine currently reads an order side written as direction = strategy.long, direction = strategy.short as a short, whatever it says; this page passes the same side as strategy.long or strategy.short (lines 174, 177, 182, 185) so the engine trades the way the script says.
“Matches TradingView” needs this script's own output exported from TradingView and compared bar by bar, which has not been done for this script. The engine is built on OpenPineScript, whose conformance results are in its conformance report.
Source
Copied verbatim from the author's published script, with its licence header intact. The author may have updated the original since this snapshot.
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/// © tvbot//@version=5strategy("tvbot Trend Following Algo", overlay=true, precision=2, commission_value=0.075, commission_type=strategy.commission.percent, initial_capital=10000, currency=currency.USD, default_qty_type=strategy.percent_of_equity, default_qty_value=10, slippage=1, pyramiding=0)////////////////////////////////////////////// USER INPUT /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////Code below this line is the start of the Automated Trading Platform(ATP) code. It sets the parameters to send the webhook message to the Automated Trading Platform(ATP) to execute the trade/// /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////enableLong = input.bool(true, "Enable Long", group = "Enable / Disable") enableShort = input.bool(true, "Enable Short", group = "Enable / Disable") //////////////////// SERVER DATA INPUT exchange = input.string(title="Exchange", defval="Coinex", options=["Coinex"], group = "SERVER SIDE") ordertype = input.string(title="Ordertype", defval="Market", options=["Market", "Limit"], group = "SERVER SIDE") cash = input.float(title="Cash per Trade", defval=10, minval=-100, group = "SERVER SIDE") leverage = input.int(title="Leverage", defval=0, minval=0, group = "SERVER SIDE") i_time = input.time(defval = timestamp("01 Jan 2021 13:30 +0000"), title = "Start Time", group = "SERVER SIDE") afterStartDate = (time >= i_time) passphrase = input.string(title="Passphrase", defval='', group = "SERVER SIDE") key = input.string(title="key", defval='', group = "SERVER SIDE") secret = input.string(title="Secret", defval='', group = "SERVER SIDE") ////////////////// FILTER SERVER DATA message = '' var pair = "" var ordervolume = 0.0 if leverage == 0 pair := syminfo.basecurrency + "/" + syminfo.currency else if exchange == "Coinex" and leverage > 0 pair := syminfo.basecurrency + "/" + syminfo.currency + ":" + syminfo.currency if cash > 0 ordervolume := math.round(cash / close, 5) else if cash < 0 ordervolume := cash /////////////////////////////////////////////// ALERT MESSAGE LEmessage = exchange + " long/buy " + pair + " " + ordertype + " " + str.tostring(ordervolume) + " " + str.tostring(close) + " " + str.tostring(leverage) + " " + passphrase + " " + key + " " + secret LCmessage = exchange + " long/sell " + pair + " " + ordertype + " " + str.tostring(ordervolume) + " " + str.tostring(close) + " " + str.tostring(leverage) + " " + passphrase + " " + key + " " + secret SEmessage = exchange + " short/buy " + pair + " " + ordertype + " " + str.tostring(ordervolume) + " " + str.tostring(close) + " " + str.tostring(leverage) + " " + passphrase + " " + key + " " + secret SCmessage = exchange + " short/sell " + pair + " " + ordertype + " " + str.tostring(ordervolume) + " " + str.tostring(close) + " " + str.tostring(leverage) + " " + passphrase + " " + key + " " + secret ///////////////////////////////////////////////////////////////////The code for the Automated Trading Platform(ATP) ends here////////////////////////////////////////////////////////////////////// // Inputs averageData = input.source(close, title="Source", group = "TrendLine") length = input.int(94, minval=1, title="Entry", group = "TrendLine") length3 = input.int(420, minval=1, title="ma", group = "TrendLine") ma = ta.ema(averageData, length3) //ema is used as the trendlinehull = ta.vwma(averageData, length) //Base entry parameters use the vwma//section of code below turns the trendline into a range instead of a static line.////////////////////////////////////Perc = input.float(title="SMA Touch Difference (%)", minval=0.0, step=0.1, defval=0.2, group = "SMA Touch") / 100///// /////longExitPrice = ma * (1 + Perc) /////shortExitPrice = ma * (1 - Perc) ///// /////plot(longExitPrice, color = color.red, display = display.none) /////plot(shortExitPrice, color = color.red, display = display.none) ///// ///////section of code above turns the trendline into a range instead of a static line.//////////////////////////////////////Code below this line is what sets the base entry condition. When a candle closes above or below the vwma, the algorithm records the close price of that candle.//then it waits for the vwma to meet that closed price. When vwma and the closed beaching candle meet then the condition is satisfied.//if the candle breaks back below or above the line it resets the condition.var isbuy = true var isfirstBuyCdnMeet = false var lastbuyClosePrice = 0.0 var isfirstSellCdnMeet = false var lastsellClosePrice = 0.0 buyhullcross = ta.crossover(close , hull) sellhullcross = ta.crossunder(close , hull) buycdn = isfirstBuyCdnMeet and ta.crossover(hull,lastbuyClosePrice) and isbuy sellcdn = isfirstSellCdnMeet and ta.crossunder(hull,lastsellClosePrice) and not isbuy if buyhullcross and barstate.isconfirmed isfirstBuyCdnMeet := true lastbuyClosePrice := close isfirstSellCdnMeet := false if sellhullcross and barstate.isconfirmed isfirstSellCdnMeet := true lastsellClosePrice := close isfirstBuyCdnMeet := false if sellcdn isfirstSellCdnMeet := false isbuy := true if buycdn isfirstBuyCdnMeet := false isbuy := false /////end of base entry condition///////////////////////////////this section of code checks to see if the trend line has been tested. If the trend line has been tested then the condition also checks to see if your already in a position or not//a base entry signal from the code above is triggered will reset the trend line test condition.var is_sma_touch = false is_new_pos = ((strategy.position_size[1] == 0) and (strategy.position_size != 0)) or ((strategy.position_size[1] * strategy.position_size) == -1) // New position: Either we were not in a position before, or direction changed (short -> long or long -> short) sma_touch = (high > longExitPrice) and (low < longExitPrice) or (high > shortExitPrice) and (low < shortExitPrice) or (close < longExitPrice) and (close > shortExitPrice) or (high > ma ) and (low < ma) // SMA should be between high and low for a touch is_sma_touch := is_new_pos ? false : sma_touch ? true : is_sma_touch // Reset flag when it is a new position. Then check if there is a touch, keep its old value otherwise is_sma_touch := (isbuy and sellcdn) ? false : (not isbuy and buycdn) ? false : is_sma_touch // Reset when an opposite signal takes place //////////end of trend line test condition/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// REVERSION INDICATOR////////////////////length2 = input.int(277, minval=1, title="Entry", group = "Reversion") length33 = input.int(1100, minval=1, title="ma", group = "Reversion") hull1 = ta.wma(2*ta.wma(averageData, length2/2)-ta.wma(averageData, length2), math.floor(math.sqrt(length2))) ma1 = ta.ema(averageData, length33) ///Code below is the entry condition for the mean reversion trade, its similar to the trend following entry condition but it uses the HMA instead of the VWMAvar isbuy1 = true var isfirstBuyCdnMeet1 = false var lastbuyClosePrice1 = 0.0 var isfirstSellCdnMeet1 = false var lastsellClosePrice1 = 0.0 buyhullcross1 = ta.crossover(close , hull1) sellhullcross1 = ta.crossunder(close , hull1) buycdn1 = isfirstBuyCdnMeet1 and ta.crossover(hull1,lastbuyClosePrice1) and isbuy1 sellcdn1 = isfirstSellCdnMeet1 and ta.crossunder(hull1,lastsellClosePrice1) and not isbuy1 if buyhullcross1 and barstate.isconfirmed isfirstBuyCdnMeet1 := true lastbuyClosePrice1 := close isfirstSellCdnMeet1 := false if sellhullcross1 and barstate.isconfirmed isfirstSellCdnMeet1 := true lastsellClosePrice1 := close isfirstBuyCdnMeet1 := false if sellcdn1 isfirstSellCdnMeet1 := false isbuy1 := true if buycdn1 isfirstBuyCdnMeet1 := false isbuy1 := false //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////this code is how far the price needs to move away from the trend line/mean before a mean reversion entry is considered.triggerup = 1.01 * ma1triggerdown = 0.99 * ma1 ////////////////////////////////////////// ENTRY AND EXIT code//////////////////////////////////////////////////////////////////////////////"alert_message = LCmessage" is the code to tell the algo to send a LONG CLOSE message to the Automated Trading Platform(ATP)/////"alert_message = SCmessage" is the code to tell the algo to send a SHORT CLOSE message to the Automated Trading Platform(ATP)////"alert_message = LEmessage" is the code to tell the algo to send a LONG ENTRY message to the Automated Trading Platform(ATP)/////"alert_message = SEmessage" is the code to tell the algo to send a SHORT ENTRY message to the Automated Trading Platform(ATP)////"enableLong and afterStartDate" is required for your long entry parameters ////"enableShort and afterStartDate" is required for your short entry parameters //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////takeprofit conditions////////////////////strategy.close('Buy Trend', when = sellcdn or sellcdn1 and averageData > triggerup, alert_message = LCmessage) // this is the take profit condition, when the base entry is triggered it will take profit or an entry condtion from the mean reversion systemstrategy.close('Sell Trend', when = buycdn or buycdn1 and averageData < triggerdown, alert_message = SCmessage) // this is the take profit condition, when the base entry is triggered it will take profit or an entry condtion from the mean reversion systemstrategy.close('Buy Reversion', when = sellcdn1 or sellcdn and (averageData < ma) and is_sma_touch[1], alert_message = LCmessage) // this is the take profit condition, when the base entry is triggered it will take profit or an entry condition from the trend following system strategy.close('Sell Reversion', when = buycdn1 or buycdn and (averageData > ma) and is_sma_touch[1], alert_message = SCmessage) // this is the take profit condition, when the base entry is triggered it will take profit or an entry condtion from the trend following system///////////////////////////////////trend following entry conditions/// if buycdn and (averageData > ma) and is_sma_touch[1] and enableLong and afterStartDate //this is the entry condition, base entry condition, price > trendline and trendline test, long enabled and after date set need to be true before a position is taken strategy.entry('Buy Trend', direction=strategy.long, alert_message = LEmessage) if sellcdn and (averageData < ma) and is_sma_touch[1] and enableShort and afterStartDate //this is the entry condition, base entry condition, price < trendline, trendline test, short enabled and after specified date need to be true before a short positon is taken strategy.entry('Sell Trend', direction=strategy.short, alert_message = SEmessage) ///////////////////// REVERSION entry if buycdn1 and averageData < triggerdown and enableLong and afterStartDate strategy.entry('Buy Reversion', direction=strategy.long, alert_message = LEmessage) if sellcdn1 and averageData > triggerup and enableShort and afterStartDate strategy.entry('Sell Reversion', direction=strategy.short, alert_message = SEmessage) ////////////////////////////////////////// PLOT DATA ON THE CHARTplot(ma, color=color.blue, title = "trend mean") plot(hull, color=color.white, title="trend following")plot(hull1, color=color.black, title ="Reversion") //plotshape(buycdn, title='Buy Label for Trend Indicator', text='Buy', location=location.belowbar, style=shape.labelup, size=size.small, color=color.new(#0000FF, 0), textcolor=color.new(#FFFFFF, 0)) //plotshape(sellcdn, title='Sell Label for Trend Indicator', text='Sell', location=location.abovebar, style=shape.labeldown, size=size.small, color=color.new(#FF0000, 0), textcolor=color.new(#FFFFFF, 0)) //plotshape(buycdn1, title='Buy Label for Reversion Indicator', text='Buy', location=location.belowbar, style=shape.labelup, size=size.small, color=color.new(#0000FF, 0), textcolor=color.new(#FFFFFF, 0)) //plotshape(sellcdn1, title='Sell Label for Reversion Indicator', text='Sell', location=location.abovebar, style=shape.labeldown, size=size.small, color=color.new(#FF0000, 0), textcolor=color.new(#FFFFFF, 0))