Pine Script v5 · Strategy
V Bottom & V Top Pattern [Misu]
A Pine Script v5 strategy built on Crossunder (close, lowP), Crossover (close, highP) and EMA (_body, 9). It has 0 order rules and no entry of its own. Exits wait for a signal; there is no stop loss. Each trade commits 100% of equity and pays no commission. 7 settings; defaults include Deviation 3.1, Depth 8 and Confirmation Type Mid Pivot.
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 V Bottom & V Top Pattern [Misu] repaint?
- No
- No repainting patterns were found in the source.
- Does V Bottom & V Top Pattern [Misu] run in Pine Script v6?
- Not tested
- The v5 script does not run in Zeal Terminal's engine (Pine Script v5 Error at @L6:C0: no source was supplied for the library 'Fontiramisu/fontilab/8'. Libraries cannot be fetched from TradingView; supply the source in the 'libraries' option. No libraries were supplied.), so this step could not be checked. The v6 version is shown for reference and is not offered as a download.
- Does V Bottom & V Top Pattern [Misu] use a stop loss?
- No
- Every exit waits for a signal; nothing limits a losing trade before it fires.
- Does V Bottom & V Top Pattern [Misu] run in Zeal Terminal?
- No
- Not yet: it imports the library Fontiramisu/fontilab/8, whose source is not available here, so it does not run here
Review
What a careful reader of this script would point out, found by checking the source.
-
Check
No stop loss
Every exit waits for a signal. Nothing limits a losing trade before the exit condition fires.
-
Check
No commission
The backtest assumes free trading. Results on any real exchange will be lower.
-
Check
Every trade uses all the equity
default_qty_value is 100% of equity.
-
Note
No slippage
Fills are assumed at the exact open price. Add slippage in the properties for a more realistic test.
Settings
Every input the script declares, with its default and what it feeds. Bounds are the ones the script enforces.
| Setting | Default | Type and range | Feeds |
|---|---|---|---|
| Pivot | |||
| DeviationDeviation is a multiplier that affects how much the price should deviate from the previous pivot in order for the bar to become a new pivot. | 3.1 | float · min 0 · step 0.1 | dupLineLast dupIsHighLast dupIPrev dupILast dupPLast dupPLastHigh dupPLastLow |
| DepthThe minimum number of bars that will be taken into account when analyzing pivots. | 8 | int · min 1 | dupLineLast dupIsHighLast dupIPrev dupILast dupPLast dupPLastHigh dupPLastLow |
| Signal Type Confirmation | |||
| Confirmation Type | Mid Pivot | string · options ["At First Break", "Mid Pivot", "Opposit Pivot", "No Confirmation"] | isBreakBarAvg vBotConfSrc vTopConfSrc |
| Breakouts Settings | |||
| Lenght Avg Body | 9 | int | _bodyAvg |
| First Breakout FactorFactor used to validate the first breakout of the V pattern | 0.2 | float · step 0.1 | _breakAboveLowP _breakUnderHighP |
| Confirmation Breakout FactorFactor used to validate the confirmation breakout of the V pattern | 1.2 | float · step 0.1 | isBreakBarAvg |
| Timing Confirmation | |||
| Max Bars Confirmation | 11 | int | line 134 line 144 |
What it calculates
- Crossunderclose, lowP
breakLevelVbotPot · line 78 - Crossoverclose, highP
breakLevelVtopPot · line 79 - EMA_body, Lenght Avg Body (9)
_bodyAvg · line 69 - ATR30
distLabel · line 163
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
The script places no orders.
Each order is guarded by the setting shown. “Off” orders never fire unless that setting is switched on.
Does it repaint?
No
No repainting patterns in the source.
The live replay needs a run, and this script does not run in Zeal Terminal yet; the answer comes from the checks on the source alone.
- ClearHigher-timeframe dataThe script requests no other symbol or timeframe.
- ClearFuture-bar referencesNo negative history offsets such as close[-1].
- ClearIntrabar recalculationNo varip, calc_on_every_tick or realtime-only state. Orders are decided once per closed bar.
- ClearOrder timingOrders fill at the next bar's open, after the signal bar has closed.
The checks read the source; the replay runs it. Together they catch the common causes, not every possible one.
Similar scripts
Indicators and strategies built from the same calculations.
| Script | Shares | Type | Net | Trades | Max drawdown |
|---|---|---|---|---|---|
| Trend Reversal - Potential pressure by BardiaB2 | atr ema | v4 strategy | +133,960.0% | 5 | 1,504.8% |
| Simple Ema_ATR Strategy HulkTrading by TheHulkTrading | ema atr | v4 strategy | +2.2% | 14 | 15.6% |
| Keltner Breakout Strategy by Zeal Terminal | ema atr | v5 strategy | +3.5% | 21 | 2.3% |
| [EKIN] ATR Exit Strategy by ekinbasarkomur | ema atr | v5 strategy | +781.7% | 30 | 2,960.8% |
| DEMA-EMA & VOLATILITY (VAMS) by Qorbanjf | ema atr | v4 strategy | +2,833,450.0% | 19 | 15,721.0% |
Upgrade and export
Written in Pine Script v5. The clean-v5 step types the settings and moves when = into if blocks, which v6 requires; it is run before and after like any upgrade.
- No v6-only features. v6 is not needed to run this script.
Clean v5
VerifiedNothing to change.
Does it run in Pine Script v6?
Not tested
The v5 script does not run in Zeal Terminal's engine (Pine Script v5 Error at @L6:C0: no source was supplied for the library 'Fontiramisu/fontilab/8'. Libraries cannot be fetched from TradingView; supply the source in the 'libraries' option. No libraries were supplied.), so this step could not be checked. The v6 version is shown for reference and is not offered as a download. It differs from the v5 version by 1 edit.
⋯// Author : @Fontiramisu-// @version=5 +// @version=6 strategy("V Bottom/Top Pattern [Misu]", shorttitle="V pattern [Misu]", overlay=true, initial_capital=50000, default_qty_type=strategy.percent_of_equity, default_qty_value=100)⋯Where it runs
| Engine | Compiles | Runs | Matches TradingView |
|---|---|---|---|
| Zeal Terminal · OpenPineScript v2 | No It imports the library Fontiramisu/fontilab/8, whose source is not available here, so it does not run here | Not measured | |
| PineTS | Not tested | Not tested | 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.
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/// Author : @Fontiramisu// @version=5 strategy("V Bottom/Top Pattern [Misu]", shorttitle="V pattern [Misu]", overlay=true, initial_capital=50000, default_qty_type=strategy.percent_of_equity, default_qty_value=100)// import Fontiramisu/fontLib/80 as fontilabimport Fontiramisu/fontilab/8 as fontilab// -------- Find dev pivots ---------- [// -- Var user input --var devTooltip = "Deviation is a multiplier that affects how much the price should deviate from the previous pivot in order for the bar to become a new pivot."var depthTooltip = "The minimum number of bars that will be taken into account when analyzing pivots."thresholdMultiplier = input.float(title="Deviation", defval=3.1, step=0.1, minval=0, tooltip=devTooltip, group="Pivot")depth = input.int(title="Depth", defval=8, minval=1, tooltip=depthTooltip, group="Pivot") // Prepare pivot variablesvar line lineLast = navar int iLast = 0 // Index lastvar int iPrev = 0 // Index previousvar float pLast = 0 // Price lastvar float pLastHigh = 0 // Price lastvar float pLastLow = 0 // Price lastvar isHighLast = false // If false then the last pivot was a pivot lowisPivotUpdate = false// Get pivot information from dev pivot finding function[dupLineLast, dupIsHighLast, dupIPrev, dupILast, dupPLast, dupPLastHigh, dupPLastLow] = fontilab.getDeviationPivots(thresholdMultiplier, depth, lineLast, isHighLast, iLast, pLast, true, close, high, low)if not na(dupIsHighLast) lineLast := dupLineLast isHighLast := dupIsHighLast iPrev := dupIPrev iLast := dupILast pLast := dupPLast pLastHigh := dupPLastHigh pLastLow := dupPLastLow isPivotUpdate := true// Plot.// Get last Pivots.var highP = 0.0var lowP = 0.0var midP = 0.0highP := isHighLast ? pLast : highPlowP := not isHighLast ? pLast : lowPmidP := (highP + lowP)/2// ] -------- Input Vars --------------- [.breakoutTypeConf = input.string("Mid Pivot", title="Confirmation Type", options=["At First Break", "Mid Pivot", "Opposit Pivot", "No Confirmation"], group="Signal Type Confirmation")lenghtSizeAvgBody = input.int(9, title="Lenght Avg Body", group="Breakouts Settings")firstBreakoutFactor = input.float(0.2, step=0.1, title="First Breakout Factor", tooltip="Factor used to validate the first breakout of the V pattern", group="Breakouts Settings")confBreakoutFactor = input.float(1.2, step=0.1, title="Confirmation Breakout Factor", tooltip="Factor used to validate the confirmation breakout of the V pattern", group="Breakouts Settings")maxNbBarsValidV = input.int(11, title="Max Bars Confirmation", group="Timing Confirmation")// ] -------- Logical Vars ------------- [var _isVbottomPot = falsevar _isVtopPot = false_isVbottom = false_isVtop = falselastLow = 0.0indexLow = 0lastHigh = 0.0indexHigh = 0// Confirm V pattern vars.var lHighVtopPot = 0.0var lLowVbotPot = 0.0var nbBarLVtopPot = 0var nbBarLVbotPot = 0var breakLevelVbotPot = 0.0var breakLevelVtopPot = 0.0// ] -------- Util Functions ----------- [// Cond Vars._bodyHi = math.max(close, open)_bodyLo = math.min(close, open)_body = _bodyHi - _bodyLo_bodyAvg = ta.ema(_body, lenghtSizeAvgBody)_longBody = _body > _bodyAvg_upperWick = high - _bodyHi_greenBody = open < close_redBody = open > close// COND: Potential V pattern._breakAboveLowP = ta.crossover(close, lowP) and _body > _bodyAvg * firstBreakoutFactor_breakUnderHighP = ta.crossunder(close, highP) and _body > _bodyAvg * firstBreakoutFactor // Crossing Vars.breakLevelVbotPot := ta.crossunder(close, lowP) ? lowP : breakLevelVbotPotbreakLevelVtopPot := ta.crossover(close, highP) ? highP : breakLevelVtopPot// @function to get last high/low (handle multiple rsiOver in a row)getIndexHighLowFromNbCandles(bool isLong, int nbCandles) => highLow = isLong ? low : high indexHighLows = 0 // indexHighLow = 0 for counter = 1 to nbCandles + 10 if isLong if low[counter] < highLow highLow := low[counter] indexHighLows := counter else if high[counter] > highLow highLow := high[counter] indexHighLows := counter indexHighLowsisWickCrossPattern (src, isCrossUp) => isCross = false if isCrossUp isCross := _bodyHi < src and src < high else isCross := low < src and src < _bodyLo isCrossgetBreakoutTypeConf(type, isVtop) => switch type "No Confirmation" => isVtop ? highP : lowP "Opposit Pivot" => isVtop ? lowP : highP "Mid Pivot" => midP "At First Break" => isVtop ? breakLevelVtopPot : breakLevelVbotPot isPivotChanged (oldMidP) => midP != oldMidP// ] -------- Logical Script ----------- [// -----// Calculate.lastLowDup = fontilab.getHighLowFromNbCandles(true, 10)indexLowDup = getIndexHighLowFromNbCandles(true, 10)lastHighDup = fontilab.getHighLowFromNbCandles(false, 10)indexHighDup = getIndexHighLowFromNbCandles(false, 10)if _breakAboveLowP lastLow := lastLowDup indexLow := indexLowDup _isVbottomPot := true lLowVbotPot := lastLowelse if _breakUnderHighP lastHigh := lastHighDup indexHigh := indexHighDup _isVtopPot := true lHighVtopPot := lastHigh// Confirm potential V bot pattern.isBreakBarAvg = breakoutTypeConf != "No Confirmation" ? _body > _bodyAvg * confBreakoutFactor : truevBotConfSrc = getBreakoutTypeConf(breakoutTypeConf, false)_isVbottom := _isVbottomPot and ta.crossover(close, vBotConfSrc) and isBreakBarAvgif _isVbottomPot // Cond V pot invalidated or finished. if not _isVbottom and low >= lLowVbotPot and nbBarLVbotPot <= maxNbBarsValidV nbBarLVbotPot := nbBarLVbotPot + 1 else _isVbottomPot := false nbBarLVbotPot := 0// Confirm potential V top pattern.vTopConfSrc = getBreakoutTypeConf(breakoutTypeConf, true)_isVtop := _isVtopPot and ta.crossunder(close, vTopConfSrc) and isBreakBarAvgif _isVtopPot // Cond V pot invalidated or finished. if not _isVtop and high <= lHighVtopPot and nbBarLVtopPot <= maxNbBarsValidV nbBarLVtopPot := nbBarLVtopPot + 1 else // reinit for next V patter. _isVtopPot := false nbBarLVtopPot := 0// -----// BUY / SELL COND.buyCond = _isVbottomsellCond = _isVtop// ] -------- Strategy Part ------------ [// if buyCond// strategy.entry("L", strategy.long, alert_message="Buy Signal")// if sellCond// strategy.entry("S", strategy.short, alert_message="Sell Signal") // ] -------- Plot Part & Alerts ------- [midPPlot = plot(midP, title='Mid Pivot', linewidth=1, color=color.yellow, display=display.none)highPlot = plot(highP, title='High Pivot', linewidth=1, color=color.red, display=display.none)lowPlot = plot(lowP, title='Low Pivot', linewidth=1, color=color.green, display=display.none)distLabel = ta.atr(30) * 0.2if buyCond label.new(x = bar_index, y = low - distLabel, xloc = xloc.bar_index, text = "V", style = label.style_label_up, color = color.green, size = size.small, textcolor = color.white, textalign = text.align_center)else if sellCond label.new(x = bar_index, y = high + distLabel, xloc = xloc.bar_index, text = "V", style = label.style_label_down, color = color.red, size = size.small, textcolor = color.white, textalign = text.align_center)if _breakAboveLowP label.new(x = bar_index - indexLowDup, y = low[indexLowDup] - distLabel, xloc = xloc.bar_index, text = "Vp", style = label.style_label_up, color = color.new(color.green, 70), size = size.small, textcolor = color.white, textalign = text.align_center)else if _breakUnderHighP label.new(x = bar_index - indexHighDup, y = high[indexHighDup] + distLabel, xloc = xloc.bar_index, text = "Vp", style = label.style_label_down, color = color.new(color.red, 70), size = size.small, textcolor = color.white, textalign = text.align_center)