Zeal Terminal Open Zeal Terminal

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
Does not run in Zeal Terminal yetIt imports the library Fontiramisu/fontilab/8, whose source is not available here, so it does not run here. The settings, logic and review below are read from the source, which does not need a run.

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.

SettingDefaultType and rangeFeeds
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.1float · min 0 · step 0.1dupLineLast dupIsHighLast dupIPrev dupILast dupPLast dupPLastHigh dupPLastLow
DepthThe minimum number of bars that will be taken into account when analyzing pivots.8int · min 1dupLineLast dupIsHighLast dupIPrev dupILast dupPLast dupPLastHigh dupPLastLow
Signal Type Confirmation
Confirmation TypeMid Pivotstring · options ["At First Break", "Mid Pivot", "Opposit Pivot", "No Confirmation"]isBreakBarAvg vBotConfSrc vTopConfSrc
Breakouts Settings
Lenght Avg Body9int_bodyAvg
First Breakout FactorFactor used to validate the first breakout of the V pattern0.2float · step 0.1_breakAboveLowP _breakUnderHighP
Confirmation Breakout FactorFactor used to validate the confirmation breakout of the V pattern1.2float · step 0.1isBreakBarAvg
Timing Confirmation
Max Bars Confirmation11intline 134 line 144

What it calculates

  • Crossunderclose, lowPbreakLevelVbotPot · line 78
  • Crossoverclose, highPbreakLevelVtopPot · line 79
  • EMA_body, Lenght Avg Body (9)_bodyAvg · line 69
  • ATR30distLabel · 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.

closecloseprice datalenghtSizeAvgBodyLenght Avg Bodysetting · 9high · low · closehigh · low · closeprice datalowlowprice datahighhighprice datathresholdMultiplierDeviationsetting · 3.1depthDepthsetting · 8openopenprice databreakoutTypeConfConfirmation Typesetting · Mid PivotconfBreakoutFactorConfirmation Breakout F…setting · 1.2firstBreakoutFactorFirst Breakout Factorsetting · 0.2breakLevelVbotPotCrossunder→ breakLevelVbotPotbreakLevelVtopPotCrossover→ breakLevelVtopPot_bodyAvgEMA→ _bodyAvgdistLabelATR→ distLabellineLastlineLastvalueiLastiLastvalueiPreviPrevvaluepLastpLastvaluepLastHighpLastHighvaluepLastLowpLastLowvalueisHighLastisHighLastvaluedupLineLast, dupIsHighLast, dupIPrev, dupILast, dupPLast, dupPLastHigh, dupPLastLowdupLineLast · dupIsHigh…7 valueshighPhighPvaluelowPlowPvaluemidPmidPvaluelastLow, indexLow, lastHigh, indexHigh, indexHighLowslastLow · indexLow +35 valueslHighVtopPotlHighVtopPotvaluelLowVbotPotlLowVbotPotvaluenbBarLVtopPotnbBarLVtopPotvaluenbBarLVbotPotnbBarLVbotPotvalue_bodyHi, _bodyLo_bodyHi · _bodyLo2 values_body_bodyvalue_upperWick_upperWickvaluehighLowhighLowvalueisBreakBarAvgisBreakBarAvgvaluevBotConfSrc, vTopConfSrcvBotConfSrc · vTopConfS…2 valuesbuyCondbuyCondvaluesellCondsellCondvalue_isVbottom, _isVtop_isVbottom · _isVtop2 conditions_longBody_longBodycondition_greenBody, _redBody_greenBody · _redBody2 conditions_breakAboveLowP_breakAboveLowPcondition_breakUnderHighP_breakUnderHighPconditionisCrossisCrossconditionplot:160Mid Pivotplotplot:161High Pivotplotplot:162Low Pivotplot

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.

ScriptSharesTypeNetTradesMax drawdown
Trend Reversal - Potential pressure by BardiaB2atr emav4 strategy+133,960.0%51,504.8%
Simple Ema_ATR Strategy HulkTrading by TheHulkTradingema atrv4 strategy+2.2%1415.6%
Keltner Breakout Strategy by Zeal Terminalema atrv5 strategy+3.5%212.3%
[EKIN] ATR Exit Strategy by ekinbasarkomurema atrv5 strategy+781.7%302,960.8%
DEMA-EMA & VOLATILITY (VAMS) by Qorbanjfema atrv4 strategy+2,833,450.0%1915,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

Verified

Nothing 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

EngineCompilesRunsMatches TradingView
Zeal Terminal · OpenPineScript v2No It imports the library Fontiramisu/fontilab/8, whose source is not available here, so it does not run hereNot measured
PineTSNot testedNot testedNot 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)